|
@@ -37,7 +37,7 @@
|
|
|
:src="scope.row.good_thumb_img"
|
|
|
style="display: inline-block; width: 100%; height: 100%"
|
|
|
alt
|
|
|
- />
|
|
|
+ >
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -51,7 +51,7 @@
|
|
|
:type="scope.row.good_type == '1' ? '' : 'warning'"
|
|
|
v-text="
|
|
|
(options1.find((item) => item.id == scope.row.status) || {}).name ||
|
|
|
- '--'
|
|
|
+ '--'
|
|
|
"
|
|
|
/>
|
|
|
</template>
|
|
@@ -86,8 +86,12 @@
|
|
|
|
|
|
<el-form-item label="定价模式" prop="is_fixed">
|
|
|
<el-select v-model="ruleForm.is_fixed" style="width:100%">
|
|
|
- <el-option label="一口价" value="1" />
|
|
|
- <el-option label="实时金价" value="0" />
|
|
|
+ <el-option
|
|
|
+ v-for="p in pricingOptions"
|
|
|
+ :key="p.value"
|
|
|
+ :value="p.value"
|
|
|
+ :label="p.label"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
@@ -115,7 +119,7 @@
|
|
|
<el-button v-if="id !== '007'" type="primary" :size="'mini'" @click="submitForm">保 存</el-button>
|
|
|
<el-button :size="'mini'" @click="showModelThis = false">
|
|
|
{{
|
|
|
- id == "007" ? "关 闭" : "取 消"
|
|
|
+ id == "007" ? "关 闭" : "取 消"
|
|
|
}}
|
|
|
</el-button>
|
|
|
</el-col>
|
|
@@ -127,163 +131,174 @@
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import asyncRequest from "@/apis/service/goodStore/goodsCost";
|
|
|
-import resToken from "@/mixins/resToken";
|
|
|
-import { replaceTextWrapAndSpace } from "@/utils";
|
|
|
+import asyncRequest from '@/apis/service/goodStore/goodsCost'
|
|
|
+import resToken from '@/mixins/resToken'
|
|
|
+import { replaceTextWrapAndSpace } from '@/utils'
|
|
|
export default {
|
|
|
- name: "Brand",
|
|
|
+ name: 'Brand',
|
|
|
mixins: [resToken],
|
|
|
- props: ["showModel", "id", "sitem"],
|
|
|
+ props: ['showModel', 'id', 'sitem', 'isNobleMetal'],
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
showModelThis: this.showModel,
|
|
|
ruleForm: {
|
|
|
- platform: "", // string 平台id
|
|
|
- is_fixed: "", // string 定价模式
|
|
|
- online_reason: "", // string 上线原因
|
|
|
- online_remark: "" // string 上线备注
|
|
|
+ platform: '', // string 平台id
|
|
|
+ is_fixed: '', // string 定价模式
|
|
|
+ online_reason: '', // string 上线原因
|
|
|
+ online_remark: '' // string 上线备注
|
|
|
},
|
|
|
// 是否定制
|
|
|
options1: [
|
|
|
- { id: "0", name: "否" },
|
|
|
- { id: "1", name: "是" }
|
|
|
+ { id: '0', name: '否' },
|
|
|
+ { id: '1', name: '是' }
|
|
|
],
|
|
|
rulesThis: this.rules,
|
|
|
rules: {
|
|
|
platform: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择所属平台",
|
|
|
- trigger: "change"
|
|
|
+ message: '请选择所属平台',
|
|
|
+ trigger: 'change'
|
|
|
}
|
|
|
],
|
|
|
is_fixed: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择定价模式",
|
|
|
- trigger: "change"
|
|
|
+ message: '请选择定价模式',
|
|
|
+ trigger: 'change'
|
|
|
}
|
|
|
],
|
|
|
online_reason: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "上线原因不能为空",
|
|
|
- trigger: "blur"
|
|
|
+ message: '上线原因不能为空',
|
|
|
+ trigger: 'blur'
|
|
|
}
|
|
|
],
|
|
|
online_remark: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "上线备注不能为空",
|
|
|
- trigger: "blur"
|
|
|
+ message: '上线备注不能为空',
|
|
|
+ trigger: 'blur'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ pricingOptions() {
|
|
|
+ const inm = this.isNobleMetal
|
|
|
+ return ([
|
|
|
+ { value: '1', label: '一口价' },
|
|
|
+ ...(inm ? [{ value: '0', label: '实时金价' }] : [])
|
|
|
+ ])
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
showModel: function(val) {
|
|
|
- this.showModelThis = val;
|
|
|
+ this.showModelThis = val
|
|
|
if (val) {
|
|
|
- this.initForm();
|
|
|
+ this.initForm()
|
|
|
}
|
|
|
},
|
|
|
showModelThis(val) {
|
|
|
if (!val) {
|
|
|
- this.$emit("cancel");
|
|
|
+ this.$emit('cancel')
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
async initForm() {
|
|
|
- this.loading = true;
|
|
|
- this.rulesThis = this.rules;
|
|
|
- await this.resetForm();
|
|
|
- this.loading = false;
|
|
|
+ this.loading = true
|
|
|
+ this.rulesThis = this.rules
|
|
|
+ await this.resetForm()
|
|
|
+ this.loading = false
|
|
|
},
|
|
|
async resetForm() {
|
|
|
// 重置
|
|
|
await this.$nextTick(() => {
|
|
|
if (this.$refs.ruleForm) {
|
|
|
- this.$refs.ruleForm.resetFields();
|
|
|
- this.$refs.ruleForm.clearValidate();
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ this.$refs.ruleForm.clearValidate()
|
|
|
this.ruleForm = {
|
|
|
- platform: "", // string 平台id
|
|
|
- online_reason: "", // string 上线原因
|
|
|
- online_remark: "" // string 上线备注
|
|
|
- };
|
|
|
+ platform: '', // string 平台id
|
|
|
+ online_reason: '', // string 上线原因
|
|
|
+ online_remark: '' // string 上线备注
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
platform_codesearchChange(e) {
|
|
|
- const { id, code, label } = e;
|
|
|
- this.ruleForm.platform = id || "";
|
|
|
- this.$refs.ruleForm.validateField("platform");
|
|
|
+ const { id, code, label } = e
|
|
|
+ this.ruleForm.platform = id || ''
|
|
|
+ this.$refs.ruleForm.validateField('platform')
|
|
|
},
|
|
|
async submitForm() {
|
|
|
this.ruleForm.online_remark = replaceTextWrapAndSpace(
|
|
|
this.ruleForm.online_remark
|
|
|
- );
|
|
|
+ )
|
|
|
await this.$refs.ruleForm.validate(async valid => {
|
|
|
if (valid) {
|
|
|
if (!this.loading) {
|
|
|
- this.loading = true;
|
|
|
- const model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
+ this.loading = true
|
|
|
+ const model = JSON.parse(JSON.stringify(this.ruleForm))
|
|
|
// model.platform = model.platform.toString();
|
|
|
- model.codes = [];
|
|
|
- const list = JSON.parse(JSON.stringify(this.sitem));
|
|
|
+ model.codes = []
|
|
|
+ const list = JSON.parse(JSON.stringify(this.sitem))
|
|
|
list.forEach(e => {
|
|
|
- model.codes.push(e.spuCode);
|
|
|
- });
|
|
|
+ model.codes.push(e.spuCode)
|
|
|
+ })
|
|
|
const { code, data, message } = await asyncRequest.online_add(
|
|
|
model
|
|
|
- );
|
|
|
- this.loading = false;
|
|
|
+ )
|
|
|
+ this.loading = false
|
|
|
if (code === 0) {
|
|
|
this.$notify.success({
|
|
|
- title: "已成功添加至上线流程!",
|
|
|
- message: ""
|
|
|
- });
|
|
|
- this.showModelThis = false;
|
|
|
+ title: '已成功添加至上线流程!',
|
|
|
+ message: ''
|
|
|
+ })
|
|
|
+ this.showModelThis = false
|
|
|
// 刷新
|
|
|
- this.$emit("refresh");
|
|
|
+ this.$emit('refresh')
|
|
|
} else if (code >= 100 && code <= 104) {
|
|
|
- await this.logout();
|
|
|
+ await this.logout()
|
|
|
+ } else if (message === '一口价商品请先完善商品成本单价') {
|
|
|
+ this.$message.warning(message)
|
|
|
} else if (code === 1004) {
|
|
|
this.open_show(
|
|
|
data,
|
|
|
- "以下商品的业务公司和平台支付渠道中的业务公司重复,不允许上线"
|
|
|
- );
|
|
|
+ '以下商品的业务公司和平台支付渠道中的业务公司重复,不允许上线'
|
|
|
+ )
|
|
|
} else if (code === 1009) {
|
|
|
- this.open_show(data, "以下商品已申请过商品上线!");
|
|
|
+ this.open_show(data, '以下商品已申请过商品上线!')
|
|
|
} else if (code === 1010) {
|
|
|
- this.open_show(data, "该平台要求商品必须要有一件的成本!");
|
|
|
+ this.open_show(data, '该平台要求商品必须要有一件的成本!')
|
|
|
} else {
|
|
|
- this.$message.warning(message);
|
|
|
+ this.$message.warning(message)
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
open_show(data, title) {
|
|
|
- const resList = JSON.parse(JSON.stringify(data));
|
|
|
- let htmlList = "<ul>";
|
|
|
+ const resList = JSON.parse(JSON.stringify(data))
|
|
|
+ let htmlList = '<ul>'
|
|
|
resList.forEach(v => {
|
|
|
htmlList += `<li>
|
|
|
- <span>${v.good_name}</span></li>`;
|
|
|
- });
|
|
|
- htmlList += "</ul>";
|
|
|
+ <span>${v.good_name}</span></li>`
|
|
|
+ })
|
|
|
+ htmlList += '</ul>'
|
|
|
this.$notify({
|
|
|
title: title,
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
message: htmlList
|
|
|
- });
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|