From ee1876f777342c7cdf91a2b979ab816b1d16c4f6 Mon Sep 17 00:00:00 2001 From: fanfan Date: Fri, 12 Apr 2024 16:35:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=9A=84=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/model/goods/Index.js | 3 +- src/views/dataCenter/goods/Create.vue | 217 ++++++++++++++------------ src/views/dataCenter/goods/Update.vue | 47 +++++- 3 files changed, 158 insertions(+), 109 deletions(-) diff --git a/src/common/model/goods/Index.js b/src/common/model/goods/Index.js index b7418c4..fb1eb4b 100644 --- a/src/common/model/goods/Index.js +++ b/src/common/model/goods/Index.js @@ -95,7 +95,8 @@ export default { 'status', 'spec_type', 'deduct_stock_type', 'is_restrict', 'content', 'selling_point', 'serviceIds', 'sales_initial', 'is_points_gift', 'is_points_discount', 'is_enable_grade', 'is_alone_grade', 'is_ind_dealer', - 'dealer_money_type', 'first_money', 'second_money', 'third_money','specific_value' + 'dealer_money_type', 'first_money', 'second_money', 'third_money','specific_value', + 'cmmdty_model','is_check','is_pool','is_sale','delivery_time' ]) return { ...goodsFormData, diff --git a/src/views/dataCenter/goods/Create.vue b/src/views/dataCenter/goods/Create.vue index e0c1638..a820ccd 100644 --- a/src/views/dataCenter/goods/Create.vue +++ b/src/views/dataCenter/goods/Create.vue @@ -24,6 +24,12 @@ v-decorator="['goods_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" /> + + + - + + + 24小时 + 48小时 + 72小时 + 7天内 + 15天内 + 30天内 + 45天内 + + + + + + + + - + 待处理 已入池 未入池 - + 停售 在售 无货 - + @@ -175,10 +190,7 @@ - +
@@ -195,16 +207,14 @@ - + @@ -217,7 +227,10 @@ @@ -229,7 +242,10 @@ > 千克 (Kg) @@ -280,10 +296,8 @@
- - + +
@@ -313,18 +327,16 @@ > - + - {{ item.name }} + {{ + item.name + }}
去新增 @@ -337,10 +349,10 @@ :wrapperCol="wrapperCol" extra="用户端展示的销量 = 初始销量 + 实际销量" > - + -
+
销售区域 {{ province.name }} {{ ' ' }} @@ -374,11 +384,11 @@

- 点击添加销售区域 + 点击添加销售区域
-
+
积分设置 - + 开启 关闭 @@ -399,16 +407,14 @@ :wrapperCol="wrapperCol" extra="开启后用户购买此商品可以使用积分进行抵扣" > - + 开启 关闭
-
+
会员折扣设置
-

单独折扣:折扣率范围0.0-9.9,例如: 9.8代表98折,0代表不折扣

+

+ 单独折扣:折扣率范围0.0-9.9,例如: 9.8代表98折,0代表不折扣 +

默认折扣:默认为用户所属会员等级的折扣率

-
+
分销设置 { - this.isLoading = false - }) + GoodsModel.getFromData().then(() => { + this.isLoading = false + }) // 城市总数 - Region.getCitysCount().then(count => { + Region.getCitysCount().then((count) => { this.citysCount = count }) }, methods: { - // 手动强制更新页面 - onForceUpdate (bool = false) { + onForceUpdate(bool = false) { this.$forceUpdate() // bool为true时再执行一次 $forceUpdate, 特殊情况下需执行两次,原因如下: // 第一次执行 $forceUpdate时, 新元素绑定v-decorator无法获取到form.getFieldValue - bool && setTimeout(() => { - this.$forceUpdate() - }, 10) + bool && + setTimeout(() => { + this.$forceUpdate() + }, 10) }, // 切换tab选项卡 - handleTabs (key) { + handleTabs(key) { this.tabKey = key }, // 刷新分类列表 - onReloadCategoryList () { + onReloadCategoryList() { this.isLoading = true GoodsModel.getCategoryList().then(() => { this.isLoading = false @@ -630,7 +638,7 @@ export default { }, // 刷新服务与承诺列表 - onReloadServiceList () { + onReloadServiceList() { this.isLoading = true GoodsModel.getServiceList().then(() => { this.isLoading = false @@ -638,7 +646,7 @@ export default { }, // 刷新配送模板列表 - onReloadDeliveryList () { + onReloadDeliveryList() { this.isLoading = true GoodsModel.getDeliveryList().then(() => { this.isLoading = false @@ -646,10 +654,13 @@ export default { }, // 确认按钮 - handleSubmit (e) { + handleSubmit(e) { e.preventDefault() // 表单验证 - const { form: { validateFields }, ruleList } = this + const { + form: { validateFields }, + ruleList, + } = this validateFields((errors, values) => { // 定位到错误的tab选项卡 if (errors) { @@ -667,7 +678,7 @@ export default { values.specData = MultiSpec.getFromSpecData() } // 整理商品分类ID集 - values.categoryIds = values.categorys.map(item => item.value) + values.categoryIds = values.categorys.map((item) => item.value) delete values.categorys // 提交到后端api values.rules = ruleList @@ -677,14 +688,14 @@ export default { }, // 定位到错误的tab选项卡 - onTargetTabError (errors) { + onTargetTabError(errors) { // 表单字段与tabKey对应关系 // 只需要必填字段就可 const tabsFieldsMap = [ ['goods_type', 'goods_name', 'categorys', 'imagesIds', 'delivery_id', 'is_ind_delivery_type', 'delivery_type'], ['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single'], ['content'], - ['alone_grade_equity', 'first_money', 'second_money', 'third_money'] + ['alone_grade_equity', 'first_money', 'second_money', 'third_money'], ] const field = Object.keys(errors).shift() for (const key in tabsFieldsMap) { @@ -696,11 +707,11 @@ export default { }, // 提交到后端api - onFormSubmit (values) { + onFormSubmit(values) { this.isLoading = true this.isBtnLoading = true GoodsApi.add({ form: values }) - .then(result => { + .then((result) => { // 显示提示信息 this.$message.success(result.message, 1.5) // 跳转到列表页 @@ -711,11 +722,11 @@ export default { .catch(() => { this.isBtnLoading = false }) - .finally(() => this.isLoading = false) + .finally(() => (this.isLoading = false)) }, // 新增记录 - handleAdd () { + handleAdd() { const index = this.ruleList.length const newItem = { ...defaultItem, key: index } // 排除的城市id集(已存在的城市id集) @@ -729,7 +740,7 @@ export default { }, // 编辑记录 - handleEdit (index, item) { + handleEdit(index, item) { // 排除的城市id集(已存在的城市id集) const excludedCityIds = this.getExcludedCityIds() // 显示选择地区对话框 @@ -737,8 +748,10 @@ export default { }, // 选择地区后的回调 - handleAreaSubmit (result) { - const { custom: { scene, item } } = result + handleAreaSubmit(result) { + const { + custom: { scene, item }, + } = result item.region = result.selectedCityIds item.region_text = result.selectedText if (scene === 'add') { @@ -747,10 +760,10 @@ export default { }, // 排除的城市id集(已存在的城市id集) - getExcludedCityIds () { + getExcludedCityIds() { const excludedCityIds = [] - this.ruleList.forEach(item => { - item.region.forEach(cityId => { + this.ruleList.forEach((item) => { + item.region.forEach((cityId) => { excludedCityIds.push(cityId) }) }) @@ -758,25 +771,23 @@ export default { }, // 显示选择地区对话框 - handleAreasModal (scene, index, item, excludedCityIds) { + handleAreasModal(scene, index, item, excludedCityIds) { this.$refs.AreasModal.handle({ scene, index, item }, item.region, excludedCityIds) }, - // 删除记录 - handleDelete (index) { + // 删除记录 + handleDelete(index) { const app = this const modal = this.$confirm({ title: '您确定要删除该记录吗?', - onOk () { + onOk() { app.ruleList.splice(index, 1) modal.destroy() - } + }, }) - } - - } + }, + }, } -