diff --git a/pages/login/login.vue b/pages/login/login.vue index b936cbe..3447097 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -48,11 +48,11 @@ {{i18n.login.login}} - - + + 选择登录店铺 - + {{item.shopName}} @@ -419,4 +419,31 @@ \ No newline at end of file diff --git a/pages/myCenter/businessInfo.vue b/pages/myCenter/businessInfo.vue index 61e0cfc..5ef6bd9 100644 --- a/pages/myCenter/businessInfo.vue +++ b/pages/myCenter/businessInfo.vue @@ -1,97 +1,72 @@ @@ -99,7 +74,32 @@ export default { data() { return { - shop:{} + shop: { + shopId: '', + shopName: '', + businessHourBegin: '', + businessHourEnd: '', + status: 0, + commissionRateMore: '', + commissionRateOne: '', + type: '', + isDelivery: 0, + cookingTime: '' + }, + submitLoading: false, + statusList: [{ + value: 0, + text: '正常营业' + }, { + value: 1, + text: '暂停营业' + }] + } + }, + computed: { + statusText() { + const item = this.statusList.find(item => item.value == this.shop.status) + return item ? item.text : '正常营业' } }, onLoad() { @@ -124,27 +124,42 @@ }) }, - bindTimeChange(e,type){ - if(type == 'start'){ - this.shop.businessHourBegin = e.detail.value - }else{ - this.shop.businessHourEnd = e.detail.value - } - + bindTimeChange(e, key) { + this.shop[key] = e.detail.value + }, + statusChange(e) { + const item = this.statusList[e.detail.value] + if (item) this.shop.status = item.value + }, + validateForm() { + if (!this.shop.businessHourBegin) return '请选择营业开始时间' + if (!this.shop.businessHourEnd) return '请选择营业结束时间' + return '' }, submit(){ - this.NB.sendRequest('/app/shoptakeaway/update', this.shop, false, 'POST', 'application/x-www-form-urlencoded').then(res => { + const error = this.validateForm() + if (error) { + this.tui.toast(error) + return + } + const payload = { + id: this.shop.id, + shopId: this.shop.shopId || uni.getStorageSync('shopId'), + businessHourBegin: this.shop.businessHourBegin, + businessHourEnd: this.shop.businessHourEnd, + status: Number(this.shop.status) + } + this.submitLoading = true + this.NB.sendRequest('/app/shoptakeaway/update', payload, false, 'POST', 'application/x-www-form-urlencoded').then(res => { if (res.code == 200) { uni.showModal({ title: '提示', - content: '更新信息成功', - showCancel:false, - success: function (res) { - if (res.confirm) { - uni.navigateBack() - } + content: '经营信息已更新', + showCancel: false, + success: (modalRes) => { + if (modalRes.confirm) uni.navigateBack() } - }); + }) } else { uni.showToast(res.message) } @@ -155,61 +170,153 @@ \ No newline at end of file diff --git a/pages/myCenter/shopDetail.vue b/pages/myCenter/shopDetail.vue index 8a16d13..4a22ee6 100644 --- a/pages/myCenter/shopDetail.vue +++ b/pages/myCenter/shopDetail.vue @@ -1,174 +1,79 @@