|
|
|
@ -1,174 +1,79 @@ |
|
|
|
<template> |
|
|
|
<view class="page1"> |
|
|
|
<view class="list-box"> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
门头图 |
|
|
|
</view> |
|
|
|
<view class="list-right" @tap="pictureAdd('mentou')"> |
|
|
|
<view class="upload-img" v-if="shop.shopIcon ==''" |
|
|
|
style="background: #eee;text-align: center;line-height: 100rpx;"> |
|
|
|
<uni-icons type="camera" size="28" color="#777"></uni-icons> |
|
|
|
</view> |
|
|
|
<image :src="shop.shopIcon" v-if="shop.shopIcon !=''" mode="" class="upload-img"></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
店铺名称 |
|
|
|
</view> |
|
|
|
<view class="list-right"> |
|
|
|
{{shop.shopName}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
副标题 |
|
|
|
</view> |
|
|
|
<view class="list-right"> |
|
|
|
<input type="text" placeholder="请输入副标题" v-model="shop.subtitle" |
|
|
|
style="height: 100rpx;line-height: 100rpx;" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
店铺地址 |
|
|
|
</view> |
|
|
|
<view class="list-right"> |
|
|
|
{{shop.shopAddress}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- <view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
店铺环境 |
|
|
|
</view> |
|
|
|
<view class="list-right"> |
|
|
|
<image :src="huanjing" mode=""></image> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
身份证 |
|
|
|
</view> |
|
|
|
<view class="list-right"> |
|
|
|
<image :src="shopImages[0]" mode="" class="upload-img"></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
营业执照 |
|
|
|
</view> |
|
|
|
<view class="list-right"> |
|
|
|
<image :src="shopImages[2]" mode="" class="upload-img"></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
补充证照 |
|
|
|
</view> |
|
|
|
<view class="list-right"> |
|
|
|
<image :src="huanjing" mode="" class="upload-img"></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
支付宝账号 |
|
|
|
</view> |
|
|
|
<view class="list-right"> |
|
|
|
<input type="text" placeholder="请输入支付宝账号" v-model="shop.aliAccount" |
|
|
|
style="height: 100rpx;line-height: 100rpx;" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name"> |
|
|
|
支付宝实名 |
|
|
|
</view> |
|
|
|
<view class="list-right"> |
|
|
|
<input type="text" placeholder="请输入支付宝账号" v-model="shop.aliName" |
|
|
|
style="height: 100rpx;line-height: 100rpx;" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="hero"> |
|
|
|
<view class="hero-title">店铺资料</view> |
|
|
|
<view class="hero-subtitle">维护副标题、联系方式和收款信息</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 class="form-wrap"> |
|
|
|
<view class="content"> |
|
|
|
<view class="section-title">可编辑信息</view> |
|
|
|
<view class="value"> |
|
|
|
<view class="name">副标题</view> |
|
|
|
<view class="text"> |
|
|
|
<input type="text" v-model="shop.subtitle" maxlength="24" placeholder="请输入副标题" /> |
|
|
|
</view> |
|
|
|
</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 class="value"> |
|
|
|
<view class="name">联系方式</view> |
|
|
|
<view class="text"> |
|
|
|
<input type="text" v-model="shop.contactPhone" maxlength="16" placeholder="请输入联系方式" /> |
|
|
|
</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 class="value"> |
|
|
|
<view class="name">支付宝账号</view> |
|
|
|
<view class="text"> |
|
|
|
<input type="text" v-model="shop.aliAccount" maxlength="32" placeholder="请输入支付宝账号" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name">配送时长</view> |
|
|
|
<view class="list-right"> |
|
|
|
<input type="number" v-model="shop.shopDeliveryDuration" placeholder="分钟" /> |
|
|
|
<view class="value"> |
|
|
|
<view class="name">支付宝实名</view> |
|
|
|
<view class="text"> |
|
|
|
<input type="text" v-model="shop.aliName" maxlength="16" 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> |
|
|
|
|
|
|
|
<button :loading="submitLoading" @tap="submit">保存</button> |
|
|
|
|
|
|
|
<view class="content"> |
|
|
|
<view class="section-title">基础信息</view> |
|
|
|
<view class="value image-row"> |
|
|
|
<view class="name">门头图</view> |
|
|
|
<view class="text image-cell"> |
|
|
|
<view class="upload-img" v-if="!shop.shopIcon"> |
|
|
|
<uni-icons type="image" size="28" color="#777"></uni-icons> |
|
|
|
</view> |
|
|
|
<image :src="shop.shopIcon" v-else mode="aspectFill" class="upload-img"></image> |
|
|
|
</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 class="value"> |
|
|
|
<view class="name">店铺名称</view> |
|
|
|
<view class="text">{{shop.shopName || '暂无'}}</view> |
|
|
|
</view> |
|
|
|
</block> |
|
|
|
</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="setTransferDelivery(1)"> |
|
|
|
<radio :checked="shop.supportTransferDelivery == 1" /><text>是</text> |
|
|
|
</label> |
|
|
|
<label class="radio" @tap="setTransferDelivery(0)"> |
|
|
|
<radio :checked="shop.supportTransferDelivery == 0" /><text>否</text> |
|
|
|
</label> |
|
|
|
<view class="value"> |
|
|
|
<view class="name">店铺分类</view> |
|
|
|
<view class="text">{{currentShopTypeText || '暂无'}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<block v-if="shop.supportTransferDelivery == 1"> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name">中转时长</view> |
|
|
|
<view class="list-right"> |
|
|
|
<input type="number" v-model="shop.transferDeliveryDuration" placeholder="分钟" /> |
|
|
|
</view> |
|
|
|
<view class="value"> |
|
|
|
<view class="name">所属区域</view> |
|
|
|
<view class="text">{{currentRegionText || '暂无'}}</view> |
|
|
|
</view> |
|
|
|
<view class="value textarea-row"> |
|
|
|
<view class="name">店铺地址</view> |
|
|
|
<view class="text">{{shop.shopAddress || '暂无'}}</view> |
|
|
|
</view> |
|
|
|
<view class="list-1"> |
|
|
|
<view class="list-name">中转地点</view> |
|
|
|
<view class="list-right"> |
|
|
|
<picker :range="addressList" range-key="text" @change="transferAddressChange"> |
|
|
|
<view>{{shop.transferAddressName || '请选择'}}</view> |
|
|
|
</picker> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="content" v-if="certificateImages.length"> |
|
|
|
<view class="section-title">认证资料</view> |
|
|
|
<view class="cert-grid"> |
|
|
|
<view class="cert-item" v-for="(item,index) in certificateImages" :key="index" |
|
|
|
@tap="previewImage(item)"> |
|
|
|
<image :src="item" mode="aspectFill"></image> |
|
|
|
<text>{{certificateNames[index] || '补充资料'}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</block> |
|
|
|
</view> |
|
|
|
<view class="list-box"> |
|
|
|
<view class="list-2" @click="submit"> |
|
|
|
保存 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -179,213 +84,166 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
shop: {}, |
|
|
|
shopImages: [], |
|
|
|
huanjing: '', |
|
|
|
workerMobile: '', |
|
|
|
addressList: [], |
|
|
|
deliveryLocationList: [{ |
|
|
|
value: 1, |
|
|
|
text: '送到宿舍' |
|
|
|
}, { |
|
|
|
value: 2, |
|
|
|
text: '送到楼下' |
|
|
|
}] |
|
|
|
shopTypeList: [], |
|
|
|
submitLoading: false, |
|
|
|
certificateImages: [], |
|
|
|
certificateNames: ['身份证正面', '身份证反面', '营业执照', '补充证照'] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
deliveryLocationText() { |
|
|
|
let item = this.deliveryLocationList.find(item => item.value == this.shop.shopDeliveryLocation) |
|
|
|
return item ? item.text : '' |
|
|
|
currentRegionText() { |
|
|
|
return this.shop.shopAreaTitle || this.shop.region || '' |
|
|
|
}, |
|
|
|
currentShopTypeText() { |
|
|
|
return this.shop.shopTypeTitle || this.getShopTypeText(this.shop.shopType) || '' |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
this.shop = JSON.parse(uni.getStorageSync('area')).shop; |
|
|
|
|
|
|
|
this.shopImages = this.shop.shopImages.split('@@') |
|
|
|
this.huanjing = JSON.parse(this.shopImages[3])[0] |
|
|
|
|
|
|
|
for (let key in this.shop) { |
|
|
|
if (this.shop[key] === null) { |
|
|
|
delete this.shop[key]; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.shop.supportShopDelivery == null) this.shop.supportShopDelivery = 0 |
|
|
|
if (this.shop.orderBkge == null) this.shop.orderBkge = 0 |
|
|
|
if (this.shop.supportTransferDelivery == null) this.shop.supportTransferDelivery = 0 |
|
|
|
this.workerMobile = this.shop.workerPhone || '' |
|
|
|
this.getRegionList() |
|
|
|
this.getShopTypeList() |
|
|
|
this.getShopMsg() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
navigatorTo(e) { |
|
|
|
let url = "" |
|
|
|
if (e == 'addgoods') { |
|
|
|
url = '/package1/myCenter/addGoods' |
|
|
|
} else if (e == 'merchant') { |
|
|
|
url = '/package1/myCenter/myMerchant' |
|
|
|
} else if (e == 'xiugaixinxi') { |
|
|
|
url = '/pages/myCenter/shopDetail' |
|
|
|
} |
|
|
|
uni.navigateTo({ |
|
|
|
url: url |
|
|
|
}) |
|
|
|
getShopId() { |
|
|
|
return this.shop.id || uni.getStorageSync('shopId') || '' |
|
|
|
}, |
|
|
|
pictureAdd(type) { |
|
|
|
let that = this |
|
|
|
uni.chooseMedia({ |
|
|
|
count: type == 'qita' ? 9 : 1, |
|
|
|
mediaType: ['image'], |
|
|
|
sourceType: ['album', 'camera'], |
|
|
|
success(res) { |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中...', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
for (let i = 0; i < res.tempFiles.length; i++) { |
|
|
|
that.upLoadFile(res.tempFiles[i].tempFilePath, type) |
|
|
|
} |
|
|
|
|
|
|
|
getShopMsg() { |
|
|
|
const shopId = uni.getStorageSync('shopId') |
|
|
|
if (!shopId) { |
|
|
|
this.applyShop(this.getCachedShop()) |
|
|
|
return |
|
|
|
} |
|
|
|
let regionId = '' |
|
|
|
try { |
|
|
|
const area = uni.getStorageSync('area') |
|
|
|
regionId = area ? JSON.parse(area).id : '' |
|
|
|
} catch (e) {} |
|
|
|
this.NB.sendRequest('/app/shop/getShopInfoById', { |
|
|
|
id: shopId, |
|
|
|
regionId: regionId |
|
|
|
}, false, 'POST', 'application/x-www-form-urlencoded').then(res => { |
|
|
|
|
|
|
|
if (res.code == 200) { |
|
|
|
this.applyShop(this.normalizeShopResult(res.result)) |
|
|
|
} else { |
|
|
|
this.applyShop(this.getCachedShop()) |
|
|
|
if (res.message) this.tui.toast(res.message) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
async upLoadFile(path, type) { |
|
|
|
let that = this; |
|
|
|
let hiver_token = uni.getStorageSync("hiver_token") |
|
|
|
await uni.uploadFile({ |
|
|
|
url: getApp().globalData.mainurl + '/upload/file', |
|
|
|
filePath: path, |
|
|
|
name: 'file', |
|
|
|
header: { |
|
|
|
"content-type": "multipart/form-data", |
|
|
|
'accessToken': hiver_token |
|
|
|
}, |
|
|
|
formData: {}, |
|
|
|
success: (uploadFileRes) => { |
|
|
|
let pathData = JSON.parse(uploadFileRes.data) |
|
|
|
that.shop.shopIcon = pathData.result |
|
|
|
|
|
|
|
that.$forceUpdate() |
|
|
|
}, |
|
|
|
fail: (err) => { |
|
|
|
uni.hideLoading(); |
|
|
|
uni.showToast({ |
|
|
|
title: JSON.stringify(err), |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
await setTimeout(res => { |
|
|
|
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 = '' |
|
|
|
normalizeShopResult(result) { |
|
|
|
if (result.shop) { |
|
|
|
const data = Object.assign({}, result.shop, result) |
|
|
|
delete data.shop |
|
|
|
return data |
|
|
|
} |
|
|
|
return result || {} |
|
|
|
}, |
|
|
|
setTransferDelivery(type) { |
|
|
|
this.shop.supportTransferDelivery = type |
|
|
|
if (type != 1) { |
|
|
|
this.shop.transferDeliveryDuration = '' |
|
|
|
this.shop.transferAddressId = '' |
|
|
|
this.shop.transferAddressName = '' |
|
|
|
getCachedShop() { |
|
|
|
const shopList = uni.getStorageSync('schoolShop') || [] |
|
|
|
const shopId = uni.getStorageSync('shopId') |
|
|
|
if (Array.isArray(shopList)) { |
|
|
|
const item = shopList.find(shop => shop.id == shopId || shop.shopName == uni.getStorageSync( |
|
|
|
'shopName')) |
|
|
|
if (item) return item |
|
|
|
} |
|
|
|
}, |
|
|
|
getRegionList() { |
|
|
|
this.NB.sendRequest('/app/shopArea/getByParentId/0', {}, false, 'get', 'application/x-www-form-urlencoded') |
|
|
|
.then(res => { |
|
|
|
|
|
|
|
if (res.code == 200) { |
|
|
|
this.addressList = (Array.isArray(res.result) ? res.result : []).map(item => { |
|
|
|
return { |
|
|
|
value: item.id, |
|
|
|
text: item.title || item.name || item.regionName || item.areaName || |
|
|
|
'未命名区域' |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.showToast(res.message) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
transferAddressChange(e) { |
|
|
|
const item = this.addressList[e.detail.value] |
|
|
|
if (item) { |
|
|
|
this.shop.transferAddressId = item.value |
|
|
|
this.shop.transferAddressName = item.text |
|
|
|
return uni.getStorageSync('shop') || { |
|
|
|
id: shopId, |
|
|
|
shopName: uni.getStorageSync('shopName') || '', |
|
|
|
shopIcon: uni.getStorageSync('shopIcon') || '' |
|
|
|
} |
|
|
|
}, |
|
|
|
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 |
|
|
|
} |
|
|
|
applyShop(data) { |
|
|
|
const shop = Object.assign({ |
|
|
|
id: '', |
|
|
|
shopName: '', |
|
|
|
shopIcon: '', |
|
|
|
shopType: '', |
|
|
|
shopTypeTitle: '', |
|
|
|
subtitle: '', |
|
|
|
shopAddress: '', |
|
|
|
contactPhone: '', |
|
|
|
aliAccount: '', |
|
|
|
aliName: '', |
|
|
|
remark: '', |
|
|
|
shopArea: '', |
|
|
|
shopAreaTitle: '', |
|
|
|
regionId: '', |
|
|
|
region: '' |
|
|
|
}, data || {}) |
|
|
|
Object.keys(shop).forEach(key => { |
|
|
|
if (shop[key] === null) shop[key] = '' |
|
|
|
}) |
|
|
|
this.shop = shop |
|
|
|
this.parseShopImages(shop.shopImages) |
|
|
|
}, |
|
|
|
findWorker() { |
|
|
|
if (!this.workerMobile) { |
|
|
|
uni.showToast('请输入配送员手机号') |
|
|
|
parseShopImages(value) { |
|
|
|
const list = [] |
|
|
|
if (!value) { |
|
|
|
this.certificateImages = [] |
|
|
|
return |
|
|
|
} |
|
|
|
this.NB.sendRequest('/app/shop/findWorkerByMobile', { |
|
|
|
mobile: this.workerMobile |
|
|
|
}, false, 'get', 'application/x-www-form-urlencoded').then(res => { |
|
|
|
|
|
|
|
const parts = String(value).split('@@') |
|
|
|
parts.forEach((item, index) => { |
|
|
|
if (!item) return |
|
|
|
if (index == 3) { |
|
|
|
try { |
|
|
|
const extra = JSON.parse(item) |
|
|
|
if (Array.isArray(extra)) { |
|
|
|
extra.forEach(url => { |
|
|
|
if (url) list.push(url) |
|
|
|
}) |
|
|
|
} |
|
|
|
} catch (e) {} |
|
|
|
} else { |
|
|
|
list.push(item) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.certificateImages = list |
|
|
|
}, |
|
|
|
getShopTypeList() { |
|
|
|
this.NB.sendRequest('/dictData/getByCondition', { |
|
|
|
sort: 'sortOrder', |
|
|
|
order: 'asc', |
|
|
|
dictId: '1712359407444168704' |
|
|
|
}, false, 'GET', 'application/x-www-form-urlencoded').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 |
|
|
|
uni.showToast('绑定成功') |
|
|
|
const content = res.result && res.result.content ? res.result.content : [] |
|
|
|
this.shopTypeList = content.map(item => { |
|
|
|
return { |
|
|
|
value: item.value, |
|
|
|
text: item.title |
|
|
|
} |
|
|
|
}) |
|
|
|
if (this.shop.shopType && !this.shop.shopTypeTitle) { |
|
|
|
this.shop.shopTypeTitle = this.getShopTypeText(this.shop.shopType) |
|
|
|
} |
|
|
|
} else { |
|
|
|
uni.showToast(res.message) |
|
|
|
this.applyShop(this.getCachedShop()) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
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 |
|
|
|
getShopTypeText(value) { |
|
|
|
const item = this.shopTypeList.find(item => item.value == value || item.text == value) |
|
|
|
return item ? item.text : value |
|
|
|
}, |
|
|
|
normalizeTransferDelivery() { |
|
|
|
if (this.shop.supportTransferDelivery != 1) { |
|
|
|
this.setTransferDelivery(0) |
|
|
|
return true |
|
|
|
} |
|
|
|
if (!this.shop.transferDeliveryDuration) { |
|
|
|
this.tui.toast('请输入中转配送时长') |
|
|
|
return false |
|
|
|
} |
|
|
|
if (!this.shop.transferAddressId) { |
|
|
|
this.tui.toast('请选择中转地点') |
|
|
|
return false |
|
|
|
} |
|
|
|
this.shop.transferDeliveryDuration = parseInt(this.shop.transferDeliveryDuration || 0) |
|
|
|
return true |
|
|
|
normalizeId(value) { |
|
|
|
return String(value || '').split(',')[0] |
|
|
|
}, |
|
|
|
previewImage(url) { |
|
|
|
if (!url) return |
|
|
|
uni.previewImage({ |
|
|
|
current: url, |
|
|
|
urls: this.certificateImages |
|
|
|
}) |
|
|
|
}, |
|
|
|
validateShop() { |
|
|
|
if (!this.shop.shopArea) return '店铺区域信息缺失,请重新进入页面后再保存' |
|
|
|
if (!this.shop.contactPhone) return '请输入联系方式' |
|
|
|
if (!this.shop.aliAccount) return '请输入支付宝账号' |
|
|
|
if (!this.shop.aliName) return '请输入支付宝实名' |
|
|
|
return '' |
|
|
|
}, |
|
|
|
updateLocalShopCache() { |
|
|
|
let shopList = uni.getStorageSync('schoolShop') || [] |
|
|
|
@ -394,77 +252,43 @@ |
|
|
|
uni.setStorageSync('schoolShop', shopList) |
|
|
|
} |
|
|
|
uni.setStorageSync('shop', this.shop) |
|
|
|
uni.setStorageSync('shopName', this.shop.shopName) |
|
|
|
uni.setStorageSync('shopIcon', this.shop.shopIcon) |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
if (!this.normalizeSelfDelivery()) return |
|
|
|
if (!this.normalizeTransferDelivery()) return |
|
|
|
this.NB.sendRequest('/app/shop/updateSelfDelivery', { |
|
|
|
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, // 是否显示loading(根据业务需要) |
|
|
|
'post', // 请求方法 |
|
|
|
'application/x-www-form-urlencoded' // 内容类型 |
|
|
|
).then(deliveryRes => { |
|
|
|
if (deliveryRes.code !== 200) { |
|
|
|
this.tui.toast(deliveryRes.message); |
|
|
|
return Promise.reject(deliveryRes); |
|
|
|
} |
|
|
|
// 第二个接口:更新转单配送 |
|
|
|
return this.NB.sendRequest( |
|
|
|
'/app/shop/updateTransferDelivery', { |
|
|
|
id: this.shop.id, |
|
|
|
supportTransferDelivery: this.shop.supportTransferDelivery, |
|
|
|
transferDeliveryDuration: this.shop.transferDeliveryDuration, |
|
|
|
transferAddressId: this.shop.transferAddressId, |
|
|
|
transferAddressName: this.shop.transferAddressName |
|
|
|
}, |
|
|
|
false, |
|
|
|
'post', |
|
|
|
'application/x-www-form-urlencoded' |
|
|
|
); |
|
|
|
}).then(transferRes => { |
|
|
|
if (transferRes.code !== 200) { |
|
|
|
this.tui.toast(transferRes.message); |
|
|
|
return Promise.reject(transferRes); |
|
|
|
} |
|
|
|
// 第三个接口:编辑店铺信息(PUT) |
|
|
|
return this.NB.sendRequest( |
|
|
|
'/app/shop/edit', |
|
|
|
this.shop, // 直接传入完整对象 |
|
|
|
false, |
|
|
|
'put', // 注意方法名改为小写,与后端约定一致 |
|
|
|
'application/x-www-form-urlencoded' |
|
|
|
); |
|
|
|
}).then(res => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.updateLocalShopCache(); |
|
|
|
uni.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '更新信息成功', |
|
|
|
showCancel: false, |
|
|
|
success: (modalRes) => { |
|
|
|
if (modalRes.confirm) { |
|
|
|
uni.navigateBack(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.tui.toast(res.message); |
|
|
|
} |
|
|
|
uni.hideLoading(); |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
// 捕获任意环节的 reject(包括接口失败或toast后的中断) |
|
|
|
uni.hideLoading(); // 确保加载提示被关闭 |
|
|
|
// 若需要额外处理可在此添加,原代码为空 |
|
|
|
}); |
|
|
|
const error = this.validateShop() |
|
|
|
if (error) { |
|
|
|
this.tui.toast(error) |
|
|
|
return |
|
|
|
} |
|
|
|
const shopId = this.getShopId() |
|
|
|
const payload = { |
|
|
|
id: this.normalizeId(shopId), |
|
|
|
shopArea: this.normalizeId(this.shop.shopArea), |
|
|
|
subtitle: this.shop.subtitle, |
|
|
|
contactPhone: this.shop.contactPhone, |
|
|
|
aliAccount: this.shop.aliAccount, |
|
|
|
aliName: this.shop.aliName |
|
|
|
} |
|
|
|
const query = Object.keys(payload).map(key => { |
|
|
|
return key + '=' + encodeURIComponent(payload[key] == null ? '' : payload[key]) |
|
|
|
}).join('&') |
|
|
|
this.submitLoading = true |
|
|
|
this.NB.sendRequest('/app/shop/edit?' + query, {}, false, 'PUT', 'application/x-www-form-urlencoded').then(res => { |
|
|
|
|
|
|
|
if (res.code == 200) { |
|
|
|
this.updateLocalShopCache() |
|
|
|
uni.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '店铺资料已更新', |
|
|
|
showCancel: false, |
|
|
|
success: (modalRes) => { |
|
|
|
if (modalRes.confirm) uni.navigateBack() |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
uni.hideLoading() |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -474,67 +298,222 @@ |
|
|
|
page, |
|
|
|
.page1 { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
font-size: 28rpx; |
|
|
|
background: #eee; |
|
|
|
min-height: 100%; |
|
|
|
font-size: 24rpx; |
|
|
|
color: #12342d; |
|
|
|
background: |
|
|
|
radial-gradient(circle at 92% 120rpx, rgba(166, 255, 234, 0.45) 0, rgba(166, 255, 234, 0) 240rpx), |
|
|
|
linear-gradient(180deg, #f3fff6 0%, #f5f8f5 36%, #eef4f1 100%); |
|
|
|
overflow: scroll; |
|
|
|
} |
|
|
|
|
|
|
|
.list-box { |
|
|
|
.hero { |
|
|
|
position: relative; |
|
|
|
width: 100%; |
|
|
|
height: auto; |
|
|
|
background: #fff; |
|
|
|
margin-top: 20rpx; |
|
|
|
height: 260rpx; |
|
|
|
padding: 58rpx 42rpx 0; |
|
|
|
box-sizing: border-box; |
|
|
|
overflow: hidden; |
|
|
|
background: |
|
|
|
linear-gradient(135deg, rgba(227, 255, 150, 0.95) 0%, rgba(166, 255, 234, 0.86) 58%, rgba(255, 255, 255, 0.72) 100%), |
|
|
|
url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') center/cover no-repeat; |
|
|
|
} |
|
|
|
|
|
|
|
.hero::after { |
|
|
|
content: ""; |
|
|
|
position: absolute; |
|
|
|
right: -34rpx; |
|
|
|
top: -44rpx; |
|
|
|
width: 290rpx; |
|
|
|
height: 290rpx; |
|
|
|
border-radius: 50%; |
|
|
|
background: rgba(255, 255, 255, 0.32); |
|
|
|
} |
|
|
|
|
|
|
|
.list-1 { |
|
|
|
display: flex; |
|
|
|
.hero-title { |
|
|
|
position: relative; |
|
|
|
z-index: 1; |
|
|
|
font-size: 46rpx; |
|
|
|
line-height: 64rpx; |
|
|
|
font-weight: 900; |
|
|
|
letter-spacing: 2rpx; |
|
|
|
color: #07362d; |
|
|
|
} |
|
|
|
|
|
|
|
.hero-subtitle { |
|
|
|
position: relative; |
|
|
|
z-index: 1; |
|
|
|
margin-top: 12rpx; |
|
|
|
font-size: 26rpx; |
|
|
|
font-weight: 600; |
|
|
|
color: rgba(0, 35, 28, 0.62); |
|
|
|
} |
|
|
|
|
|
|
|
.form-wrap { |
|
|
|
position: relative; |
|
|
|
z-index: 2; |
|
|
|
width: 92%; |
|
|
|
margin: -54rpx auto 0; |
|
|
|
padding-bottom: 40rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.content { |
|
|
|
width: 100%; |
|
|
|
height: 100rpx; |
|
|
|
line-height: 100rpx; |
|
|
|
border-bottom: 1px solid #eee; |
|
|
|
margin-bottom: 24rpx; |
|
|
|
overflow: hidden; |
|
|
|
border: 1rpx solid rgba(255, 255, 255, 0.86); |
|
|
|
border-radius: 28rpx; |
|
|
|
background: rgba(255, 255, 255, 0.96); |
|
|
|
box-shadow: 0 16rpx 36rpx rgba(0, 35, 28, 0.08); |
|
|
|
} |
|
|
|
|
|
|
|
.section-title { |
|
|
|
height: 92rpx; |
|
|
|
line-height: 92rpx; |
|
|
|
padding: 0 28rpx; |
|
|
|
border-bottom: 1rpx solid #edf3f0; |
|
|
|
font-size: 30rpx; |
|
|
|
font-weight: 900; |
|
|
|
color: #102f28; |
|
|
|
} |
|
|
|
|
|
|
|
.list-2 { |
|
|
|
.value { |
|
|
|
width: 100%; |
|
|
|
height: 100rpx; |
|
|
|
line-height: 100rpx; |
|
|
|
text-align: center; |
|
|
|
border-bottom: 1px solid #eee; |
|
|
|
min-height: 96rpx; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
border-top: 1rpx solid #edf3f0; |
|
|
|
padding: 0 28rpx; |
|
|
|
box-sizing: border-box; |
|
|
|
} |
|
|
|
|
|
|
|
.list-icon { |
|
|
|
width: 100rpx; |
|
|
|
height: 100rpx; |
|
|
|
text-align: center; |
|
|
|
.section-title+.value { |
|
|
|
border-top: none; |
|
|
|
} |
|
|
|
|
|
|
|
.list-name { |
|
|
|
flex: 1; |
|
|
|
padding-left: 20rpx; |
|
|
|
.name { |
|
|
|
width: 210rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
font-weight: 800; |
|
|
|
color: #153c34; |
|
|
|
} |
|
|
|
|
|
|
|
.list-right { |
|
|
|
.text { |
|
|
|
flex: 1; |
|
|
|
height: 100rpx; |
|
|
|
min-width: 0; |
|
|
|
text-align: right; |
|
|
|
padding-right: 20rpx; |
|
|
|
color: #263f39; |
|
|
|
font-size: 28rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.text input { |
|
|
|
height: 96rpx; |
|
|
|
line-height: 96rpx; |
|
|
|
text-align: right; |
|
|
|
font-size: 28rpx; |
|
|
|
color: #263f39; |
|
|
|
} |
|
|
|
|
|
|
|
.text textarea { |
|
|
|
width: 100%; |
|
|
|
height: 132rpx; |
|
|
|
line-height: 42rpx; |
|
|
|
padding-top: 18rpx; |
|
|
|
text-align: right; |
|
|
|
font-size: 28rpx; |
|
|
|
color: #263f39; |
|
|
|
} |
|
|
|
|
|
|
|
.textarea-row { |
|
|
|
align-items: flex-start; |
|
|
|
padding-top: 20rpx; |
|
|
|
padding-bottom: 18rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.textarea-row .name { |
|
|
|
line-height: 60rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.picker-text { |
|
|
|
min-height: 96rpx; |
|
|
|
line-height: 96rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
color: #263f39; |
|
|
|
white-space: nowrap; |
|
|
|
overflow: hidden; |
|
|
|
text-overflow: ellipsis; |
|
|
|
} |
|
|
|
|
|
|
|
.picker-text.placeholder { |
|
|
|
color: #9aa7a3; |
|
|
|
} |
|
|
|
|
|
|
|
.image-row { |
|
|
|
min-height: 212rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.image-cell { |
|
|
|
display: flex; |
|
|
|
justify-content: flex-end; |
|
|
|
} |
|
|
|
|
|
|
|
.upload-img { |
|
|
|
width: 60rpx; |
|
|
|
height: 60rpx; |
|
|
|
background-size: 100%; |
|
|
|
margin-top: 20rpx; |
|
|
|
width: 172rpx; |
|
|
|
height: 172rpx; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
border-radius: 24rpx; |
|
|
|
background: #f6faf8; |
|
|
|
border: 1rpx dashed rgba(11, 155, 115, 0.26); |
|
|
|
box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.8); |
|
|
|
} |
|
|
|
|
|
|
|
.cert-grid { |
|
|
|
display: grid; |
|
|
|
grid-template-columns: repeat(2, 1fr); |
|
|
|
gap: 18rpx; |
|
|
|
padding: 24rpx; |
|
|
|
box-sizing: border-box; |
|
|
|
} |
|
|
|
|
|
|
|
.cert-item { |
|
|
|
overflow: hidden; |
|
|
|
border-radius: 22rpx; |
|
|
|
background: #f6faf8; |
|
|
|
border: 1rpx solid #edf3f0; |
|
|
|
} |
|
|
|
|
|
|
|
.list-2 { |
|
|
|
.cert-item image { |
|
|
|
width: 100%; |
|
|
|
height: 100rpx; |
|
|
|
line-height: 100rpx; |
|
|
|
height: 180rpx; |
|
|
|
display: block; |
|
|
|
} |
|
|
|
|
|
|
|
.cert-item text { |
|
|
|
display: block; |
|
|
|
height: 58rpx; |
|
|
|
line-height: 58rpx; |
|
|
|
text-align: center; |
|
|
|
border-bottom: 1px solid #eee; |
|
|
|
font-size: 24rpx; |
|
|
|
font-weight: 800; |
|
|
|
color: #153c34; |
|
|
|
} |
|
|
|
|
|
|
|
button { |
|
|
|
width: 100%; |
|
|
|
height: 96rpx; |
|
|
|
line-height: 96rpx; |
|
|
|
margin: 44rpx auto 12rpx; |
|
|
|
border-radius: 999rpx; |
|
|
|
background: linear-gradient(90deg, #e3ff96 0%, #a6ffea 100%); |
|
|
|
color: #00231c; |
|
|
|
font-size: 34rpx; |
|
|
|
font-weight: 900; |
|
|
|
box-shadow: 0 18rpx 36rpx rgba(0, 35, 28, 0.14); |
|
|
|
} |
|
|
|
|
|
|
|
button::after { |
|
|
|
border: none; |
|
|
|
} |
|
|
|
</style> |