From da1e3dbfc622f7f581d19a56c7e4d3abe13563e1 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期三, 09 七月 2025 18:02:59 +0800 Subject: [PATCH] 上家发布商品功能 --- pages/supplier/publish-goods/publishGoods.vue | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 54 insertions(+), 6 deletions(-) diff --git a/pages/supplier/publish-goods/publishGoods.vue b/pages/supplier/publish-goods/publishGoods.vue index beadba3..8b0daeb 100644 --- a/pages/supplier/publish-goods/publishGoods.vue +++ b/pages/supplier/publish-goods/publishGoods.vue @@ -1,30 +1,78 @@ <template> <view class="container"> <uni-steps :options="publishSteps" :active="currentStep" active-color='#f31947'></uni-steps> - <choose-categery v-if="currentStep===0"></choose-categery> + <choose-categery @choose="chooseCategrey" v-show="currentStep === 0"></choose-categery> + <goods-info @submit="submit" v-show="currentStep === 1"></goods-info> + <view style="position: fixed;bottom: 80px;display: flex;width: calc(100% - 70rpx);"> + <button :disabled="currentStep === 0" @click="lastStep" size="mini" style="flex: 1;font-size: 32rpx;margin-right: 3rpx;" type="primary">涓婁竴姝�</button> + <button :disabled="currentStep === 1" @click="nextStep" size="mini" style="flex: 1;font-size: 32rpx;margin-left: 3rpx;" type="primary">涓嬩竴姝�</button> + </view> </view> </template> <script> import chooseCategery from './chooseCategery.vue'; + import goodsInfo from './goodsInfo.vue'; + import {createGoods} from "@/api/store.js" export default { - components: { chooseCategery }, + components: { chooseCategery, goodsInfo }, data() { return { + goods: { + + }, + categoryPath: '', currentStep:0, publishSteps: [{ title: ' 閫夋嫨鍟嗗搧鍝佺被' }, { title: ' 濉啓鍟嗗搧璇︽儏' - }, - { - title: ' 鍟嗗搧鍙戝竷鎴愬姛' } ], } + }, + methods: { + // 鑾峰彇閫夋嫨鐨勫晢鍝佸垎绫� + chooseCategrey(categreyId) { + this.categoryPath = categreyId + ",," + }, + submit(data) { + if (! this.categoryPath) { + uni.showToast({ title: '璇烽�変腑鍟嗗搧鍒嗙被', icon: 'none' }) + return + } + data['categoryPath'] = this.categoryPath + if (data.skuList) { + data.skuList.forEach(sku => { + delete sku.specValues + }) + } + delete data.specs + // 鍙戝竷鍟嗗搧 + console.log("鍟嗗搧鏁版嵁", data); + createGoods(data).then(res => { + uni.showToast({ title: '鍟嗗搧宸叉彁浜ゅ鏍�', icon: 'success' }) + setTimeout(() => { + uni.navigateBack({ + delta: 1 + }); + }, 2000) + }) + }, + // 涓婁竴姝� + lastStep() { + if (this.currentStep > 0) { + this.currentStep-- + } + }, + // 涓嬩竴姝� + nextStep() { + if (this.currentStep < 1) { + this.currentStep++ + } + } } - } </script> -- Gitblit v1.8.0