修改上架
This commit is contained in:
parent
2eec7295ed
commit
2714001875
|
|
@ -15,7 +15,7 @@ export default {
|
||||||
// request 触发前拼接 url
|
// request 触发前拼接 url
|
||||||
args.url = 'https://www.opsoul.com:8881' + args.url;
|
args.url = 'https://www.opsoul.com:8881' + args.url;
|
||||||
// args.url = 'http://127.0.0.1:80' + args.url;
|
// args.url = 'http://127.0.0.1:80' + args.url;
|
||||||
// args.url = 'http://192.168.2.50:80' + args.url;
|
// args.url = 'http://192.168.2.12:80' + args.url;
|
||||||
|
|
||||||
if (!args.data) {
|
if (!args.data) {
|
||||||
args.data = {}
|
args.data = {}
|
||||||
|
|
@ -536,6 +536,14 @@ export default {
|
||||||
})
|
})
|
||||||
return res[1].data;
|
return res[1].data;
|
||||||
},
|
},
|
||||||
|
async qryProductDetail(params = {}) {
|
||||||
|
let res = await uni.request({
|
||||||
|
url: '/goods/goods/app/detail',
|
||||||
|
method: 'POST',
|
||||||
|
data: params
|
||||||
|
})
|
||||||
|
return res[1].data;
|
||||||
|
},
|
||||||
async updateGoodsStatus(params = {}) {
|
async updateGoodsStatus(params = {}) {
|
||||||
let res = await uni.request({
|
let res = await uni.request({
|
||||||
url: '/goods/goods/app/updateStatus',
|
url: '/goods/goods/app/updateStatus',
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@
|
||||||
addEditGood(servItem) {
|
addEditGood(servItem) {
|
||||||
let params = '';
|
let params = '';
|
||||||
if (servItem != null) {
|
if (servItem != null) {
|
||||||
params = '?goodId=' + servItem.id
|
params = '?goodId=' + servItem.goodsId
|
||||||
}
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/my/new-serv' + params
|
url: '/pages/my/new-serv' + params
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,14 @@
|
||||||
<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 disabled class="line-input radius-input"
|
<input v-if="formData.category"
|
||||||
|
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>
|
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">
|
||||||
|
|
@ -34,7 +39,7 @@
|
||||||
<checkbox style="transform:scale(1)" class="main-color margin-right-xs"
|
<checkbox style="transform:scale(1)" class="main-color margin-right-xs"
|
||||||
:value="index" :checked="item.checked"></checkbox>
|
:value="index" :checked="item.checked"></checkbox>
|
||||||
<text>{{item.goodsCategoryName}}</text>
|
<text>{{item.goodsCategoryName}}</text>
|
||||||
</view>
|
</view>`
|
||||||
<view class="flex-sub">
|
<view class="flex-sub">
|
||||||
<input class="sm radius-input"
|
<input class="sm radius-input"
|
||||||
@input="inputSpecs($event, index, 'goodsStandardName')"
|
@input="inputSpecs($event, index, 'goodsStandardName')"
|
||||||
|
|
@ -104,14 +109,30 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="cu-form-group solid-top">
|
<view class="cu-form-group solid-top">
|
||||||
<view class="title">商品单位<text class="text-red">*</text></view>
|
<view class="title">商品单位<text class="text-red">*</text></view>
|
||||||
<input name="goodsUnit" v-model="formData.goodsUnit" placeholder="商品单位显示优先级低于规格单位"></input>
|
<my-uni-combox class="form-val-area" :candidates="goodsUnitList" placeholder="上方已填单位则以上方所填为准"
|
||||||
|
v-model="formData.goodsUnit">
|
||||||
|
</my-uni-combox>
|
||||||
|
</view>
|
||||||
|
<view class="cu-form-group solid-top">
|
||||||
|
<view class="title">质保期</view>
|
||||||
|
<my-uni-combox class="form-val-area" :candidates="warrantyPeriodList" placeholder="请选择"
|
||||||
|
v-model="formData.warrantyPeriod">
|
||||||
|
</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">服务活动</view>
|
||||||
<my-uni-combox class="form-val-area" :candidates="servHonorTitle" placeholder="请选择"
|
<my-uni-combox class="form-val-area" :candidates="servActivityList" placeholder="请选择"
|
||||||
v-model="formData.servHonorTitle">
|
v-model="formData.servActivity">
|
||||||
|
</my-uni-combox>
|
||||||
|
</view>
|
||||||
|
<view class="cu-form-group justify-start">
|
||||||
|
<!-- <checkbox style="transform:scale(1)" class="main-color margin-right-xs" :value="true"
|
||||||
|
:v-model="formData.isGoldenServ" :checked="formData.isGoldenServ"></checkbox> -->
|
||||||
|
<view class="title">服务时效</view>
|
||||||
|
<my-uni-combox class="form-val-area" :candidates="expectDurationList" placeholder="请选择"
|
||||||
|
v-model="formData.expectDuration">
|
||||||
</my-uni-combox>
|
</my-uni-combox>
|
||||||
</view>
|
</view>
|
||||||
<view class="solid-top">
|
<view class="solid-top">
|
||||||
|
|
@ -119,9 +140,12 @@
|
||||||
<view class="title">上架区域<text class="text-red">*</text></view>
|
<view class="title">上架区域<text class="text-red">*</text></view>
|
||||||
<picker :mode="'multiSelector'" @change="regionChange" @columnchange="regionColChange"
|
<picker :mode="'multiSelector'" @change="regionChange" @columnchange="regionColChange"
|
||||||
:value="regionMultiIndex" :range-key="'areaName'" :range="regionList">
|
:value="regionMultiIndex" :range-key="'areaName'" :range="regionList">
|
||||||
<input disabled class="line-input radius-input"
|
<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>
|
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">
|
||||||
|
|
@ -258,6 +282,7 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
goodsId: null,
|
||||||
formData: {
|
formData: {
|
||||||
servName: '',
|
servName: '',
|
||||||
servDesc: '',
|
servDesc: '',
|
||||||
|
|
@ -285,7 +310,7 @@
|
||||||
regionList: [],
|
regionList: [],
|
||||||
regionMultiIndex: [0, 0],
|
regionMultiIndex: [0, 0],
|
||||||
isShowAllSpecs: false,
|
isShowAllSpecs: false,
|
||||||
productUnits: [{
|
goodsUnitList: [{
|
||||||
code: 1,
|
code: 1,
|
||||||
name: '台'
|
name: '台'
|
||||||
}, {
|
}, {
|
||||||
|
|
@ -293,22 +318,46 @@
|
||||||
name: '件'
|
name: '件'
|
||||||
}, {
|
}, {
|
||||||
code: 3,
|
code: 3,
|
||||||
name: '套'
|
|
||||||
}, {
|
|
||||||
code: 4,
|
|
||||||
name: '个'
|
name: '个'
|
||||||
}, {
|
}, {
|
||||||
code: 5,
|
code: 4,
|
||||||
name: '平方'
|
name: '套'
|
||||||
}],
|
|
||||||
servHonorTitle: [{
|
|
||||||
code: -1,
|
|
||||||
name: '无'
|
|
||||||
}, {
|
}, {
|
||||||
|
code: 5,
|
||||||
|
name: '㎡'
|
||||||
|
}, {
|
||||||
|
code: 6,
|
||||||
|
name: '只'
|
||||||
|
}, {
|
||||||
|
code: 7,
|
||||||
|
name: '张'
|
||||||
|
}, {
|
||||||
|
code: 8,
|
||||||
|
name: '条'
|
||||||
|
}, {
|
||||||
|
code: 9,
|
||||||
|
name: '顶'
|
||||||
|
}, {
|
||||||
|
code: 10,
|
||||||
|
name: '支'
|
||||||
|
}, {
|
||||||
|
code: 11,
|
||||||
|
name: '根'
|
||||||
|
}],
|
||||||
|
servActivityList: [{
|
||||||
code: 1,
|
code: 1,
|
||||||
name: '金牌服务'
|
name: '金牌服务'
|
||||||
|
}, {
|
||||||
|
code: 2,
|
||||||
|
name: '定制预售'
|
||||||
|
}, {
|
||||||
|
code: 3,
|
||||||
|
name: '特惠团购'
|
||||||
|
}, {
|
||||||
|
code: 4,
|
||||||
|
name: '分享0元购'
|
||||||
}],
|
}],
|
||||||
productProtectTimes: [{
|
warrantyPeriodList: [{
|
||||||
code: 1,
|
code: 1,
|
||||||
name: '15天'
|
name: '15天'
|
||||||
}, {
|
}, {
|
||||||
|
|
@ -317,6 +366,24 @@
|
||||||
}, {
|
}, {
|
||||||
code: 3,
|
code: 3,
|
||||||
name: '45天'
|
name: '45天'
|
||||||
|
}, {
|
||||||
|
code: 4,
|
||||||
|
name: '3个月'
|
||||||
|
}, {
|
||||||
|
code: 5,
|
||||||
|
name: '6个月'
|
||||||
|
}, {
|
||||||
|
code: 6,
|
||||||
|
name: '12个月'
|
||||||
|
}],
|
||||||
|
expectDurationList: [{
|
||||||
|
name: '12点前下单,预计当天下午上门/服务'
|
||||||
|
}, {
|
||||||
|
name: '17点前下单,预计次日上门/服务'
|
||||||
|
}, {
|
||||||
|
name: '现时下单,预计次日上门/服务'
|
||||||
|
}, {
|
||||||
|
name: '现时下单,预计后日上门/服务'
|
||||||
}],
|
}],
|
||||||
curUserInfo: {},
|
curUserInfo: {},
|
||||||
bankCard: null,
|
bankCard: null,
|
||||||
|
|
@ -324,16 +391,18 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let goodId = null;
|
|
||||||
if (options && options.goodId) {
|
if (options && options.goodId) {
|
||||||
goodId = options.goodId;
|
this.goodsId = options.goodId;
|
||||||
}
|
}
|
||||||
this.loadData(goodId);
|
this.loadData(this.goodsId);
|
||||||
},
|
},
|
||||||
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) {
|
||||||
|
this.getCurGoodsInfo(goodId);
|
||||||
|
}
|
||||||
this.checkBankAndCertify();
|
this.checkBankAndCertify();
|
||||||
this.loadCategoryList();
|
this.loadCategoryList();
|
||||||
this.loadRegionList();
|
this.loadRegionList();
|
||||||
|
|
@ -341,6 +410,80 @@
|
||||||
// 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) {
|
||||||
|
let res1 = await this.$request.qryProductDetail({
|
||||||
|
goodsId: goodsId
|
||||||
|
});
|
||||||
|
let goods = res1.data;
|
||||||
|
|
||||||
|
// 选中规则转map
|
||||||
|
let chosenGoodsStandardMap = new Map();
|
||||||
|
goods.goodsStandardList.forEach(o => {
|
||||||
|
chosenGoodsStandardMap.set(o.deptGoodsCategoryId, o);
|
||||||
|
});
|
||||||
|
// 查询选中的第三级类目下的所有规格
|
||||||
|
let res2 = await this.$request.listByStep({
|
||||||
|
type: 1,
|
||||||
|
goodsCategoryId: goods.deptGoodsCategoryId
|
||||||
|
});
|
||||||
|
let specsList = res2.data;
|
||||||
|
let newSpecsList = [];
|
||||||
|
specsList.forEach(o => {
|
||||||
|
if (chosenGoodsStandardMap.has(o.deptGoodsCategoryId)) {
|
||||||
|
o = chosenGoodsStandardMap.get(o.deptGoodsCategoryId);
|
||||||
|
o.checked = true;
|
||||||
|
}
|
||||||
|
newSpecsList.push(o);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 选中地区转map
|
||||||
|
let chosenAreaMap = new Map();
|
||||||
|
goods.goodsAreaList.forEach(o => {
|
||||||
|
chosenAreaMap.set(o.countryAreaId, o);
|
||||||
|
});
|
||||||
|
// 查询选中的第二级区域下的第三级区域
|
||||||
|
let res3 = await this.$request.areaListByStep({
|
||||||
|
parentCode: goods.parentAreaId
|
||||||
|
});
|
||||||
|
let areaList = res3.data;
|
||||||
|
let newAreaList = [];
|
||||||
|
areaList.forEach(o => {
|
||||||
|
if (chosenAreaMap.has(o.areaId)) {
|
||||||
|
o = chosenAreaMap.get(o.areaId);
|
||||||
|
o.checked = true;
|
||||||
|
}
|
||||||
|
newAreaList.push(o);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.formData = {
|
||||||
|
servName: goods.goodsName,
|
||||||
|
servDesc: goods.goodsDesc,
|
||||||
|
categoryConcatName: goods.categoryConcatName,
|
||||||
|
deptGoodsCategoryId: goods.deptGoodsCategoryId,
|
||||||
|
specsList: newSpecsList,
|
||||||
|
goodsUnit: {
|
||||||
|
name: goods.goodsUnit
|
||||||
|
},
|
||||||
|
warrantyPeriod: {
|
||||||
|
name: goods.warrantyPeriod
|
||||||
|
},
|
||||||
|
servActivity: {
|
||||||
|
name: goods.servActivity
|
||||||
|
},
|
||||||
|
expectDuration: {
|
||||||
|
name: goods.expectDuration
|
||||||
|
},
|
||||||
|
areaConcatName: goods.areaConcatName,
|
||||||
|
districtList: newAreaList,
|
||||||
|
detailDesc: goods.remark,
|
||||||
|
areaDesc: goods.areaDesc,
|
||||||
|
coverImgList: [goods.goodsImgUrl],
|
||||||
|
imgList: goods.lbUrl,
|
||||||
|
descImgList: goods.detailUrl,
|
||||||
|
videoList: goods.goodsVideoUrl ? [goods.goodsVideoUrl] : [],
|
||||||
|
// status: 0,
|
||||||
|
}
|
||||||
|
},
|
||||||
async checkBankAndCertify() {
|
async checkBankAndCertify() {
|
||||||
// 查询账户绑定信息
|
// 查询账户绑定信息
|
||||||
// let bankCardRes = await this.$request.getBindBankCardByWorkerId({
|
// let bankCardRes = await this.$request.getBindBankCardByWorkerId({
|
||||||
|
|
@ -407,6 +550,7 @@
|
||||||
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;
|
||||||
|
|
||||||
// 查询最后一级品类
|
// 查询最后一级品类
|
||||||
let res = await this.$request.listByStep({
|
let res = await this.$request.listByStep({
|
||||||
|
|
@ -610,7 +754,7 @@
|
||||||
errMsg = '服务名称不能为空';
|
errMsg = '服务名称不能为空';
|
||||||
} else if (!data.servDesc) {
|
} else if (!data.servDesc) {
|
||||||
errMsg = '服务描述不能为空';
|
errMsg = '服务描述不能为空';
|
||||||
} else if (!data.category || !data.category.length) {
|
} 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) {
|
||||||
errMsg = '至少勾选一个规格';
|
errMsg = '至少勾选一个规格';
|
||||||
|
|
@ -712,15 +856,27 @@
|
||||||
let params = {
|
let params = {
|
||||||
goodsName: this.formData.servName,
|
goodsName: this.formData.servName,
|
||||||
goodsDesc: this.formData.servDesc,
|
goodsDesc: this.formData.servDesc,
|
||||||
goodsUnit: this.formData.goodsUnit,
|
goodsUnit: this.formData.goodsUnit.name,
|
||||||
deptGoodsCategoryId: this.formData.category[this.formData.category.length - 1].goodsCategoryId,
|
warrantyPeriod: this.formData.warrantyPeriod.name,
|
||||||
|
servActivity: this.formData.servActivity.name,
|
||||||
|
expectDuration: this.formData.expectDuration.name,
|
||||||
|
deptGoodsCategoryId: this.formData.deptGoodsCategoryId,
|
||||||
goodsStandardList: goodsStandardList,
|
goodsStandardList: goodsStandardList,
|
||||||
goodsAreaList: goodsAreaList,
|
goodsAreaList: goodsAreaList,
|
||||||
goodsImgUrl: this.formData.coverImgList[0],
|
goodsImgUrl: this.formData.coverImgList[0],
|
||||||
goodsImgsList: goodsImgsList,
|
goodsImgsList: goodsImgsList,
|
||||||
goodsVideoUrl: goodsVideoUrl,
|
goodsVideoUrl: goodsVideoUrl,
|
||||||
status: 0,
|
status: 0,
|
||||||
remark: this.formData.detailDesc
|
remark: this.formData.detailDesc,
|
||||||
|
areaDesc: this.formData.areaDesc
|
||||||
|
}
|
||||||
|
console.log(params)
|
||||||
|
if (this.goodsId) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'error',
|
||||||
|
title: '参数缺失'
|
||||||
|
})
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
let res = await this.$request.addGoods(params);
|
let res = await this.$request.addGoods(params);
|
||||||
if (res && res.code === 0) {
|
if (res && res.code === 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue