wangfukang 21 hours ago
parent
commit
438f44f923
  1. 33
      package2/group/groupBuyList.vue
  2. 27
      package2/myCenter/partTimeJobRegister.vue
  3. 18
      package2/shop/merchantCenter.vue
  4. 158
      package2/shop/merchantRegister.vue
  5. 471
      package2/shop/selfDeliveryOrderList.vue
  6. 190
      package2/shop/shopInfo.vue

33
package2/group/groupBuyList.vue

@ -157,6 +157,9 @@
<text>{{item.saleCount != null ? item.saleCount : 0}}</text>人跟拼
</view>
</view>
<view class="self-delivery-row" v-if="item.supportShopDelivery == 1">
{{formatSelfDeliveryTag(item)}}
</view>
</view>
</view>
<view class="shop-bottom" v-if="item._visibleProducts && item._visibleProducts.length > 0">
@ -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;

27
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;">
</view>
</view>
<view class="box1">
<view class="reg-name">
<text style="color:red;">*</text> 送达地点
</view>
<view class="reg-value" style="display: flex;">
<view class="box-check-btn delivery-location-btn" @tap="selectDeliveryLocation(0)"
:style="{background:formData.deliveryLocation == 0?'rgba(180, 255, 238, 0.27)':'rgba(247, 248, 248, 0.6)',border:formData.deliveryLocation == 0?'1px solid rgba(180, 255, 238, 1)':'1px solid #777'}">
送上楼
</view>
<view class="box-check-btn delivery-location-btn" @tap="selectDeliveryLocation(1)"
:style="{background:formData.deliveryLocation == 1?'rgba(180, 255, 238, 0.27)':'rgba(247, 248, 248, 0.6)',border:formData.deliveryLocation == 1?'1px solid rgba(180, 255, 238, 1)':'1px solid #777'}">
送到宿舍门口
</view>
</view>
</view>
<view class="box1">
<view class="reg-name">
<text style="color:red;">*</text> 手机号
@ -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;

18
package2/shop/merchantCenter.vue

@ -32,7 +32,7 @@
<view class="order2">
<view class="order22">
<view class="order33" @tap="goDetail('db',13)">
<view class="order44">
<view class="order44" style="color: red;">
{{daichucan}}
</view>
<view class="order55">
@ -66,7 +66,7 @@
</view>
</view>
<view class="order33" @tap="goDetail('tui',11)">
<view class="order44">
<view class="order44" style="color: red;">
{{shopData.refundCount == undefined?0:shopData.refundCount}}
</view>
<view class="order55">
@ -81,7 +81,18 @@
待回复差评
</view>
</view>
<view class="order33" @tap="goDetail('selfDelivery')">
<view class="order44" style="color: red;">
{{shopData.shopDeliveryPendingCount == undefined?0:shopData.shopDeliveryPendingCount}}
</view>
<view class="order55">
自配送订单
</view>
</view>
</view>
<!-- <view class="order22">
</view> -->
</view>
</view>
<view class="shop-order">
@ -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;

158
package2/shop/merchantRegister.vue

@ -193,6 +193,58 @@
</view>
</view>
</view>
<view class="content" v-if="formData.merchantType == 1">
<view class="section-title">商家自配送</view>
<view class="value">
<view class="name">支持自配送</view>
<view class="text" style="text-align: right;">
<label class="radio" style="padding-right: 20rpx;" @tap="setSelfDelivery(1)">
<radio :checked="formData.supportShopDelivery == 1" /><text></text>
</label>
<label class="radio" @tap="setSelfDelivery(0)">
<radio :checked="formData.supportShopDelivery == 0" /><text></text>
</label>
</view>
</view>
<block v-if="formData.supportShopDelivery == 1">
<view class="value">
<view class="name">配送费</view>
<view class="text">
<input type="digit" v-model="formData.orderBkge" placeholder="默认0,最多1位小数" @blur="formatOrderBkge" />
</view>
</view>
<view class="value">
<view class="name">送达位置</view>
<view class="text" style="text-align: right;">
<picker :range="deliveryLocationList" range-key="text" @change="deliveryLocationChange">
<view class="picker-text" :class="{ placeholder: !formData.shopDeliveryLocation }">
{{deliveryLocationText || '请选择送达位置'}}
<uni-icons type="bottom" size="14" color="#999"></uni-icons>
</view>
</picker>
</view>
</view>
<view class="value">
<view class="name">配送时长</view>
<view class="text">
<input type="number" v-model="formData.shopDeliveryDuration" placeholder="请输入分钟数" />
</view>
</view>
<view class="value">
<view class="name">配送员电话</view>
<view class="text worker-query">
<input type="number" v-model="workerMobile" placeholder="输入配送员手机号" />
<view class="query-btn" @tap="findWorker">查询</view>
</view>
</view>
<view class="value" v-if="formData.workerId">
<view class="name">已绑定</view>
<view class="text" style="text-align: right;">
{{formData.workerName}} {{formData.workerPhone}}
</view>
</view>
</block>
</view>
<button @tap.stop="submit()">保存</button>
</view>
@ -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;

471
package2/shop/selfDeliveryOrderList.vue

@ -0,0 +1,471 @@
<template>
<view class="page">
<view class="fixed-head">
<view class="nav" :style="{'height': navHeight + 'px'}">
<view class="back-btn" :style="{'top': backTop + 'px'}" @tap="back">
<uni-icons type="left" size="26"></uni-icons>
</view>
<view class="nav-title">自配送订单</view>
</view>
<view class="tabs">
<view class="tab" :class="{active: tab === 'pickup'}" @tap="switchTab('pickup')">待取货</view>
<view class="tab" :class="{active: tab === 'complete'}" @tap="switchTab('complete')">待送达</view>
</view>
</view>
<scroll-view class="list" :style="{'top': listTop + 'px'}" scroll-y @scrolltolower="loadMore">
<view class="card" v-for="(item,index) in list" :key="item.id">
<view class="card-head">
<view class="tag">商家自配送</view>
<view class="time">{{item.mustFinishTime | formatTime}}前送达</view>
</view>
<view class="order-code" v-if="item.numberCode">#{{item.numberCode}}</view>
<view class="address">
<view class="dot get"></view>
<view>
<view class="name">{{item.shopName}}</view>
<view class="desc">{{item.shopAddress}}</view>
<view class="phone-row" v-if="item.shopPhone" @tap.stop="makeCall(item.shopPhone)">
商家电话{{item.shopPhone}}
</view>
</view>
</view>
<view class="address">
<view class="dot send"></view>
<view>
<view class="name">{{item.receiverName}} {{item.receiverPhone}}</view>
<view class="desc">{{item.receiverAddress}}</view>
<view class="phone-row" v-if="item.receiverPhone" @tap.stop="makeCall(item.receiverPhone)">
用户电话{{item.receiverPhone}}
</view>
</view>
</view>
<view class="goods-row" v-if="item.goodsList && item.goodsList.length > 0" @tap="productDetail(item)">
<view class="goods-title">商品详情</view>
<view class="goods-desc">{{goodsCount(item)}}点击查看规格和数量</view>
<uni-icons type="right" size="14" color="#7a8582"></uni-icons>
</view>
<view class="remark" v-if="item.remark">备注{{item.remark}}</view>
<view class="fee">配送费 {{item.deliveryFee || 0}}</view>
<view class="btn" @tap="handleOrder(index,item)">
{{buttonText(item)}}
</view>
</view>
<view class="empty" v-if="list.length === 0 && loadStatus === 'nomore'">暂无订单</view>
</scroll-view>
<uni-popup ref="productPopup" background-color="transparent">
<view class="product-popup-content">
<view class="product-popup-header">
<view class="product-popup-title">商品详情</view>
<view class="product-popup-subtitle">请核对商品规格和数量</view>
</view>
<view class="product-popup-list" v-if="productData && productData.length > 0">
<view class="product-popup-card" v-for="(item1,index1) in productData" :key="index1">
<view class="product-popup-img">
<img :src="item1.productPicture" alt="">
</view>
<view class="product-popup-info">
<view class="product-popup-name">{{item1.productName}}</view>
<view class="product-popup-spec">
<text class="product-popup-label">规格</text>
<text class="product-popup-spec-text">{{formatSpecs(item1.specs)}}</text>
</view>
</view>
<view class="product-popup-quantity">
<view class="product-popup-quantity-num">x{{item1.quantity}}</view>
<view class="product-popup-quantity-label">数量</view>
</view>
</view>
</view>
<view class="product-popup-empty" v-else>暂无商品详情</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
tab: 'pickup',
list: [],
loadStatus: 'more',
totalPages: 1,
searchForm: {
pageNum: 1,
pageSize: 10,
status: 1,
deliveryType: 1,
shopDelivery: 1,
shopId: '',
workerId: '',
regionId: ''
},
menuButtonInfo: {},
navHeight: 120,
backTop: 88,
listTop: 210,
productData: []
}
},
filters: {
formatTime(value) {
if (!value) return '';
const date = new Date(value);
return `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
}
},
onShow() {
this.initNavMetrics();
this.initWorkerFromShop();
this.resetList();
},
methods: {
initNavMetrics() {
const rect = uni.getMenuButtonBoundingClientRect();
this.menuButtonInfo = rect || {};
const top = rect && rect.top ? rect.top : 32;
const height = rect && rect.height ? rect.height : 32;
this.backTop = top + 6;
this.navHeight = top + height + 52;
this.listTop = this.navHeight + 76;
},
back() {
uni.navigateBack();
},
initWorkerFromShop() {
const shop = this.getCurrentShop();
this.searchForm.shopId = uni.getStorageSync('shopId');
this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).id;
this.searchForm.workerId = shop.workerId || '';
this.worker = {
workerId: shop.workerId || '',
workerName: shop.workerName || '',
workerPhone: shop.workerPhone || ''
};
},
getCurrentShop() {
const shopList = uni.getStorageSync('schoolShop') || [];
const shopId = uni.getStorageSync('shopId');
if (Array.isArray(shopList)) {
return shopList.find(item => item.id == shopId) || {};
}
return {};
},
switchTab(tab) {
this.tab = tab;
this.resetList();
},
resetList() {
this.list = [];
this.searchForm.pageNum = 1;
this.totalPages = 1;
this.loadStatus = 'more';
this.searchForm.status = this.tab === 'pickup' ? 1 : 2;
this.getList();
},
loadMore() {
if (this.searchForm.pageNum >= this.totalPages) return;
this.searchForm.pageNum++;
this.getList();
},
getList() {
if (!this.searchForm.workerId) {
this.loadStatus = 'nomore';
this.tui.toast('店铺未绑定自配送配送员');
return;
}
this.tui.request('/mall/delivery/pageShopDelivery', 'POST', this.searchForm, false, false).then((res) => {
if (res.code == 200) {
const records = res.result.records || [];
this.list = this.searchForm.pageNum == 1 ? records : this.list.concat(records);
this.totalPages = res.result.pages || 1;
this.loadStatus = this.searchForm.pageNum >= this.totalPages ? 'nomore' : 'more';
} else {
this.tui.toast(res.message);
}
});
},
handleOrder(index, item) {
if (this.tab === 'pickup' && !item.arriveTime) {
this.changeStatus(index, item, 1);
return;
}
this.changeStatus(index, item, this.tab === 'pickup' ? 2 : 3);
},
buttonText(item) {
if (this.tab === 'pickup') {
return item.arriveTime ? '确认取货' : '已到店';
}
return '确认送达';
},
changeStatus(index, item, status) {
const url = status === 1 ? '/mall/delivery/arriveShop' : (status === 2 ? '/mall/delivery/pickup' : '/mall/delivery/complete');
this.tui.request(url, 'POST', {
regionId: this.searchForm.regionId,
deliveryId: item.id,
workerId: this.worker.workerId
}, false, true).then((res) => {
if (res.code == 200) {
if (status === 1) {
this.$set(this.list[index], 'arriveTime', new Date());
} else {
this.list.splice(index, 1);
}
this.tui.toast(res.message || '操作成功');
} else {
this.tui.toast(res.message);
}
});
},
productDetail(item) {
this.productData = item.goodsList || [];
this.$refs.productPopup.open();
},
goodsCount(item) {
return (item.goodsList || []).reduce((sum, goods) => sum + Number(goods.quantity || 0), 0);
},
formatSpecs(data) {
let str;
if (typeof data === 'object' && data !== null) {
str = JSON.stringify(data);
} else if (typeof data === 'string') {
str = data;
} else {
str = String(data || '');
}
return str.replace(/[{}"]/g, '');
},
makeCall(phone) {
if (!phone) return;
uni.makePhoneCall({
phoneNumber: phone
});
}
}
}
</script>
<style>
.page{
height: 100vh;
background: #F5F8F5;
padding: 0 24rpx;
box-sizing: border-box;
position: relative;
overflow: hidden;
}
.fixed-head{
position: absolute;
top: -40rpx;
left: 24rpx;
right: 24rpx;
z-index: 10;
background: #F5F8F5;
}
.nav{
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.back-btn{
position: absolute;
left: 0;
width: 68rpx;
height: 68rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: rgba(255, 255, 255, 0.9);
box-shadow: 0 8rpx 20rpx rgba(0, 35, 28, 0.08);
}
.nav-title{
position: absolute;
bottom: 18rpx;
font-size: 32rpx;
font-weight: 800;
}
.tabs{
display: flex;
background: #fff;
border-radius: 24rpx;
padding: 10rpx;
margin-bottom: 0;
}
.tab{
flex: 1;
text-align: center;
height: 70rpx;
line-height: 70rpx;
border-radius: 20rpx;
font-weight: 700;
}
.tab.active{
background: linear-gradient(90deg, #e3ff96, #a6ffea);
}
.list{
position: absolute;
left: 24rpx;
right: 24rpx;
bottom: 0;
box-sizing: border-box;
padding-top: 20rpx;
padding-bottom: 36rpx;
}
.card{
background: #fff;
border-radius: 24rpx;
padding: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 12rpx 30rpx rgba(0, 35, 28, 0.08);
}
.card-head{
display: flex;
align-items: center;
justify-content: space-between;
}
.tag{
background: rgba(255, 111, 44, 0.1);
color: #ff6f2c;
padding: 8rpx 16rpx;
border-radius: 18rpx;
font-weight: 700;
}
.time{
color: #666;
}
.order-code{
margin-top: 18rpx;
font-size: 32rpx;
font-weight: 800;
}
.address{
display: flex;
margin-top: 18rpx;
}
.dot{
width: 44rpx;
height: 44rpx;
line-height: 44rpx;
text-align: center;
border-radius: 50%;
color: #fff;
margin-right: 16rpx;
}
.get{
background: #0b9b73;
}
.send{
background: #ff6f2c;
}
.name{
font-weight: 700;
}
.desc,.remark,.fee{
margin-top: 8rpx;
color: #666;
line-height: 38rpx;
}
.phone-row{
display: inline-block;
margin-top: 8rpx;
color: #0b9b73;
font-weight: 700;
line-height: 34rpx;
}
.goods-row{
display: flex;
align-items: center;
margin-top: 20rpx;
padding: 18rpx 20rpx;
border-radius: 18rpx;
background: rgba(247, 248, 248, 0.8);
}
.goods-title{
font-weight: 800;
margin-right: 16rpx;
}
.goods-desc{
flex: 1;
color: #666;
font-size: 24rpx;
}
.btn{
margin-top: 24rpx;
height: 76rpx;
line-height: 76rpx;
text-align: center;
border-radius: 38rpx;
background: linear-gradient(90deg, #e3ff96, #a6ffea);
font-weight: 800;
}
.empty{
text-align: center;
color: #888;
padding: 80rpx 0;
}
.product-popup-content{
width: 650rpx;
max-height: 850rpx;
padding: 30rpx;
border-radius: 28rpx;
background: #fff;
box-sizing: border-box;
}
.product-popup-title{
font-size: 32rpx;
font-weight: 800;
}
.product-popup-subtitle{
margin-top: 8rpx;
color: #888;
font-size: 24rpx;
}
.product-popup-list{
margin-top: 24rpx;
max-height: 680rpx;
overflow-y: auto;
}
.product-popup-card{
display: flex;
align-items: center;
padding: 18rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.product-popup-img img{
width: 90rpx;
height: 90rpx;
border-radius: 16rpx;
margin-right: 18rpx;
}
.product-popup-info{
flex: 1;
min-width: 0;
}
.product-popup-name{
font-weight: 800;
line-height: 38rpx;
}
.product-popup-spec{
margin-top: 8rpx;
color: #777;
font-size: 24rpx;
}
.product-popup-label{
margin-right: 10rpx;
color: #999;
}
.product-popup-quantity{
width: 80rpx;
text-align: right;
}
.product-popup-quantity-num{
font-weight: 800;
}
.product-popup-quantity-label,
.product-popup-empty{
color: #888;
font-size: 22rpx;
}
</style>

190
package2/shop/shopInfo.vue

@ -85,6 +85,53 @@
</view>
</view>
</view>
<view class="list-box">
<view class="section-title">商家自配送</view>
<view class="list-1">
<view class="list-name">支持自配送</view>
<view class="list-right">
<label class="radio" style="padding-right: 20rpx;" @tap="setSelfDelivery(1)">
<radio :checked="shop.supportShopDelivery == 1" /><text></text>
</label>
<label class="radio" @tap="setSelfDelivery(0)">
<radio :checked="shop.supportShopDelivery == 0" /><text></text>
</label>
</view>
</view>
<block v-if="shop.supportShopDelivery == 1">
<view class="list-1">
<view class="list-name">配送费</view>
<view class="list-right">
<input type="digit" v-model="shop.orderBkge" placeholder="默认0,最多1位小数" @blur="formatOrderBkge" />
</view>
</view>
<view class="list-1">
<view class="list-name">送达位置</view>
<view class="list-right">
<picker :range="deliveryLocationList" range-key="text" @change="deliveryLocationChange">
<view>{{deliveryLocationText || '请选择'}}</view>
</picker>
</view>
</view>
<view class="list-1">
<view class="list-name">配送时长</view>
<view class="list-right">
<input type="number" v-model="shop.shopDeliveryDuration" placeholder="分钟" />
</view>
</view>
<view class="list-1">
<view class="list-name">配送员电话</view>
<view class="list-right worker-query">
<input type="number" v-model="workerMobile" placeholder="输入手机号" />
<view class="query-btn" @tap="findWorker">查询</view>
</view>
</view>
<view class="list-1" v-if="shop.workerId">
<view class="list-name">已绑定</view>
<view class="list-right">{{shop.workerName}} {{shop.workerPhone}}</view>
</view>
</block>
</view>
<view class="list-box">
<view class="list-2" @click="submit">
保存
@ -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;

Loading…
Cancel
Save