123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <template>
- <view class="content">
- <view class="item">
- <view class="item-tit">
- 店铺名称
- </view>
- <input type="text" v-model="store.name"/>
- </view>
- <view class="item">
- <view class="item-tit">
- 商家电话
- </view>
- <input type="number" v-model="store.phone"/>
- </view>
- <view class="item">
- <view class="item-tit">
- 商家地址
- </view>
- <input type="text" v-model="store.detailed_address"/>
- </view>
- <view class="item">
- <view class="item-tit">
- 营业时间
- </view>
- <input type="text" v-model="store.day_time"/>
- </view>
- <view class="item">
- <view class="item-tit">
- 商户简介
- </view>
- <textarea v-model="store.introduction" placeholder="" />
- </view>
- <view class="item">
- <view class="item-tit">
- 门户头像
- </view>
- <view class="up-wrapper">
- <image :src="store.image" mode="" v-if="store.image" @click.stop="upImg"></image>
- <image src="../../static/img/add.png" mode="" v-else @click.stop="upImg"></image>
- </view>
- </view>
- <view class="sub" @click="sub">
- 确认修改
- </view>
- </view>
- </template>
- <script>
-
- import {
- upload,editStore
- } from '@/api/user.js';
- export default {
- data() {
- return {
- store: {},
- // name: '鑫旺零售台州店',
- // phone: '12345678911',
- // address: '台州市市府大道110号',
- // info: '店铺简介店铺简介店铺简介店铺简介店铺简介店铺简介铺简介店铺简介店铺简介店铺简介店铺简介店铺简介店铺简介',
- // workTime: '8:30-12:00,13:30-17:00',
- // logo: ''
- }
- },
- onLoad(opt) {
- this.store = JSON.parse(opt.item)
- console.log(this.store,'this.store++++++++++++')
- },
- methods:{
- // 修改logo
- upImg() {
- let obj = this
- upload({
- filename: ''
- }).then(res => {
- console.log(res[0].url)
- obj.store.image= res[0].url
- });
- },
- //提交
- sub() {
- let obj = this
- let store = obj.store
- if(store.name == '') {
- obj.$api.msg('请输入店铺名称')
- return
- }
- if(store.phone == '') {
- obj.$api.msg('请输入店铺电话')
- return
- }
- if(store.image == '') {
- obj.$api.msg('请选择店铺头像')
- return
- }
- if(store.day_time == '') {
- obj.$api.msg('请输入营业时间')
- return
- }
- if(store.introduction == '') {
- obj.$api.msg('请输入店铺简介')
- return
- }
- if(store.detailed_address == '') {
- obj.$api.msg('请输入店铺地址')
- return
- }
- uni.showLoading({
- title: '提交中...',
- mask: true
- })
- editStore({
- name: store.name,
- introduction: store.introduction,
- image: store.image,
- phone: store.phone,
- day_time: store.day_time
- }).then( res => {
- uni.hideLoading()
- uni.showToast({
- title: '提交成功',
- duration: 2000
- });
- setTimeout(()=> {
- uni.navigateBack({})
- },2000)
- }).catch( err => {
- uni.hideLoading()
- console.log(err)
- })
- }
-
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- height: 100%;
- background-color: #f8f6f6;
- }
- .item {
- background-color: #fff !important;
- min-height: 100rpx;
- display: flex;
- width: 750px;
- border: 1px #F4F4F4 solid;
- .item-tit {
- height: 100rpx;
- line-height: 100rpx;
- padding-left: 30rpx;
- width: 200rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- flex-shrink: 0;
- }
- input {
- width: 550rpx;
- height: 100rpx;
- line-height: 100rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- textarea {
- width: 550rpx;
- height: 257rpx;
- padding-top: 45rpx;
- padding-right: 30rpx;
- line-height: 50rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .up-wrapper {
- height: 352rpx;
- width: 550rpx;
- position: relative;
- image {
- position: absolute;
- height: 160rpx;
- width: 160rpx;
- top: 0;
- bottom: 0;
- left: 94rpx;
- margin: auto;
- }
- }
- }
- .sub {
- width: 674rpx;
- height: 88rpx;
- background: #FF4C4C;
- border-radius: 44rpx;
- line-height: 88rpx;
- text-align: center;
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- position: absolute;
- bottom: 35rpx;
- left: 0;
- right: 0;
- margin: auto;
- }
- </style>
|