diff --git a/package2/group/groupBuyList.vue b/package2/group/groupBuyList.vue index 6002d27..7758389 100644 --- a/package2/group/groupBuyList.vue +++ b/package2/group/groupBuyList.vue @@ -157,6 +157,9 @@ {{item.saleCount != null ? item.saleCount : 0}}人跟拼 + + {{formatSelfDeliveryTag(item)}} + @@ -524,9 +527,14 @@ const products = Array.isArray(item.products) ? item.products : [] const cookingTimeValue = item.shopTakeaway && item.shopTakeaway.cookingTime ? Number(item.shopTakeaway.cookingTime) : 0 const cookingTime = isNaN(cookingTimeValue) ? 0 : cookingTimeValue + const selfDeliveryTime = Number(item.shopDeliveryDuration) item._dormStatus = this.groupTags[index % this.groupTags.length] item._groupTip = ['还差1人就成团', '刚下课,大家都在拼', '这口热乎的很适合夜宵', '附近同学想一起点'][index % 4] - item.groupDeliveryTime = item.groupDeliveryTime === null || item.groupDeliveryTime === undefined ? cookingTime + 30 : item.groupDeliveryTime + if (item.supportShopDelivery == 1 && !isNaN(selfDeliveryTime) && selfDeliveryTime > 0) { + item.groupDeliveryTime = cookingTime + selfDeliveryTime + } else { + item.groupDeliveryTime = item.groupDeliveryTime === null || item.groupDeliveryTime === undefined ? cookingTime + 30 : item.groupDeliveryTime + } item._liveAvatars = [ this.groupAvatars[index % this.groupAvatars.length], this.groupAvatars[(index + 1) % this.groupAvatars.length], @@ -536,6 +544,12 @@ return item }) }, + formatSelfDeliveryTag(item) { + const fee = parseFloat(item.orderBkge || 0) + const feeText = fee > 0 ? `¥${fee.toFixed(1)}` : '免配送费' + const locationText = item.shopDeliveryLocation == 1 ? '送宿舍' : '送楼下' + return `商家自配送 · ${feeText} · ${locationText}` + }, judgeBusinessStatus() { for (let i = 0; i < this.shopList.length; i++) { if (this.shopList[i].shopTakeaway != '' && this.shopList[i].shopTakeaway != null) { @@ -1346,6 +1360,23 @@ } } + .self-delivery-row { + display: inline-block; + max-width: 100%; + margin-top: 10rpx; + padding: 6rpx 12rpx; + border-radius: 18rpx; + background: rgba(255, 111, 44, 0.08); + color: #ff6f2c; + font-size: 20rpx; + font-weight: 900; + line-height: 28rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + box-sizing: border-box; + } + .shop-content-bottom { display: flex; align-items: center; diff --git a/package2/myCenter/partTimeJobRegister.vue b/package2/myCenter/partTimeJobRegister.vue index 8c9310c..ff8c41a 100644 --- a/package2/myCenter/partTimeJobRegister.vue +++ b/package2/myCenter/partTimeJobRegister.vue @@ -41,6 +41,21 @@ style="background: rgba(247, 248, 248, 0.6);height: 80rpx;line-height: 80rpx;padding: 18rpx 20rpx;border-radius: 20rpx;"> + + + * 送达地点 + + + + 送上楼 + + + 送到宿舍门口 + + + * 手机号 @@ -244,6 +259,7 @@ formData: { name: '', highFloorFee: 0, + deliveryLocation: 0, paotui: false, waima: false, mobile: '', @@ -303,6 +319,8 @@ if (data.mobile) that.formData.mobile = data.mobile; if (data.highFloorFee !== undefined && data.highFloorFee !== null) that.formData .highFloorFee = data.highFloorFee; + if (data.deliveryLocation !== undefined && data.deliveryLocation !== null) that.formData + .deliveryLocation = data.deliveryLocation; let list = data.workerRelaPriceList || []; let waimaList = list.filter(item => item.orderType == 0); @@ -356,6 +374,10 @@ } this.$forceUpdate() }, + selectDeliveryLocation(value) { + this.formData.deliveryLocation = value + this.$forceUpdate() + }, qucanOrsongcan(type, index) { if (type == 'qucan') { this.qucan[index].checked = !this.qucan[index].checked @@ -498,6 +520,7 @@ workerName: this.formData.name, cardPicture: this.formData.studentCard, highFloorFee: this.formData.highFloorFee, + deliveryLocation: this.formData.deliveryLocation, mobile: this.formData.mobile, workerRelaPriceList: workerRelaPriceList }; @@ -676,6 +699,10 @@ margin-right: 20rpx; } + .delivery-location-btn { + width: 240rpx; + } + .value1 { background: rgba(247, 248, 248, 0.6); border-radius: 20rpx; diff --git a/package2/shop/merchantCenter.vue b/package2/shop/merchantCenter.vue index 77e3a56..3128f7d 100644 --- a/package2/shop/merchantCenter.vue +++ b/package2/shop/merchantCenter.vue @@ -32,7 +32,7 @@ - + {{daichucan}} @@ -66,7 +66,7 @@ - + {{shopData.refundCount == undefined?0:shopData.refundCount}} @@ -81,7 +81,18 @@ 待回复差评 + + + {{shopData.shopDeliveryPendingCount == undefined?0:shopData.shopDeliveryPendingCount}} + + + 自配送订单 + + + @@ -284,6 +295,9 @@ case 'sjxx': url = '/package2/shop/shopInfo' break; + case 'selfDelivery': + url = '/package2/shop/selfDeliveryOrderList' + break; case 'dd': url = '/package2/shop/shopOrderList' break; diff --git a/package2/shop/merchantRegister.vue b/package2/shop/merchantRegister.vue index 1f55dc7..025daa8 100644 --- a/package2/shop/merchantRegister.vue +++ b/package2/shop/merchantRegister.vue @@ -193,6 +193,58 @@ + + 商家自配送 + + 支持自配送 + + + + + + + + 配送费 + + + + + + 送达位置 + + + + {{deliveryLocationText || '请选择送达位置'}} + + + + + + + 配送时长 + + + + + + 配送员电话 + + + 查询 + + + + 已绑定 + + {{formData.workerName}} {{formData.workerPhone}} + + + + @@ -217,6 +269,14 @@ value: 2, text: '团购商家' }], + deliveryLocationList: [{ + value: 1, + text: '送到宿舍' + }, { + value: 2, + text: '送到楼下' + }], + workerMobile:'', formData: { regionId:'', region:'', @@ -239,13 +299,26 @@ id:'', merchantType:1, //1外卖商家 2团购商家 isStudent:0, //1学生商家 0不是学生 - unionid:'' + unionid:'', + supportShopDelivery:0, + orderBkge:0, + shopDeliveryLocation:'', + shopDeliveryDuration:'', + workerId:'', + workerName:'', + workerPhone:'' }, choose:false, isChoose:false, clock: 60 ,// 倒计时 }; }, + computed:{ + deliveryLocationText(){ + let item = this.deliveryLocationList.find(item => item.value == this.formData.shopDeliveryLocation) + return item ? item.text : '' + } + }, onLoad(option) { }, @@ -334,6 +407,7 @@ submit() { let that = this; let url = '' + this.normalizeSelfDelivery() let verify = this.verifyField() if(verify != true){ uni.showToast({ @@ -371,6 +445,54 @@ clickRadio(type){ this.formData.isStudent = type }, + setSelfDelivery(type){ + this.formData.supportShopDelivery = type + if(type != 1){ + this.formData.orderBkge = 0 + this.formData.shopDeliveryLocation = '' + this.formData.shopDeliveryDuration = '' + this.formData.workerId = '' + this.formData.workerName = '' + this.formData.workerPhone = '' + this.workerMobile = '' + } + }, + formatOrderBkge(){ + let value = parseFloat(this.formData.orderBkge || 0) + if(isNaN(value) || value < 0) value = 0 + this.formData.orderBkge = Number(value.toFixed(1)) + }, + deliveryLocationChange(e){ + const item = this.deliveryLocationList[e.detail.value] + if(item){ + this.formData.shopDeliveryLocation = item.value + } + }, + findWorker(){ + if(!this.workerMobile){ + this.tui.toast('请输入配送员手机号') + return + } + this.tui.request('/app/shop/findWorkerByMobile', 'GET', { + mobile: this.workerMobile + }, false, true).then((res) => { + if(res.code == 200){ + this.formData.workerId = res.result.workerId + this.formData.workerName = res.result.workerName + this.formData.workerPhone = res.result.workerPhone || res.result.mobile + this.tui.toast('绑定成功') + }else{ + this.tui.toast(res.message) + } + }) + }, + normalizeSelfDelivery(){ + if(this.formData.merchantType != 1 || this.formData.supportShopDelivery != 1){ + this.setSelfDelivery(0) + return + } + this.formatOrderBkge() + }, //获取区域 getRegionList() { let that = this; @@ -455,6 +577,12 @@ msg = '法人姓名' }else if(data.shopLecard == ''){ msg = '法人身份证' + }else if(data.merchantType == 1 && data.supportShopDelivery == 1 && !data.shopDeliveryLocation){ + msg = '送达位置' + }else if(data.merchantType == 1 && data.supportShopDelivery == 1 && !data.shopDeliveryDuration){ + msg = '配送时长' + }else if(data.merchantType == 1 && data.supportShopDelivery == 1 && !data.workerId){ + msg = '自配送配送员' } return msg == ""?true:msg } @@ -505,6 +633,15 @@ box-shadow: 0 8rpx 24rpx rgba(0, 35, 28, 0.06); overflow: hidden; } + .section-title{ + height: 86rpx; + line-height: 86rpx; + padding: 0 24rpx; + font-size: 30rpx; + font-weight: 700; + color: #00231C; + border-bottom: 1px solid #eef2ef; + } .value{ width: 100%; min-height: 92rpx; @@ -557,6 +694,25 @@ align-items: center; width: 360rpx; } + .worker-query{ + display: flex; + align-items: center; + justify-content: flex-end; + } + .worker-query input{ + flex: 1; + min-width: 0; + } + .query-btn{ + margin-left: 16rpx; + padding: 0 20rpx; + height: 56rpx; + line-height: 56rpx; + border-radius: 28rpx; + background: #0b9b73; + color: #fff; + font-size: 24rpx; + } .code-row input{ flex: 1; min-width: 0; diff --git a/package2/shop/selfDeliveryOrderList.vue b/package2/shop/selfDeliveryOrderList.vue new file mode 100644 index 0000000..e223d4b --- /dev/null +++ b/package2/shop/selfDeliveryOrderList.vue @@ -0,0 +1,471 @@ + + + + + diff --git a/package2/shop/shopInfo.vue b/package2/shop/shopInfo.vue index b27cf96..0b5d6a8 100644 --- a/package2/shop/shopInfo.vue +++ b/package2/shop/shopInfo.vue @@ -85,6 +85,53 @@ + + 商家自配送 + + 支持自配送 + + + + + + + + 配送费 + + + + + + 送达位置 + + + {{deliveryLocationText || '请选择'}} + + + + + 配送时长 + + + + + + 配送员电话 + + + 查询 + + + + 已绑定 + {{shop.workerName}} {{shop.workerPhone}} + + + 保存 @@ -99,7 +146,21 @@ return { shop:{}, shopImages:[], - huanjing:'' + huanjing:'', + workerMobile:'', + deliveryLocationList:[{ + value: 1, + text: '送到宿舍' + },{ + value: 2, + text: '送到楼下' + }] + } + }, + computed:{ + deliveryLocationText(){ + let item = this.deliveryLocationList.find(item => item.value == this.shop.shopDeliveryLocation) + return item ? item.text : '' } }, onLoad() { @@ -117,6 +178,9 @@ delete this.shop[key]; } } + if(this.shop.supportShopDelivery == null) this.shop.supportShopDelivery = 0 + if(this.shop.orderBkge == null) this.shop.orderBkge = 0 + this.workerMobile = this.shop.workerPhone || '' }, methods: { navigatorTo(e){ @@ -180,22 +244,107 @@ uni.hideLoading(); }, 1000) }, + setSelfDelivery(type){ + this.shop.supportShopDelivery = type + if(type != 1){ + this.shop.orderBkge = 0 + this.shop.shopDeliveryLocation = '' + this.shop.shopDeliveryDuration = '' + this.shop.workerId = '' + this.shop.workerName = '' + this.shop.workerPhone = '' + this.workerMobile = '' + } + }, + formatOrderBkge(){ + let value = parseFloat(this.shop.orderBkge || 0) + if(isNaN(value) || value < 0) value = 0 + this.shop.orderBkge = Number(value.toFixed(1)) + }, + deliveryLocationChange(e){ + const item = this.deliveryLocationList[e.detail.value] + if(item){ + this.shop.shopDeliveryLocation = item.value + } + }, + findWorker(){ + if(!this.workerMobile){ + this.tui.toast('请输入配送员手机号') + return + } + this.tui.request('/app/shop/findWorkerByMobile', 'GET', { + mobile: this.workerMobile + }, false, true).then((res) => { + if(res.code == 200){ + this.shop.workerId = res.result.workerId + this.shop.workerName = res.result.workerName + this.shop.workerPhone = res.result.workerPhone || res.result.mobile + this.tui.toast('绑定成功') + }else{ + this.tui.toast(res.message) + } + }) + }, + normalizeSelfDelivery(){ + if(this.shop.supportShopDelivery != 1){ + this.setSelfDelivery(0) + return true + } + this.formatOrderBkge() + if(!this.shop.shopDeliveryLocation){ + this.tui.toast('请选择送达位置') + return false + } + if(!this.shop.shopDeliveryDuration){ + this.tui.toast('请输入配送时长') + return false + } + if(!this.shop.workerId){ + this.tui.toast('请绑定配送员') + return false + } + return true + }, + updateLocalShopCache(){ + let shopList = uni.getStorageSync('schoolShop') || [] + if(Array.isArray(shopList)){ + shopList = shopList.map(item => item.id == this.shop.id ? Object.assign({}, item, this.shop) : item) + uni.setStorageSync('schoolShop', shopList) + } + uni.setStorageSync('shop', this.shop) + }, submit(){ - that.tui.request("/app/shop/edit", "PUT", this.shop, false, true).then((res) => { + if(!this.normalizeSelfDelivery()) return + this.tui.request("/app/shop/updateSelfDelivery", "post", { + id: this.shop.id, + supportShopDelivery: this.shop.supportShopDelivery, + orderBkge: this.shop.orderBkge, + shopDeliveryLocation: this.shop.shopDeliveryLocation, + shopDeliveryDuration: this.shop.shopDeliveryDuration, + workerId: this.shop.workerId, + workerName: this.shop.workerName, + workerPhone: this.shop.workerPhone + }, false, true).then((deliveryRes) => { + if (deliveryRes.code != 200) { + this.tui.toast(deliveryRes.message) + return Promise.reject(deliveryRes) + } + return this.tui.request("/app/shop/edit", "PUT", this.shop, false, true) + }).then((res) => { if (res.code == 200) { + this.updateLocalShopCache() uni.showModal({ title: '提示', content: '更新信息成功', showCancel:false, - success: function (res) { - uni.setStorageSync('shop',this.shop) + success: (res) => { if (res.confirm) { uni.navigateBack() } } }); } else { - that.tui.toast(res.message) + this.tui.toast(res.message) } uni.hideLoading() }).catch((res) => {}) @@ -218,6 +367,13 @@ margin-top: 20rpx; } + .section-title{ + height: 88rpx; + line-height: 88rpx; + padding-left: 20rpx; + font-weight: 700; + border-bottom: 1px solid #eee; + } .list-1{ display: flex; width: 100%; @@ -249,6 +405,30 @@ padding-right: 20rpx; overflow: hidden; } + .list-right input{ + height: 100rpx; + line-height: 100rpx; + text-align: right; + } + .worker-query{ + display: flex; + align-items: center; + justify-content: flex-end; + } + .worker-query input{ + flex: 1; + min-width: 0; + } + .query-btn{ + margin-left: 12rpx; + padding: 0 18rpx; + height: 56rpx; + line-height: 56rpx; + border-radius: 28rpx; + background: #0b9b73; + color: #fff; + font-size: 24rpx; + } .upload-img{ width:60rpx; height: 60rpx;