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(); }