|
@@ -114,6 +114,7 @@ const _ = require('lodash');
|
|
|
import methodsUtil from '@/util/opera';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: goods } = createNamespacedHelpers('goods');
|
|
|
+const { mapActions: goodsSpec } = createNamespacedHelpers('goodsSpec');
|
|
|
const { mapActions: goodsTags } = createNamespacedHelpers('goodsTags');
|
|
|
const { mapActions: dictData } = createNamespacedHelpers('dictData');
|
|
|
const { mapActions: actTags } = createNamespacedHelpers('actTags');
|
|
@@ -158,7 +159,7 @@ export default {
|
|
|
{ label: '活动标签', model: 'act_tags', type: 'selectMany' },
|
|
|
{ label: '简短简介', model: 'shot_brief', maxLength: 50 },
|
|
|
{ label: '预计发货时间', model: 'send_time' },
|
|
|
- { label: '商品状态', model: 'status', type: 'select' },
|
|
|
+ // { label: '商品状态', model: 'status', type: 'select' },
|
|
|
{ label: '商品来源', model: 'source' },
|
|
|
{ label: '网址', model: 'url' },
|
|
|
{ label: '排序', model: 'sort', type: 'number' },
|
|
@@ -207,6 +208,7 @@ export default {
|
|
|
...goodsTags(['tree']),
|
|
|
...shop({ shopQuery: 'query', shopFetch: 'fetch' }),
|
|
|
...goods(['copy', 'query', 'delete', 'fetch', 'update', 'create']),
|
|
|
+ ...goodsSpec({ specQuery: 'query' }),
|
|
|
...methodsUtil,
|
|
|
toSearch() {
|
|
|
this.$refs.dataTable.resetPage();
|
|
@@ -369,18 +371,25 @@ export default {
|
|
|
},
|
|
|
// 上架
|
|
|
async toPuton({ data }) {
|
|
|
- this.$confirm('是否确认上架/下架该商品?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- }).then(async () => {
|
|
|
- if (data.status == '1') data.status = '0';
|
|
|
- else data.status = '1';
|
|
|
- let res;
|
|
|
- if (data._id) res = await this.update(data);
|
|
|
- if (this.$checkRes(res)) this.$message({ type: `success`, message: `修改成功` });
|
|
|
- this.search(this.searchQuery);
|
|
|
- });
|
|
|
+ const res = await this.specQuery({ goods: data._id });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ if (res.total > 0) {
|
|
|
+ this.$confirm('是否确认上架/下架该商品?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(async () => {
|
|
|
+ if (data.status == '1') data.status = '0';
|
|
|
+ else data.status = '1';
|
|
|
+ let res;
|
|
|
+ if (data._id) res = await this.update(data);
|
|
|
+ if (this.$checkRes(res)) this.$message({ type: `success`, message: `修改成功` });
|
|
|
+ this.search(this.searchQuery);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({ type: `warning`, message: `该商品没有规格,不允许上架` });
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// 库存管理
|
|
|
toSpec({ data }) {
|