|
@@ -1,14 +1,14 @@
|
|
|
<template>
|
|
|
<el-form label-width="90px" size="mini">
|
|
|
- <el-form-item label="组合商品">
|
|
|
+ <el-form-item v-loading="loading.product" label="组合商品">
|
|
|
<el-input v-if="!productinfo" placeholder="选择组合商品" @focus="pVisible = true" />
|
|
|
|
|
|
- <div v-else style="display:flex" key="product">
|
|
|
+ <div v-else key="product" style="display:flex">
|
|
|
<show-data-table border :columns="productColumns" :sitem="productinfo">
|
|
|
<template slot="packing_spec">
|
|
|
<el-tag
|
|
|
size="mini"
|
|
|
- >{{ ( options6.find(({id}) => id === productinfo && productinfo.supply_area) || {}).name || '--' }}</el-tag>
|
|
|
+ >{{ ( options6.find(({id}) => id === productinfo.supply_area) || {}).name || '--' }}</el-tag>
|
|
|
</template>
|
|
|
|
|
|
<template slot="is_auth">
|
|
@@ -29,9 +29,9 @@
|
|
|
|
|
|
<template slot="cat_info">
|
|
|
{{
|
|
|
- productinfo.cat_info
|
|
|
- ? productinfo.cat_info.map(({ name }) => name).join("_")
|
|
|
- : "--"
|
|
|
+ productinfo.cat_info
|
|
|
+ ? productinfo.cat_info.map(({ name }) => name).join("_")
|
|
|
+ : "--"
|
|
|
}}
|
|
|
</template>
|
|
|
|
|
@@ -43,7 +43,7 @@
|
|
|
class="fl"
|
|
|
:src="productinfo.good_thumb_img"
|
|
|
alt
|
|
|
- />
|
|
|
+ >
|
|
|
<span>{{ productinfo.good_name }}</span>
|
|
|
<span v-for="(si, i) in productinfo.speclist" :key="si.spec_id + i">
|
|
|
<span v-if="i !== 0">-</span>
|
|
@@ -64,11 +64,11 @@
|
|
|
<template slot="noble">
|
|
|
<span v-if="productinfo.noble_metal">
|
|
|
{{ productinfo.noble_weight ? productinfo.noble_weight : "0" }}g-{{
|
|
|
- productinfo.noble_name
|
|
|
+ productinfo.noble_name
|
|
|
}}-{{ productinfo.gold_price ? productinfo.gold_price : "0" }}元/g-{{
|
|
|
- productinfo.is_gold_price + "" === "0" ? "不" : ""
|
|
|
+ productinfo.is_gold_price + "" === "0" ? "不" : ""
|
|
|
}}启用实时金价-{{ productinfo.is_diff + "" === "1" ? "有" : "无" }}工差-{{
|
|
|
- productinfo.config
|
|
|
+ productinfo.config
|
|
|
}}-{{ productinfo.other_config }}
|
|
|
</span>
|
|
|
</template>
|
|
@@ -82,12 +82,12 @@
|
|
|
<template slot="noble_weight">{{ productinfo.noble_weight }}g</template>
|
|
|
<template slot="is_gold_price">
|
|
|
{{
|
|
|
- String(productinfo.is_gold_price) === "1" ? "是" : "否"
|
|
|
+ String(productinfo.is_gold_price) === "1" ? "是" : "否"
|
|
|
}}
|
|
|
</template>
|
|
|
<template slot="is_diff">
|
|
|
{{
|
|
|
- String(productinfo.is_diff) === "1" ? "有公差" : "无工差"
|
|
|
+ String(productinfo.is_diff) === "1" ? "有公差" : "无工差"
|
|
|
}}
|
|
|
</template>
|
|
|
|
|
@@ -100,26 +100,26 @@
|
|
|
<template slot="origin_place">{{ origin_place }}</template>
|
|
|
</show-data-table>
|
|
|
|
|
|
- <el-tooltip content="重新选择组合商品" placement="top" v-if="type !== 'view'">
|
|
|
+ <el-tooltip v-if="type !== 'view'" content="重新选择组合商品" placement="top">
|
|
|
<i
|
|
|
class="el-icon-circle-close"
|
|
|
- @click="resetProduct"
|
|
|
style="cursor:pointer;font-size:18px;margin-left:10px"
|
|
|
+ @click="resetProduct"
|
|
|
/>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="所在仓库">
|
|
|
+ <el-form-item v-loading="loading.stock" label="所在仓库">
|
|
|
<el-input v-if="!stockinfo" placeholder="选择所在仓库" @focus="sVisible = true" />
|
|
|
|
|
|
- <div v-else style="display:flex" key="stock">
|
|
|
+ <div v-else key="stock" style="display:flex">
|
|
|
<show-data-table border :columns="stockColumns" :sitem="stockinfo" />
|
|
|
<el-tooltip content="重新选择仓库" placement="top">
|
|
|
<i
|
|
|
class="el-icon-circle-close"
|
|
|
- @click="resetStock"
|
|
|
style="cursor:pointer;font-size:18px;margin-left:10px"
|
|
|
+ @click="resetStock"
|
|
|
/>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
@@ -170,7 +170,7 @@
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag size="mini">
|
|
|
{{
|
|
|
- (isStockOptions.find(({value}) => value === scope.row.goodType) || {}).label || '--'
|
|
|
+ (isStockOptions.find(({value}) => value === scope.row.goodType) || {}).label || '--'
|
|
|
}}
|
|
|
</el-tag>
|
|
|
</template>
|
|
@@ -194,16 +194,16 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import StockModal from "./stockModal.vue";
|
|
|
-import ProductModal from "./productModal.vue";
|
|
|
-import asyncRequest from "@/apis/service/sellOut/combindAdd";
|
|
|
-import { stockColumns, productColumns } from "./columnsForm";
|
|
|
-import privateField from "@/mixins/privateField";
|
|
|
+import StockModal from './stockModal.vue'
|
|
|
+import ProductModal from './productModal.vue'
|
|
|
+import asyncRequest from '@/apis/service/sellOut/combindAdd'
|
|
|
+import { stockColumns, productColumns } from './columnsForm'
|
|
|
+import privateField from '@/mixins/privateField'
|
|
|
|
|
|
export default {
|
|
|
- name: "BaseForm",
|
|
|
- mixins: [privateField],
|
|
|
+ name: 'BaseForm',
|
|
|
components: { StockModal, ProductModal },
|
|
|
+ mixins: [privateField],
|
|
|
data() {
|
|
|
return {
|
|
|
stockColumns,
|
|
@@ -212,68 +212,103 @@ export default {
|
|
|
pVisible: false,
|
|
|
stockinfo: null,
|
|
|
productinfo: null,
|
|
|
+ loading: {
|
|
|
+ product: false,
|
|
|
+ stock: false
|
|
|
+ },
|
|
|
ruleForm: {
|
|
|
stock_moq: 0,
|
|
|
can_stock: 0
|
|
|
},
|
|
|
options6: [
|
|
|
- { id: "1", name: "全国" },
|
|
|
- { id: "2", name: "全国除偏远" }
|
|
|
+ { id: '1', name: '全国' },
|
|
|
+ { id: '2', name: '全国除偏远' }
|
|
|
],
|
|
|
options3: [
|
|
|
- { id: "0", name: "无销售权限" },
|
|
|
- { id: "1", name: "有销售权限" }
|
|
|
+ { id: '0', name: '无销售权限' },
|
|
|
+ { id: '1', name: '有销售权限' }
|
|
|
]
|
|
|
- };
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
number_change(e) {
|
|
|
- this.ruleForm[key] = e;
|
|
|
+ this.ruleForm[key] = e
|
|
|
},
|
|
|
resetStock() {
|
|
|
- this.stockinfo = null;
|
|
|
+ this.stockinfo = null
|
|
|
},
|
|
|
resetProduct() {
|
|
|
- this.productinfo = null;
|
|
|
+ this.productinfo = null
|
|
|
+ },
|
|
|
+ async getArea(prop = 'delivery_place') {
|
|
|
+ const chunks = this.sitem[prop].split(',')
|
|
|
+ let { data: province } = await asyncRequest.province()
|
|
|
+ province = province.find(
|
|
|
+ ({ province_code }) => province_code === chunks[0]
|
|
|
+ )
|
|
|
+ let { data: city } = await asyncRequest.city({ code: chunks[0] })
|
|
|
+ city = city.find(({ city_code }) => city_code === chunks[1])
|
|
|
+ const { data: area } = await asyncRequest.area({ code: chunks[1] })
|
|
|
+ return area.find(({ area_code }) => area_code === chunks[2]) || {}
|
|
|
},
|
|
|
async handleStockSelected(evt) {
|
|
|
- const { id } = evt;
|
|
|
- const { code, data } = await asyncRequest.stockinfo({ id });
|
|
|
- if (code !== 0) return;
|
|
|
- const { addr_code, addrs_code } = data;
|
|
|
+ const { id } = evt
|
|
|
+ this.loading.stock = true
|
|
|
+ const { code, data } = await asyncRequest.stockinfo({ id })
|
|
|
+ if (code !== 0) return
|
|
|
+ const { addr_code, addrs_code } = data
|
|
|
|
|
|
- const { city_code: sourceCodeL2, area_code: sourceCodeL3 } = addr_code;
|
|
|
- const { city_code: targetCodeL2, area_code: targetCodeL3 } = addrs_code;
|
|
|
+ const { city_code: sourceCodeL2, area_code: sourceCodeL3 } = addr_code
|
|
|
+ const { city_code: targetCodeL2, area_code: targetCodeL3 } = addrs_code
|
|
|
|
|
|
const { code: _co1, data: _d1 } = await asyncRequest.addrquery({
|
|
|
code: sourceCodeL2,
|
|
|
level: 3
|
|
|
- });
|
|
|
+ })
|
|
|
|
|
|
const { code: _co2, data: _d2 } = await asyncRequest.addrquery({
|
|
|
code: targetCodeL2,
|
|
|
level: 3
|
|
|
- });
|
|
|
+ })
|
|
|
+
|
|
|
+ this.loading.stock = false
|
|
|
|
|
|
if (_co1 === 0) {
|
|
|
- const d1 = _d1.find(item => item.code === sourceCodeL3);
|
|
|
- const { area: _a1, city: _c1, province: _p1 } = (d1 || {}).info || {};
|
|
|
- data.source = [_p1, _c1, _a1].map(({ name }) => name).join("");
|
|
|
+ const d1 = _d1.find(item => item.code === sourceCodeL3)
|
|
|
+ const { area: _a1, city: _c1, province: _p1 } = (d1 || {}).info || {}
|
|
|
+ data.source = [_p1, _c1, _a1].map(({ name }) => name).join('')
|
|
|
}
|
|
|
|
|
|
if (_co2 === 0) {
|
|
|
- const d2 = _d2.find(item => item.code === targetCodeL3);
|
|
|
- const { area: _a2, city: _c2, province: _p2 } = (d2 || {}).info || {};
|
|
|
- data.target = [_p2, _c2, _a2].map(({ name }) => name).join("");
|
|
|
+ const d2 = _d2.find(item => item.code === targetCodeL3)
|
|
|
+ const { area: _a2, city: _c2, province: _p2 } = (d2 || {}).info || {}
|
|
|
+ data.target = [_p2, _c2, _a2].map(({ name }) => name).join('')
|
|
|
}
|
|
|
|
|
|
- this.stockinfo = data;
|
|
|
+ this.stockinfo = data
|
|
|
+ },
|
|
|
+ async getArea(prop = 'delivery_place') {
|
|
|
+ const chunks = this.productinfo[prop].split(',')
|
|
|
+ let { data: province } = await asyncRequest.province()
|
|
|
+ province = province.find(
|
|
|
+ ({ province_code }) => province_code === chunks[0]
|
|
|
+ )
|
|
|
+ let { data: city } = await asyncRequest.city({ code: chunks[0] })
|
|
|
+ city = city.find(({ city_code }) => city_code === chunks[1])
|
|
|
+ let { data: area } = await asyncRequest.area({ code: chunks[1] })
|
|
|
+ area = area.find(({ area_code }) => area_code === chunks[2]) || {}
|
|
|
+ return [province, city, area].map(({ name }) => name).join('')
|
|
|
},
|
|
|
async handleProductSelected(spuCode) {
|
|
|
- const { code, data } = await asyncRequest.productinfo({ spuCode });
|
|
|
- if (code !== 0) return;
|
|
|
- this.productinfo = data;
|
|
|
+ this.loading.product = true
|
|
|
+ const { code, data } = await asyncRequest.productinfo({ spuCode })
|
|
|
+ this.productinfo = data
|
|
|
+ this.delivery_place = await this.getArea('delivery_place')
|
|
|
+ this.origin_place = await this.getArea('origin_place')
|
|
|
+ console.log(this.origin_place)
|
|
|
+ this.loading.product = false
|
|
|
+ if (code !== 0) return
|
|
|
}
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
</script>
|