From b15139f55b9f10bd32a613cbe983cf7edc56914b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Tue, 26 Apr 2022 14:06:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=92=E6=9D=80=E3=80=81=E6=8E=A8?= =?UTF-8?q?=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/operation/limit/limitProduct.js | 16 +++ src/store/modules/operation/limit/limitSku.js | 44 +++++++ src/views/operation/limit/product.vue | 26 +++-- src/views/operation/limit/sku.vue | 110 ++++++++++++++++++ src/views/operation/recommend/index.vue | 6 +- src/views/sales/product/form/step2.vue | 4 +- 6 files changed, 193 insertions(+), 13 deletions(-) create mode 100644 src/store/modules/operation/limit/limitSku.js create mode 100644 src/views/operation/limit/sku.vue diff --git a/src/api/operation/limit/limitProduct.js b/src/api/operation/limit/limitProduct.js index 0c47d54..e84864f 100644 --- a/src/api/operation/limit/limitProduct.js +++ b/src/api/operation/limit/limitProduct.js @@ -20,3 +20,19 @@ export const remove = (idList) => { params: { idList }, }); }; + +export const searchSkus = (activityProductId) => { + return request({ + url: '/mall/marketing/activityProductSku', + method: 'get', + params: { activityProductId }, + }); +}; + +export const saveSkus = (data) => { + return request({ + url: '/mall/marketing/activityProductSku', + method: 'post', + data, + }); +}; diff --git a/src/store/modules/operation/limit/limitSku.js b/src/store/modules/operation/limit/limitSku.js new file mode 100644 index 0000000..a4aaf4c --- /dev/null +++ b/src/store/modules/operation/limit/limitSku.js @@ -0,0 +1,44 @@ +import * as api from '@/api/operation/limit/limitProduct.js'; +import { ElMessage } from '@/plugins/element-plus'; +const state = () => ({ + code: 'LimitProduct', + condition: {}, + list: [], + total: 0, + opts: { + init: false, + }, +}); +const getters = {}; +const mutations = { + setCode: (state, data) => (state.code = data), + setCondition: (state, data) => (state.condition = data), + setList: (state, data) => (state.list = data), + setTotal: (state, data) => (state.total = data), + setOpts: (state, data) => (state.opts = data), +}; +const actions = { + search: async ({ commit }, id) => { + let res = await api.searchSkus(id); + commit('setList', res || []); + if (!res) { + ElMessage.error('查询秒杀商品SKU列表失败'); + } + return res; + }, + save: async (context, data) => { + let res = await api.saveSkus(data); + if (res) { + ElMessage.success('保存成功'); + } else { + ElMessage.error('保存失败'); + } + return res; + }, +}; +export default { + state, + getters, + mutations, + actions, +}; diff --git a/src/views/operation/limit/product.vue b/src/views/operation/limit/product.vue index 2e6fdcc..b8e2bf1 100644 --- a/src/views/operation/limit/product.vue +++ b/src/views/operation/limit/product.vue @@ -34,12 +34,14 @@ + + + diff --git a/src/views/operation/recommend/index.vue b/src/views/operation/recommend/index.vue index 9151e12..795126b 100644 --- a/src/views/operation/recommend/index.vue +++ b/src/views/operation/recommend/index.vue @@ -108,12 +108,12 @@ label: '商品图片', minWidth: 100, slots: { - default: ({ row }) => , + default: ({ row }) => , }, }, { label: '商品名称', - prop: 'name', + prop: 'productName', minWidth: 160, }, { @@ -126,7 +126,7 @@ { label: '操作', fixed: 'right', - width: 300, + width: 100, slots: { default: ({ row }) => (
diff --git a/src/views/sales/product/form/step2.vue b/src/views/sales/product/form/step2.vue index ac0df44..aa44bca 100644 --- a/src/views/sales/product/form/step2.vue +++ b/src/views/sales/product/form/step2.vue @@ -284,7 +284,9 @@ }); await store.dispatch('productSkus/save', { id: route.params.id, data }); if (enable) { - // + let product = await store.dispatch('product/detail', route.params.id); + product.isEnable = true; + await store.dispatch('product/save', product); } await handleLoad(); }