diff --git a/.env.test b/.env.test
index 4204265..2e0cf99 100644
--- a/.env.test
+++ b/.env.test
@@ -1,2 +1,2 @@
-VITE_BASE_URL=http://k8s-horse-gateway.mashibing.cn/
+VITE_BASE_URL=https://k8s-horse-gateway.mashibing.cn/
VITE_REQUEST_TIMEOUT=20000
diff --git a/src/api/sales/product.js b/src/api/sales/product.js
index fffc06c..733af3a 100644
--- a/src/api/sales/product.js
+++ b/src/api/sales/product.js
@@ -50,7 +50,7 @@ export const createAttrs = (data) => {
export const updateAttrs = (data) => {
return request({
url: '/mall/product/admin/productAttributeGroup/' + data.id,
- method: 'post',
+ method: 'put',
data,
});
};
@@ -78,7 +78,7 @@ export const createAttrsValue = (data) => {
export const updateAttrsValue = (data) => {
return request({
url: '/mall/product/admin/productAttribute/' + data.id,
- method: 'post',
+ method: 'put',
data,
});
};
diff --git a/src/store/modules/operation/recommend/recommendProduct.js b/src/store/modules/operation/recommend/recommendProduct.js
index 069e09f..283ed14 100644
--- a/src/store/modules/operation/recommend/recommendProduct.js
+++ b/src/store/modules/operation/recommend/recommendProduct.js
@@ -51,8 +51,7 @@ const actions = {
return res;
},
save: async ({ dispatch }, data) => {
- let save = data.id ? api.update : api.create;
- let res = await save(data);
+ let res = await api.create(data);
if (res) {
ElMessage.success('保存成功');
dispatch('search');
diff --git a/src/store/modules/sales/productAttrsGroup.js b/src/store/modules/sales/productAttrsGroup.js
index 85be335..fdf24d9 100644
--- a/src/store/modules/sales/productAttrsGroup.js
+++ b/src/store/modules/sales/productAttrsGroup.js
@@ -28,7 +28,7 @@ const actions = {
} else {
try {
await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作');
- let res = await api.remove({ id: ids.join(',') });
+ let res = await api.removeAttrs({ id: ids.join(',') });
if (res) {
ElMessage.success('删除成功');
dispatch('search');
diff --git a/src/store/modules/sales/productAttrsValue.js b/src/store/modules/sales/productAttrsValue.js
new file mode 100644
index 0000000..605bbb5
--- /dev/null
+++ b/src/store/modules/sales/productAttrsValue.js
@@ -0,0 +1,49 @@
+import * as api from '@/api/sales/product.js';
+import { ElMessage, ElMessageBox } from '@/plugins/element-plus';
+const state = () => ({});
+const getters = {};
+const mutations = {};
+const actions = {
+ search: async (context, id) => {
+ let res = await api.searchAttrsValue(id);
+ if (!res) {
+ ElMessage.error('查询商品属性分组列表失败');
+ }
+ return res || [];
+ },
+ save: async ({ dispatch }, data) => {
+ let save = data.id ? api.updateAttrsValue : api.createAttrsValue;
+ let res = await save(data);
+ if (res) {
+ ElMessage.success('保存成功');
+ dispatch('search');
+ } else {
+ ElMessage.error('保存失败');
+ }
+ return res;
+ },
+ remove: async ({ dispatch }, ids) => {
+ if (!ids.length) {
+ ElMessage.warning('请选择要删除的数据');
+ } else {
+ try {
+ await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作');
+ let res = await api.removeAttrsValue({ id: ids.join(',') });
+ if (res) {
+ ElMessage.success('删除成功');
+ dispatch('search');
+ } else {
+ ElMessage.error('删除失败');
+ }
+ } catch (e) {
+ console.info('取消删除', e);
+ }
+ }
+ },
+};
+export default {
+ state,
+ getters,
+ mutations,
+ actions,
+};
diff --git a/src/store/modules/sales/productPicker.js b/src/store/modules/sales/productPicker.js
index 4e10d31..8ce277a 100644
--- a/src/store/modules/sales/productPicker.js
+++ b/src/store/modules/sales/productPicker.js
@@ -1,10 +1,9 @@
-import * as api from '@/api/sales/category.js';
+import * as categoryAPI from '@/api/sales/category.js';
+import * as api from '@/api/sales/product.js';
import { ElMessage } from '@/plugins/element-plus';
const state = () => ({
code: 'ProductPicker',
- condition: {
- orderIs: [],
- },
+ condition: {},
list: [],
total: 0,
summary: [],
@@ -23,9 +22,10 @@ const mutations = {
setOpts: (state, data) => (state.opts = data),
};
const actions = {
- search: async ({ state, commit }) => {
- let res = await api.search(state.condition);
- commit('setList', res);
+ search: async ({ state, commit, rootGetters }) => {
+ let res = await api.search({ ...rootGetters['local/page'](state.code), ...state.condition });
+ commit('setList', res?.records || []);
+ commit('setTotal', res?.total || 0);
if (!res) {
ElMessage.error('查询商品列表失败');
}
@@ -35,7 +35,7 @@ const actions = {
commit('setOpts', {
...state.opts,
init: true,
- category: await api.search(),
+ category: await categoryAPI.search({ pageIndex: 1, length: 9999 }),
});
},
};
diff --git a/src/views/global/login.vue b/src/views/global/login.vue
index 326a9a2..83cfd3b 100644
--- a/src/views/global/login.vue
+++ b/src/views/global/login.vue
@@ -52,6 +52,8 @@
phone: '',
password: '',
verifyCode: '',
+ systemId: 1,
+ clientId: 2,
});
const rules = reactive({
diff --git a/src/views/operation/limit/index.vue b/src/views/operation/limit/index.vue
index 4ce2db7..9fa1428 100644
--- a/src/views/operation/limit/index.vue
+++ b/src/views/operation/limit/index.vue
@@ -80,6 +80,7 @@
await store.dispatch('limitActivity/search');
loading.value = false;
};
+ onActivated(handleSearch);
/* 表单 */
const refsForm = ref(null);
@@ -191,10 +192,18 @@
slots: {
default: ({ row }) => (
-
handleUpdateTime(row)}>
+ handleUpdateTime(row)}
+ >
设置时段
- handleUpdateProduct(row)}>
+ handleUpdateProduct(row)}
+ >
设置商品
handleCreate(row)}>
diff --git a/src/views/operation/limit/product.vue b/src/views/operation/limit/product.vue
index 8b2b4a8..2e6fdcc 100644
--- a/src/views/operation/limit/product.vue
+++ b/src/views/operation/limit/product.vue
@@ -33,7 +33,7 @@
-
+
@@ -47,9 +47,6 @@
const list = computed(() => store.state.limitProduct.list);
const total = computed(() => store.state.limitProduct.total);
const opts = computed(() => store.state.limitProduct.opts);
- if (!unref(opts).init) {
- store.dispatch('limitProduct/load', route.params.id);
- }
/* 查询订单 */
const state = reactive({
@@ -68,6 +65,7 @@
};
const handleSearch = async () => {
loading.value = true;
+ await store.dispatch('limitProduct/load', route.params.id);
await store.dispatch('limitProduct/search');
loading.value = false;
};
@@ -92,6 +90,7 @@
},
{ deep: true }
);
+ onActivated(handleSearch);
const refsPicker = ref(null);
const handleCreate = async () => {
@@ -106,6 +105,14 @@
const handleSku = (row) => {
console.info(row);
};
+ const handlePick = async (rows) => {
+ loading.value = true;
+ await store.dispatch('limitProduct/save', {
+ activityTimeId: state.condition.activityTimeId,
+ productId: rows.map((item) => item.id),
+ });
+ loading.value = false;
+ };
/* 列表配置 */
const config = reactive({
diff --git a/src/views/operation/recommend/index.vue b/src/views/operation/recommend/index.vue
index 83ddeb4..9151e12 100644
--- a/src/views/operation/recommend/index.vue
+++ b/src/views/operation/recommend/index.vue
@@ -75,7 +75,9 @@
};
// 保存
const handlePick = async (rows) => {
- console.info(rows);
+ loading.value = true;
+ await store.dispatch('recommendProduct/save', { productIdList: rows.map((item) => item.id) });
+ loading.value = false;
};
/* 操作 */
diff --git a/src/views/sales/product/form/step2.vue b/src/views/sales/product/form/step2.vue
index 25ac74c..d39ef6c 100644
--- a/src/views/sales/product/form/step2.vue
+++ b/src/views/sales/product/form/step2.vue
@@ -1,70 +1,72 @@
-
- -
- 属性规格:
+
+
-
- -
-
-
{{ sku.name }}:
-
- {{ item }}
-
-
-
-
-
-
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ 上移
+
+ 下移
+
+ 删除
+
-
- 上移
-
- 下移
-
- 删除
-
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
@@ -103,7 +105,15 @@
const id = route.params.id;
if (id && id !== state.form.id) {
state.form.id = id;
- state.form.skus = await store.dispatch('productAttrsGroup/search', id);
+ let res = await store.dispatch('productAttrsGroup/search', id);
+ let arr = [];
+ res.forEach((item) => {
+ arr.push(
+ store.dispatch('productAttrsValue/search', item.id).then((res) => (item.values = res))
+ );
+ });
+ await Promise.all(arr);
+ state.form.skus = res;
}
};
onActivated(handleLoad);
@@ -114,8 +124,8 @@
(info, sku) => {
let res = [];
info.forEach((row) => {
- sku.values.forEach((value) => {
- res.push({ ...row, ['attr' + state.form.skus.indexOf(sku)]: value });
+ (sku.values || []).forEach((value) => {
+ res.push({ ...row, [sku.id + '']: value.name });
});
});
return res;
@@ -194,31 +204,21 @@
.flex {
width: 100%;
display: flex;
- flex-direction: column;
+ justify-content: space-between;
.el-input {
width: 160px;
}
- li {
- align-items: center;
- &:not(:first-child) {
- justify-content: space-between;
+ .el-tag {
+ + .el-tag {
+ margin-left: @layout-space;
}
- .el-tag {
- + .el-tag {
- margin-left: @layout-space;
- }
- + .el-input {
- margin-left: @layout-space;
- }
- }
- + li {
- margin-top: @layout-space;
+ + .el-input {
+ margin-left: @layout-space;
}
}
}
- .label {
- word-break: keep-all;
- margin-right: @layout-space;
+ .el-input-number {
+ width: 100%;
}
}
.step-footer {
diff --git a/src/views/sales/product/picker.vue b/src/views/sales/product/picker.vue
index 12e8b72..9875e47 100644
--- a/src/views/sales/product/picker.vue
+++ b/src/views/sales/product/picker.vue
@@ -16,9 +16,9 @@
-
+
@@ -51,8 +51,9 @@
const state = reactive({
condition: {
name: null,
- category: null,
+ categoryId: null,
},
+ picked: null,
});
watch(
() => state.condition,
@@ -64,7 +65,7 @@
const handleReset = () => {
state.condition = {
name: null,
- category: null,
+ categoryId: null,
};
};
const handleSearch = async () => {
@@ -77,6 +78,7 @@
// 显示
const handleShow = () => {
visible.value = true;
+ handleSearch();
};
// 取消
const handleClose = () => {
@@ -85,6 +87,7 @@
// 确定
const handlePick = async () => {
emits('pick', [...unref(refsTable).selection]);
+ handleClose();
};
defineExpose({
show: handleShow,
@@ -108,7 +111,7 @@
label: '商品图片',
minWidth: 100,
slots: {
- default: ({ row }) => ,
+ default: ({ row }) => ,
},
},
{
@@ -118,7 +121,7 @@
},
{
label: '商品价格',
- prop: 'price',
+ prop: 'startingPrice',
minWidth: 160,
},
],
diff --git a/vite.config.js b/vite.config.js
index 49a1a08..5c22475 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -22,7 +22,7 @@ export default (configEnv) => {
'/api': {
// target: 'http://192.168.10.109:8090/', // 显雨
// target: 'http://192.168.10.251:8090', // 高玉
- target: 'http://k8s-horse-gateway.mashibing.cn/', // 测试地址
+ target: 'https://k8s-horse-gateway.mashibing.cn/', // 测试地址
// target: 'https://gateway.mashibing.cn', // 预发地址
// target: 'https://gateway.mashibing.com', // 生产环境
changeOrigin: true,