上架修改

This commit is contained in:
donqi 2023-02-15 22:30:59 +08:00
parent 238d9edb4a
commit 54573b6cb9
1 changed files with 337 additions and 318 deletions

View File

@ -6,28 +6,25 @@
<block slot="content">服务上架</block> <block slot="content">服务上架</block>
</cu-custom> </cu-custom>
<!-- 表单内容 --> <!-- 表单内容 -->
<form @submit="submit"> <form @submit="submit" style="position: relative; z-index: 1;">
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">服务名称<text class="text-red">*</text></view> <view class="title">服务名称<text class="text-red">*</text></view>
<input name="servName" v-model="formData.servName" placeholder="请编辑上架标题(供客户搜索)"></input> <input name="servName" v-model="formData.servName" placeholder="请编辑上架标题(供客户搜索)"></input>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">关键词<text class="text-red">*</text></view> <view class="title">搜索关键词<text class="text-red">*</text></view>
<input name="servDesc" v-model="formData.servDesc" placeholder="多个关键词用#分隔"></input> <input name="servDesc" v-model="formData.servDesc" placeholder="多个关键词用#分隔"></input>
</view> </view>
<view class="solid-top"> <view class="solid-top">
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">选择类目<text class="text-red">*</text></view> <view class="title">选择类目<text class="text-red">*</text></view>
<picker :mode="'multiSelector'" @change="categoryChange" @columnchange="categoryColChange" <picker :mode="'multiSelector'" @change="categoryChange" @columnchange="categoryColChange"
:value="categoryMultiIndex" :range-key="'goodsCategoryName'" :range="categoryList"> :value="categoryMultiIndex" :range-key="'goodsCategoryName'" :range="categoryList">
<input v-if="formData.category" <input v-if="formData.category" disabled class="line-input radius-input"
disabled class="line-input radius-input" :value="formData.category && formData.category.length ? formData.category[0].goodsCategoryName + '-' + formData.category[1].goodsCategoryName + '-' + formData.category[2].goodsCategoryName : ''"
:value="formData.category && formData.category.length ? formData.category[0].goodsCategoryName + '-' + formData.category[1].goodsCategoryName + '-' + formData.category[2].goodsCategoryName : ''"
placeholder="请选择类目" />
<input v-else-if="formData.categoryConcatName"
disabled class="line-input radius-input"
:value="formData.categoryConcatName"
placeholder="请选择类目" /> placeholder="请选择类目" />
<input v-else-if="formData.categoryConcatName" disabled class="line-input radius-input"
:value="formData.categoryConcatName" placeholder="请选择类目" />
</picker> </picker>
</view> </view>
<view v-if="formData.specsList && formData.specsList.length > 0"> <view v-if="formData.specsList && formData.specsList.length > 0">
@ -48,12 +45,14 @@
</view> </view>
</view> </view>
<view class="flex margin-top-xs"> <view class="flex margin-top-xs">
<view class="margin-right-xs"> <view class="margin-right-xs">
<view class='text-red' style="position: absolute;">*</view> <view class='text-red' style="position: absolute; z-index: 0;">*</view>
<zb-tooltip :content="'平' + parseInt(item.deptRate * 100) + '%+¥' + $calcUtil.curNumPlaces(item.deptMoney, 3) + '销' + parseInt((Number(item.oneRate) + Number(item.twoRate) + Number(item.threeRate) + Number(item.retainRate)) * 100) + '%+¥' + $calcUtil.curNumPlaces(item.retainMoney, 3)" <zb-tooltip
:content="'平' + parseInt(item.deptRate * 100) + '%+¥' + $calcUtil.curNumPlaces(item.deptMoney, 3) + '销' + parseInt((Number(item.oneRate) + Number(item.twoRate) + Number(item.threeRate) + Number(item.retainRate)) * 100) + '%+¥' + $calcUtil.curNumPlaces(item.retainMoney, 3)"
placement="right" ref="goodsPriceTip"> placement="right" ref="goodsPriceTip">
<input class="radius-input xs" @input="inputSpecs($event, index, 'goodsPrice')" <input class="radius-input xs" @input="inputSpecs($event, index, 'goodsPrice')"
:value="item.goodsPrice" placeholder="价格" @blur="hideTips('goodsPriceTip', index)"></input> :value="item.goodsPrice" placeholder="价格"
@blur="hideTips('goodsPriceTip', index)"></input>
</zb-tooltip> </zb-tooltip>
</view> </view>
<view class="margin-right-xs" style="flex-basis: 21%;"> <view class="margin-right-xs" style="flex-basis: 21%;">
@ -68,8 +67,8 @@
<input class="radius-input xs" @input="inputSpecs($event, index, 'goodsUnit')" <input class="radius-input xs" @input="inputSpecs($event, index, 'goodsUnit')"
:value="item.goodsUnit" placeholder="单位"></input> :value="item.goodsUnit" placeholder="单位"></input>
</view> </view>
<view style="flex-basis: 14%;"> <view style="flex-basis: 14%;">
<view class='text-red' style="position: absolute;">*</view> <view class='text-red' style="position: absolute; absolute; z-index: 0;">*</view>
<input class="radius-input xs" @input="inputSpecs($event, index, 'goodsNum')" <input class="radius-input xs" @input="inputSpecs($event, index, 'goodsNum')"
:value="item.goodsNum" placeholder="库存数"></input> :value="item.goodsNum" placeholder="库存数"></input>
</view> </view>
@ -107,33 +106,33 @@
<!-- </view> --> <!-- </view> -->
<!-- </view> --> <!-- </view> -->
</view> </view>
<view class="cu-form-group solid-top justify-start"> <view class="cu-form-group solid-top justify-start">
<view class="title">商品单位<text class="text-red">*</text></view> <view class="title">商品单位<text class="text-red">*</text></view>
<my-uni-combox class="form-val-area" :candidates="goodsUnitList" placeholder="上方已填单位则以上方所填为准" <my-uni-combox class="form-val-area" :candidates="goodsUnitList" placeholder="上方已填单位则以上方所填为准"
v-model="formData.goodsUnit"> v-model="formData.goodsUnit">
</my-uni-combox> </my-uni-combox>
</view> </view>
<view class="cu-form-group justify-start"> <view class="cu-form-group justify-start">
<view class="title">质保期</view> <view class="title">质保期<text class="text-red">*</text></view>
<my-uni-combox class="form-val-area" :candidates="warrantyPeriodList" placeholder="请选择" <my-uni-combox class="form-val-area" :candidates="warrantyPeriodList" placeholder="请选择"
v-model="formData.warrantyPeriod"> v-model="formData.warrantyPeriod">
</my-uni-combox> </my-uni-combox>
</view> </view>
<view class="cu-form-group justify-start"> <view class="cu-form-group justify-start">
<!-- <checkbox style="transform:scale(1)" class="main-color margin-right-xs" :value="true" <!-- <checkbox style="transform:scale(1)" class="main-color margin-right-xs" :value="true"
:v-model="formData.isGoldenServ" :checked="formData.isGoldenServ"></checkbox> --> :v-model="formData.isGoldenServ" :checked="formData.isGoldenServ"></checkbox> -->
<view class="title">服务活动</view> <view class="title">服务活动<text class="text-red">*</text></view>
<my-uni-combox class="form-val-area" :candidates="servActivityList" placeholder="请选择" <my-uni-combox class="form-val-area" :candidates="servActivityList" placeholder="请选择"
v-model="formData.servActivity"> v-model="formData.servActivity">
</my-uni-combox> </my-uni-combox>
</view> </view>
<view class="cu-form-group justify-start"> <view class="cu-form-group justify-start">
<!-- <checkbox style="transform:scale(1)" class="main-color margin-right-xs" :value="true" <!-- <checkbox style="transform:scale(1)" class="main-color margin-right-xs" :value="true"
:v-model="formData.isGoldenServ" :checked="formData.isGoldenServ"></checkbox> --> :v-model="formData.isGoldenServ" :checked="formData.isGoldenServ"></checkbox> -->
<view class="title">服务时效</view> <view class="title">服务时效<text class="text-red">*</text></view>
<my-uni-combox class="form-val-area" :candidates="expectDurationList" placeholder="请选择" <my-uni-combox class="form-val-area" :candidates="expectDurationList" placeholder="请选择"
v-model="formData.expectDuration"> v-model="formData.expectDuration">
</my-uni-combox> </my-uni-combox>
</view> </view>
<view class="solid-top"> <view class="solid-top">
<view class="cu-form-group"> <view class="cu-form-group">
@ -142,10 +141,9 @@
:value="regionMultiIndex" :range-key="'areaName'" :range="regionList"> :value="regionMultiIndex" :range-key="'areaName'" :range="regionList">
<input disabled class="line-input radius-input" v-if="formData.region" <input disabled class="line-input radius-input" v-if="formData.region"
:value="formData.region && formData.region.length ? formData.region[0].areaName + '-' + formData.region[1].areaName : ''" :value="formData.region && formData.region.length ? formData.region[0].areaName + '-' + formData.region[1].areaName : ''"
placeholder="请选择区域"></input>
<input disabled class="line-input radius-input" v-else-if="formData.areaConcatName"
:value="formData.areaConcatName"
placeholder="请选择区域"></input> placeholder="请选择区域"></input>
<input disabled class="line-input radius-input" v-else-if="formData.areaConcatName"
:value="formData.areaConcatName" placeholder="请选择区域"></input>
</picker> </picker>
</view> </view>
<view class="padding-lr bg-white"> <view class="padding-lr bg-white">
@ -160,52 +158,55 @@
</view> </view>
<view class="cu-bar bg-white"> <view class="cu-bar bg-white">
<view class="action text-black">区域描述<text class="text-red">*</text></view> <view class="action text-black">区域描述<text class="text-red">*</text></view>
</view> </view>
<view class="padding-lr-sm padding-bottom-sm bg-white"> <view class="padding-lr-sm padding-bottom-sm bg-white">
<textarea name="areaDesc" style="width: 100%; height: 150rpx;" class="solid radius text-left padding-sm" <textarea name="areaDesc" style="width: 100%; height: 150rpx;" class="solid radius text-left padding-sm"
v-model="formData.areaDesc" maxlength="-1" placeholder="如XX区XX街道未覆盖或XX区仅服务XX街道"></textarea> v-model="formData.areaDesc" maxlength="-1" placeholder="如XX区XX街道未覆盖或XX区仅服务XX街道"></textarea>
</view> </view>
<!-- 多城市 --> <!-- 多城市 -->
<view v-for="(item,index) in servArea" class="bg-white"> <view v-for="(item,index) in servArea" class="bg-white">
<view class="solid-top"> <view class="solid-top">
<view @click="delServArea(index)"> <view @click="delServArea(index)">
<button class="cu-btn bg-red light"> <button class="cu-btn bg-red light">
<text class="margin-right-xs"><text class="cuIcon-close"></text></text> <text class="margin-right-xs"><text class="cuIcon-close"></text></text>
<text>删除</text> <text>删除</text>
</button> </button>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">上架区域<text class="text-red">*</text></view> <view class="title">上架区域<text class="text-red">*</text></view>
<picker :mode="'multiSelector'" @change="multiRegionChange($event, index)" @columnchange="multiRegionColChange($event, index)" <picker :mode="'multiSelector'" @change="multiRegionChange($event, index)"
:value="servArea[index].regionMultiIndex" :range-key="'areaName'" :range="servArea[index].regionList"> @columnchange="multiRegionColChange($event, index)"
<input disabled class="line-input radius-input" v-if="servArea[index].region" :value="servArea[index].regionMultiIndex" :range-key="'areaName'"
:value="servArea[index].region && servArea[index].region.length ? servArea[index].region[0].areaName + '-' + servArea[index].region[1].areaName : ''" :range="servArea[index].regionList">
placeholder="请选择区域"></input> <input disabled class="line-input radius-input" v-if="servArea[index].region"
</picker> :value="servArea[index].region && servArea[index].region.length ? servArea[index].region[0].areaName + '-' + servArea[index].region[1].areaName : ''"
</view> placeholder="请选择区域"></input>
<view class="padding-lr bg-white"> </picker>
<checkbox-group @change="multiAreaCheckDistirct($event, index)" class="grid col-3"> </view>
<view v-for="(item, index1) in servArea[index].districtList" class="margin-tb-xs"> <view class="padding-lr bg-white">
<checkbox style="transform:scale(1)" class="main-color margin-right-xs" :value="index1" <checkbox-group @change="multiAreaCheckDistirct($event, index)" class="grid col-3">
:checked="item.checked"></checkbox> <view v-for="(item, index1) in servArea[index].districtList" class="margin-tb-xs">
<text>{{item.areaName}}</text> <checkbox style="transform:scale(1)" class="main-color margin-right-xs" :value="index1"
</view> :checked="item.checked"></checkbox>
</checkbox-group> <text>{{item.areaName}}</text>
</view> </view>
</view> </checkbox-group>
<view class="cu-bar"> </view>
<view class="action text-black">区域描述<text class="text-red">*</text></view> </view>
</view> <view class="cu-bar">
<view class="padding-lr-sm padding-bottom-sm"> <view class="action text-black">区域描述<text class="text-red">*</text></view>
<textarea name="areaDesc" style="width: 100%; height: 150rpx;" class="solid radius text-left padding-sm" </view>
v-model="servArea[index].areaDesc" maxlength="-1" placeholder="如XX区XX街道未覆盖或XX区仅服务XX街道"></textarea> <view class="padding-lr-sm padding-bottom-sm">
</view> <textarea name="areaDesc" style="width: 100%; height: 150rpx;"
</view> class="solid radius text-left padding-sm" v-model="servArea[index].areaDesc" maxlength="-1"
<view class="text-center padding-bottom bg-white"> placeholder="如XX区XX街道未覆盖或XX区仅服务XX街道"></textarea>
<button class="cu-btn bg-main-color light" @click="addServArea"> </view>
<text class="margin-right-xs"><text class="cuIcon-add"></text></text> </view>
<text>继续添加上架城市</text> <view class="text-center padding-bottom bg-white">
</button> <button class="cu-btn bg-main-color light" @click="addServArea">
<text class="margin-right-xs"><text class="cuIcon-add"></text></text>
<text>继续添加上架城市</text>
</button>
</view> </view>
<!-- <view class="cu-form-group"> <!-- <view class="cu-form-group">
<view class="title">上门费</view> <view class="title">上门费</view>
@ -214,7 +215,7 @@
</view> --> </view> -->
<view class="cu-bar bg-white solid-top"> <view class="cu-bar bg-white solid-top">
<view class="action text-black"> <view class="action text-black">
商品封面图上传<text class="text-red">*</text> 商品封面图上传<text class="text-red">*</text>只能一张一张上传
</view> </view>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
@ -235,7 +236,7 @@
</view> </view>
<view class="cu-bar bg-white solid-top"> <view class="cu-bar bg-white solid-top">
<view class="action text-black"> <view class="action text-black">
详情图上传<text class="text-red">*</text> 详情图上传<text class="text-red">*</text>可多张勾选同时上传
</view> </view>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
@ -256,7 +257,7 @@
</view> </view>
<view class="cu-bar bg-white solid-top"> <view class="cu-bar bg-white solid-top">
<view class="action text-black"> <view class="action text-black">
轮播图上传<text class="text-red">*</text> 轮播图上传<text class="text-red">*</text>只能一张一张上传
</view> </view>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
@ -277,7 +278,7 @@
:maxHeight="cropHeight" :url="url2Crop" @cancel="oncancel" @ok="onok"></ksp-cropper> :maxHeight="cropHeight" :url="url2Crop" @cancel="oncancel" @ok="onok"></ksp-cropper>
<view class="cu-bar bg-white solid-top"> <view class="cu-bar bg-white solid-top">
<view class="action text-black"> <view class="action text-black">
视频上传 视频上传一分钟内的视频最佳
</view> </view>
</view> </view>
<!-- <view class="bg-white padding-lr padding-bottom-sm"> <!-- <view class="bg-white padding-lr padding-bottom-sm">
@ -323,7 +324,7 @@
myUniCombox myUniCombox
}, },
data() { data() {
return { return {
goodsId: null, goodsId: null,
formData: { formData: {
servName: '', servName: '',
@ -341,7 +342,7 @@
descImgList: [], descImgList: [],
coverImgList: [], coverImgList: [],
videoList: [] videoList: []
}, },
servArea: [], servArea: [],
sysInfo: null, sysInfo: null,
url2Crop: '', url2Crop: '',
@ -418,15 +419,15 @@
}, { }, {
code: 6, code: 6,
name: '12个月' name: '12个月'
}], }],
expectDurationList: [{ expectDurationList: [{
name: '12点前下单预计当天下午上门/服务' name: '12点前下单预计当天下午上门/服务'
}, { }, {
name: '17点前下单预计次日上门/服务' name: '17点前下单预计次日上门/服务'
}, { }, {
name: '现时下单,预计次日上门/服务' name: '现时下单,预计次日上门/服务'
}, { }, {
name: '现时下单,预计后日上门/服务' name: '现时下单,预计后日上门/服务'
}], }],
curUserInfo: {}, curUserInfo: {},
bankCard: null, bankCard: null,
@ -442,9 +443,9 @@
methods: { methods: {
async loadData(goodId) { async loadData(goodId) {
this.sysInfo = uni.getSystemInfoSync(); this.sysInfo = uni.getSystemInfoSync();
this.curUserInfo = this.$request.getCurUserInfo(); this.curUserInfo = this.$request.getCurUserInfo();
if (goodId) { if (goodId) {
this.getCurGoodsInfo(goodId); this.getCurGoodsInfo(goodId);
} }
this.checkBankAndCertify(); this.checkBankAndCertify();
this.loadCategoryList(); this.loadCategoryList();
@ -452,80 +453,80 @@
// TODO goodIdgood // TODO goodIdgood
// this.categoryList = await this.$api.data('categoryList'); // this.categoryList = await this.$api.data('categoryList');
// this.regionList = await this.$api.data('regionList'); // this.regionList = await this.$api.data('regionList');
}, },
async getCurGoodsInfo(goodsId) { async getCurGoodsInfo(goodsId) {
let res1 = await this.$request.qryProductDetail({ let res1 = await this.$request.qryProductDetail({
goodsId: goodsId goodsId: goodsId
}); });
let goods = res1.data; let goods = res1.data;
// map // map
let chosenGoodsStandardMap = new Map(); let chosenGoodsStandardMap = new Map();
goods.goodsStandardList.forEach(o => { goods.goodsStandardList.forEach(o => {
chosenGoodsStandardMap.set(o.deptGoodsCategoryId, o); chosenGoodsStandardMap.set(o.deptGoodsCategoryId, o);
}); });
// //
let res2 = await this.$request.listByStep({ let res2 = await this.$request.listByStep({
type: 1, type: 1,
goodsCategoryId: goods.deptGoodsCategoryId goodsCategoryId: goods.deptGoodsCategoryId
}); });
let specsList = res2.data; let specsList = res2.data;
let newSpecsList = []; let newSpecsList = [];
specsList.forEach(o => { specsList.forEach(o => {
if (chosenGoodsStandardMap.has(o.deptGoodsCategoryId)) { if (chosenGoodsStandardMap.has(o.deptGoodsCategoryId)) {
o = chosenGoodsStandardMap.get(o.deptGoodsCategoryId); o = chosenGoodsStandardMap.get(o.deptGoodsCategoryId);
o.checked = true; o.checked = true;
} }
newSpecsList.push(o); newSpecsList.push(o);
}); });
// map // map
let chosenAreaMap = new Map(); let chosenAreaMap = new Map();
goods.goodsAreaList.forEach(o => { goods.goodsAreaList.forEach(o => {
chosenAreaMap.set(o.countryAreaId, o); chosenAreaMap.set(o.countryAreaId, o);
}); });
// //
let res3 = await this.$request.areaListByStep({ let res3 = await this.$request.areaListByStep({
parentCode: goods.parentAreaId parentCode: goods.parentAreaId
}); });
let areaList = res3.data; let areaList = res3.data;
let newAreaList = []; let newAreaList = [];
areaList.forEach(o => { areaList.forEach(o => {
if (chosenAreaMap.has(o.areaId)) { if (chosenAreaMap.has(o.areaId)) {
o = chosenAreaMap.get(o.areaId); o = chosenAreaMap.get(o.areaId);
o.checked = true; o.checked = true;
} }
newAreaList.push(o); newAreaList.push(o);
}); });
this.formData = { this.formData = {
servName: goods.goodsName, servName: goods.goodsName,
servDesc: goods.goodsDesc, servDesc: goods.goodsDesc,
categoryConcatName: goods.categoryConcatName, categoryConcatName: goods.categoryConcatName,
deptGoodsCategoryId: goods.deptGoodsCategoryId, deptGoodsCategoryId: goods.deptGoodsCategoryId,
specsList: newSpecsList, specsList: newSpecsList,
goodsUnit: { goodsUnit: {
name: goods.goodsUnit name: goods.goodsUnit
}, },
warrantyPeriod: { warrantyPeriod: {
name: goods.warrantyPeriod name: goods.warrantyPeriod
}, },
servActivity: { servActivity: {
name: goods.servActivity name: goods.servActivity
}, },
expectDuration: { expectDuration: {
name: goods.expectDuration name: goods.expectDuration
}, },
areaConcatName: goods.areaConcatName, areaConcatName: goods.areaConcatName,
districtList: newAreaList, districtList: newAreaList,
detailDesc: goods.remark, detailDesc: goods.remark,
areaDesc: goods.areaDesc, areaDesc: goods.areaDesc,
coverImgList: [goods.goodsImgUrl], coverImgList: [goods.goodsImgUrl],
imgList: goods.lbUrl, imgList: goods.lbUrl,
descImgList: goods.detailUrl, descImgList: goods.detailUrl,
videoList: goods.goodsVideoUrl ? [goods.goodsVideoUrl] : [], videoList: goods.goodsVideoUrl ? [goods.goodsVideoUrl] : [],
// status: 0, // status: 0,
} }
}, },
async checkBankAndCertify() { async checkBankAndCertify() {
// //
@ -592,8 +593,9 @@
for (let i = 0; i < this.categoryList.length; i++) { for (let i = 0; i < this.categoryList.length; i++) {
chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[i]]); chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[i]]);
} }
this.formData.category = chosenCategory; this.formData.category = chosenCategory;
this.formData.deptGoodsCategoryId = this.formData.category[this.formData.category.length - 1].goodsCategoryId; this.formData.deptGoodsCategoryId = this.formData.category[this.formData.category.length - 1]
.goodsCategoryId;
// //
let res = await this.$request.listByStep({ let res = await this.$request.listByStep({
@ -649,20 +651,22 @@
parentCode: chosenRegion[1].areaCode parentCode: chosenRegion[1].areaCode
}); });
this.formData.districtList = areaList.data; this.formData.districtList = areaList.data;
}, },
async multiRegionChange(e, regionIndex) { async multiRegionChange(e, regionIndex) {
this.servArea[regionIndex].regionMultiIndex = e.detail.value; this.servArea[regionIndex].regionMultiIndex = e.detail.value;
let chosenRegion = []; let chosenRegion = [];
for (let i = 0; i < this.servArea[regionIndex].regionList.length; i++) { for (let i = 0; i < this.servArea[regionIndex].regionList.length; i++) {
chosenRegion.push(this.servArea[regionIndex].regionList[i][this.servArea[regionIndex].regionMultiIndex[i]]); chosenRegion.push(this.servArea[regionIndex].regionList[i][this.servArea[regionIndex]
} .regionMultiIndex[i]
this.servArea[regionIndex].region = chosenRegion; ]);
}
// this.servArea[regionIndex].region = chosenRegion;
let areaList = await this.$request.areaListByStep({
parentCode: chosenRegion[1].areaCode //
}); let areaList = await this.$request.areaListByStep({
this.servArea[regionIndex].districtList = areaList.data; parentCode: chosenRegion[1].areaCode
});
this.servArea[regionIndex].districtList = areaList.data;
}, },
async regionColChange(e) { async regionColChange(e) {
let colObj = e.detail; let colObj = e.detail;
@ -671,24 +675,24 @@
let subAreaList = await this.$request.areaListByStep({ let subAreaList = await this.$request.areaListByStep({
parentCode: this.regionList[0][colObj.value].areaCode parentCode: this.regionList[0][colObj.value].areaCode
}); });
subAreaList = subAreaList.data; subAreaList = subAreaList.data;
this.regionList.pop(); this.regionList.pop();
this.regionList.push(subAreaList); this.regionList.push(subAreaList);
this.regionMultiIndex = [colObj.value, 0]; this.regionMultiIndex = [colObj.value, 0];
} }
}, },
async multiRegionColChange(e, regionIndex) { async multiRegionColChange(e, regionIndex) {
let colObj = e.detail; let colObj = e.detail;
if (colObj.column == 0) { if (colObj.column == 0) {
// //
let subAreaList = await this.$request.areaListByStep({ let subAreaList = await this.$request.areaListByStep({
parentCode: this.regionList[0][colObj.value].areaCode parentCode: this.regionList[0][colObj.value].areaCode
}); });
subAreaList = subAreaList.data; subAreaList = subAreaList.data;
this.servArea[regionIndex].regionList.pop(); this.servArea[regionIndex].regionList.pop();
this.servArea[regionIndex].regionList.push(subAreaList); this.servArea[regionIndex].regionList.push(subAreaList);
this.servArea[regionIndex].regionMultiIndex = [colObj.value, 0]; this.servArea[regionIndex].regionMultiIndex = [colObj.value, 0];
} }
}, },
checkSpecs(e) { checkSpecs(e) {
let checkedIndexArr = e.detail.value; let checkedIndexArr = e.detail.value;
@ -705,13 +709,13 @@
}, },
showAllSpecs() { showAllSpecs() {
this.isShowAllSpecs = !this.isShowAllSpecs; this.isShowAllSpecs = !this.isShowAllSpecs;
}, },
hideTips(tipName, index) { hideTips(tipName, index) {
if (typeof index === 'number' && index >= 0) { if (typeof index === 'number' && index >= 0) {
this.$refs[tipName][index].close(); this.$refs[tipName][index].close();
} else { } else {
this.$refs[tipName].close(); this.$refs[tipName].close();
} }
}, },
checkDistirct(e) { checkDistirct(e) {
let checkedIndexArr = e.detail.value; let checkedIndexArr = e.detail.value;
@ -722,16 +726,16 @@
this.formData.districtList[i].checked = false; this.formData.districtList[i].checked = false;
} }
} }
}, },
multiAreaCheckDistirct(e, index) { multiAreaCheckDistirct(e, index) {
let checkedIndexArr = e.detail.value; let checkedIndexArr = e.detail.value;
for (let i = 0; i < this.servArea[index].districtList.length; i++) { for (let i = 0; i < this.servArea[index].districtList.length; i++) {
if (checkedIndexArr.indexOf(String(i)) !== -1) { if (checkedIndexArr.indexOf(String(i)) !== -1) {
this.servArea[index].districtList[i].checked = true; this.servArea[index].districtList[i].checked = true;
} else { } else {
this.servArea[index].districtList[i].checked = false; this.servArea[index].districtList[i].checked = false;
} }
} }
}, },
chooseImgList(e, imgListField, cropWidth, cropHeight) { chooseImgList(e, imgListField, cropWidth, cropHeight) {
this.cropWidth = cropWidth && cropWidth > 0 ? cropWidth : this.sysInfo.windowWidth * 2; this.cropWidth = cropWidth && cropWidth > 0 ? cropWidth : this.sysInfo.windowWidth * 2;
@ -833,7 +837,7 @@
if (!data.servName) { if (!data.servName) {
errMsg = '服务名称不能为空'; errMsg = '服务名称不能为空';
} else if (!data.servDesc) { } else if (!data.servDesc) {
errMsg = '服务描述不能为空'; errMsg = '搜索关键词不能为空';
} else if ((!data.category || !data.category.length) && (!data.categoryConcatName)) { } else if ((!data.category || !data.category.length) && (!data.categoryConcatName)) {
errMsg = '请选择类目'; errMsg = '请选择类目';
} else if (!data.goodsStandardList || !data.goodsStandardList.length) { } else if (!data.goodsStandardList || !data.goodsStandardList.length) {
@ -842,8 +846,14 @@
return false; return false;
} else if (!data.goodsUnit) { } else if (!data.goodsUnit) {
errMsg = '商品单位不能为空'; errMsg = '商品单位不能为空';
} else if (!data.warrantyPeriod) {
errMsg = '质保期不能为空';
} else if (!data.servActivity) {
errMsg = '服务活动不能为空';
} else if (!data.expectDuration) {
errMsg = '服务时效不能为空';
} else if (!data.goodsAreaList || !data.goodsAreaList.length) { } else if (!data.goodsAreaList || !data.goodsAreaList.length) {
errMsg = '至少选择一个上架区域'; errMsg = '上架区域填写不完整';
} else if (!data.areaDesc) { } else if (!data.areaDesc) {
errMsg = '区域描述不能为空'; errMsg = '区域描述不能为空';
} else if (!data.coverImgList || !data.coverImgList.length) { } else if (!data.coverImgList || !data.coverImgList.length) {
@ -885,57 +895,56 @@
return false; return false;
} }
return true; return true;
},
validMultiAreaList(list) {
let errMsg = null;
if (!list || !list.length) {
errMsg = '上架区域填写不完整';
}
if (errMsg) {
uni.showToast({
icon: 'none',
title: errMsg,
duration: 2500
})
return false;
}
return true;
}, },
async submit() { validMultiAreaList(data) {
// let errMsg = null;
let multiServAreaChecked = true; if (!data.goodsAreaList || !data.goodsAreaList.length || !data.areaDesc) {
let multiServAreaList = []; errMsg = '上架区域填写不完整';
for(let x of this.servArea) { }
let oneCheckedAreaList = null; if (errMsg) {
if (x && x.districtList && x.districtList.length) { uni.showToast({
oneCheckedAreaList = x.districtList.filter((item) => { icon: 'none',
if (item.checked) { title: errMsg,
item.countryAreaId = item.areaId; duration: 2500
return item; })
} return false;
}); }
} return true;
if (!this.validMultiAreaList(oneCheckedAreaList)) { },
multiServAreaChecked = false; async submit() {
break; //
} let multiServAreaChecked = true;
multiServAreaList.push({ let multiServAreaList = [];
goodsAreaList: oneCheckedAreaList, for (let x of this.servArea) {
areaDesc: x.areaDesc let oneCheckedAreaList = null;
}); if (x && x.districtList && x.districtList.length) {
} oneCheckedAreaList = x.districtList.filter((item) => {
if (!multiServAreaChecked) { if (item.checked) {
return; item.countryAreaId = item.areaId;
} return item;
}
});
}
let oneServAreaObj = {
goodsAreaList: oneCheckedAreaList,
areaDesc: x.areaDesc
}
if (!this.validMultiAreaList(oneServAreaObj)) {
multiServAreaChecked = false;
break;
}
multiServAreaList.push(oneServAreaObj);
}
if (!multiServAreaChecked) {
return;
}
let goodsStandardList = this.formData.specsList.filter((item) => { let goodsStandardList = this.formData.specsList.filter((item) => {
if (item.checked) { if (item.checked) {
if (!item.goodsStandardName) { if (!item.goodsStandardName) {
item.goodsStandardName = item.goodsCategoryName; item.goodsStandardName = item.goodsCategoryName;
} }
return { return item;
...item
}
} }
}); });
let goodsAreaList = this.formData.districtList.filter((item) => { let goodsAreaList = this.formData.districtList.filter((item) => {
@ -977,9 +986,9 @@
let params = { let params = {
goodsName: this.formData.servName, goodsName: this.formData.servName,
goodsDesc: this.formData.servDesc, goodsDesc: this.formData.servDesc,
goodsUnit: this.formData.goodsUnit.name, goodsUnit: this.formData.goodsUnit.name,
warrantyPeriod: this.formData.warrantyPeriod.name, warrantyPeriod: this.formData.warrantyPeriod.name,
servActivity: this.formData.servActivity.name, servActivity: this.formData.servActivity.name,
expectDuration: this.formData.expectDuration.name, expectDuration: this.formData.expectDuration.name,
deptGoodsCategoryId: this.formData.deptGoodsCategoryId, deptGoodsCategoryId: this.formData.deptGoodsCategoryId,
goodsStandardList: goodsStandardList, goodsStandardList: goodsStandardList,
@ -988,28 +997,28 @@
goodsImgsList: goodsImgsList, goodsImgsList: goodsImgsList,
goodsVideoUrl: goodsVideoUrl, goodsVideoUrl: goodsVideoUrl,
status: 0, status: 0,
remark: this.formData.detailDesc, remark: this.formData.detailDesc,
areaDesc: this.formData.areaDesc areaDesc: this.formData.areaDesc
} }
let res = null; let res = null;
if (this.goodsId) { if (this.goodsId) {
res = await this.$request.editGoods({ res = await this.$request.editGoods({
...params, ...params,
goodsId: this.goodsId goodsId: this.goodsId
}); });
} else { } else {
res = await this.$request.addGoods(params); res = await this.$request.addGoods(params);
} }
// //
let index = 0; let index = 0;
while(index < multiServAreaList.length && res && res.code === 0) { while (index < multiServAreaList.length && res && res.code === 0) {
res = await this.$request.addGoods({ res = await this.$request.addGoods({
...params, ...params,
goodsAreaList: multiServAreaList[index].goodsAreaList, goodsAreaList: multiServAreaList[index].goodsAreaList,
areaDesc: multiServAreaList[index].areaDesc areaDesc: multiServAreaList[index].areaDesc
}); });
index++; index++;
} }
if (res && res.code === 0) { if (res && res.code === 0) {
uni.showToast({ uni.showToast({
@ -1019,23 +1028,23 @@
url: '/pages/index/index?menuCode=supplyChainPage' url: '/pages/index/index?menuCode=supplyChainPage'
}) })
} }
}, },
async addServArea() { async addServArea() {
let subRegionList = await this.$request.areaListByStep({ let subRegionList = await this.$request.areaListByStep({
parentCode: this.regionList[0][0].areaCode parentCode: this.regionList[0][0].areaCode
}); });
subRegionList = subRegionList.data; subRegionList = subRegionList.data;
this.servArea.push({ this.servArea.push({
region: [], region: [],
districtList: [], districtList: [],
areaDesc: null, areaDesc: null,
regionList: [this.regionList[0], subRegionList], regionList: [this.regionList[0], subRegionList],
regionMultiIndex: [0, 0] regionMultiIndex: [0, 0]
}); });
}, },
delServArea(index) { delServArea(index) {
this.servArea.splice(index, 1); this.servArea.splice(index, 1);
} }
}, },
} }
@ -1046,6 +1055,16 @@
display: none; display: none;
} }
.cu-form-group .title {
flex-basis: 26%;
text-align: justify;
padding-right: 10rpx;
font-size: 30rpx;
position: relative;
height: 60rpx;
line-height: 60rpx;
}
.certern-height { .certern-height {
max-height: 520rpx; max-height: 520rpx;
overflow: hidden; overflow: hidden;
@ -1061,9 +1080,9 @@
.radius-input.xs { .radius-input.xs {
font-size: 23rpx; font-size: 23rpx;
} }
.radius-input.sm { .radius-input.sm {
font-size: 25rpx; font-size: 25rpx;
} }
</style> </style>