From a235982cc92c891b9919127f51f14c756e18cf2d Mon Sep 17 00:00:00 2001
From: wuhui_zzw <1760308791@qq.com>
Date: Tue, 27 Feb 2024 17:05:21 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=95=86=E5=93=81?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=92=8C=E7=BC=96=E8=BE=91=E5=85=BC=E5=AE=B9?=
=?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E5=95=86=E5=93=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/product/addProduct/index.vue | 977 +++++++++++++------------
1 file changed, 517 insertions(+), 460 deletions(-)
diff --git a/src/views/product/addProduct/index.vue b/src/views/product/addProduct/index.vue
index 245dc96..086ad02 100644
--- a/src/views/product/addProduct/index.vue
+++ b/src/views/product/addProduct/index.vue
@@ -2,19 +2,13 @@
-
-
-
+
+
+
+
+
+
+
+ @submit.native.prevent>
+
-
-
+
普通商品
+
(物流发货)
+
+
+ ✓
+
+
+
+
虚拟商品
+
(虚拟发货)
+
+
+ ✓
+
+
+
+
@@ -73,7 +79,7 @@
/>
-
+
-
+
+
+
+
+ 否
+ 是
+
+
+
+
+
+
+
+
+ 一批次等于
+ {{ formValidate.unit_name || '件' }}
+
+
+
+
-
+
-
-
+
选择优惠券
+ >选择优惠券
+
-
+
-
+
-
+
单规格
多规格
@@ -325,12 +343,14 @@
class="ml15"
size="mini"
@click="confirm"
- >确认
+ >确认
+
添加规格模板
+ >添加规格模板
+
@@ -372,7 +392,8 @@
class="button-new-tag"
size="small"
@click="showInput(item)"
- >+ 添加
+ >+ 添加
+
@@ -400,7 +421,8 @@
class="ml15"
size="small"
@click="createAttrName"
- >确定
+ >确定
+
取消
@@ -412,14 +434,16 @@
class="mr15"
size="small"
@click="addBtn"
- >添加新规格
+ >添加新规格
+
立即生成
+ >立即生成
+
@@ -439,7 +463,7 @@
-
{{oneFormBatch[0]['attr']}}
+
{{ oneFormBatch[0]['attr'] }}
@@ -502,7 +526,7 @@
class="priceBox"
disabled
/>
- 添加卡密
+ >添加卡密
+
已设置
@@ -587,7 +612,8 @@
class="submission"
@click="batchAdd"
size="small"
- >批量添加
+ >批量添加
+
@@ -596,12 +622,7 @@
-
+
-
+
-
-
-
-
+ v-if="formThead[iii].title === '库存' && formValidate.type == 2"
+ v-model="scope.row[iii]"
+ type="text"
+ class="priceBox"
+ disabled
+ />
-
+
+
+
+
@@ -692,11 +694,12 @@
min-width="120"
>
- 添加卡密
+ >添加卡密
+
已设置
@@ -854,11 +857,12 @@
min-width="120"
>
- 添加卡密
+ >添加卡密
+
已设置
@@ -918,11 +922,7 @@
-
+
@@ -1002,10 +1002,13 @@
固定数量
- 赠送积分
+ 赠送
+
+ 积分
- %
+
+ %
百分比:当前订单该商品实际支付总金额 * 设置的比例 = 赠送的积分;固定数量:指定数量 * 购买的商品数量 = 赠送的积分
@@ -1029,10 +1032,13 @@
固定数量
- 抵扣元
+ 抵扣
+
+ 元
- %
+
+ %
百分比:当前订单该商品实际支付总金额 * 设置的比例 = 可以抵扣的金额;固定数量:指定数量 * 购买的商品数量 = 可以抵扣的金额
@@ -1042,7 +1048,7 @@
-
+
添加运费模板
+ >添加运费模板
+
@@ -1182,7 +1189,8 @@
class="ml15"
size="small"
@click="addServiceTem"
- >添加服务说明模板
+ >添加服务说明模板
+
@@ -1239,7 +1247,8 @@
type="text"
class="submission"
@click.native.prevent="delSpecs(scope.$index)"
- >删除
+ >删除
+
@@ -1248,7 +1257,8 @@
size="small"
class="mt20"
@click="addSpecs"
- >添加参数
+ >添加参数
+
- 上一步
-
- 下一步
-
- 提交
-
- 预览
-
+ 上一步
+ 下一步
+ 提交
+
@@ -1377,7 +1358,7 @@
-
+
@@ -1406,12 +1387,12 @@ import {
productSpecsDetailApi,
generateAttrApi,
} from '@/api/product'
-import { roterPre } from '@/settings'
+import {roterPre} from '@/settings'
import guaranteeService from '@/components/serviceGuarantee/index'
import previewBox from '@/components/previewBox/index'
import attrList from "@/components/attrList";
import SettingMer from '@/libs/settingMer'
-import { getToken } from '@/utils/auth'
+import {getToken} from '@/utils/auth'
import taoBao from './taoBao'
import copyRecord from './copyRecord'
import addCarMy from "./addCarMy";
@@ -1427,6 +1408,9 @@ const defaultObj = {
mer_cate_id: [], // 商户分类id
param_temp_id: [],
unit_name: '',
+ is_batch: 0, // 是否支持按批购买
+ batch_num: 0, // 一批等于多少
+ batch_unit: '', // 一批的单位
sort: 0,
once_max_count: 0,
is_good: 0,
@@ -1503,7 +1487,7 @@ const objTitle = {
title: '体积(m³)'
}
}
-const proOptions = [{ name: '店铺推荐', value: 'is_good' }]
+const proOptions = [{name: '店铺推荐', value: 'is_good'}]
export default {
name: 'ProductProductAdd',
components: {
@@ -1518,8 +1502,7 @@ export default {
draggable: vuedraggable,
},
data() {
- const url =
- SettingMer.https + '/upload/image/0/file?ueditor=1&token=' + getToken()
+ const url = SettingMer.https + '/upload/image/0/file?ueditor=1&token=' + getToken()
return {
myConfig: {
autoHeightEnabled: false, // 编辑器不自动被内容撑高
@@ -1547,8 +1530,8 @@ export default {
recommend: proOptions,
tabs: [],
fullscreenLoading: false,
- props: { emitPath: false },
- propsMer: { emitPath: true },
+ props: {emitPath: false},
+ propsMer: {emitPath: true},
active: 0,
deduction_set: -1,
OneattrValue: [Object.assign({}, defaultObj.attrValue[0])], // 单规格
@@ -1609,25 +1592,25 @@ export default {
}
],
store_name: [
- { required: true, message: '请输入商品名称', trigger: 'blur' }
+ {required: true, message: '请输入商品名称', trigger: 'blur'}
],
cate_id: [
- { required: true, message: '请选择平台分类', trigger: 'change' }
+ {required: true, message: '请选择平台分类', trigger: 'change'}
],
keyword: [
- { required: true, message: '请输入商品关键字', trigger: 'blur' }
+ {required: true, message: '请输入商品关键字', trigger: 'blur'}
],
- unit_name: [{ required: true, message: '请输入单位', trigger: 'blur' }],
+ unit_name: [{required: true, message: '请输入单位', trigger: 'blur'}],
store_info: [
- { required: true, message: '请输入商品简介', trigger: 'blur' }
+ {required: true, message: '请输入商品简介', trigger: 'blur'}
],
temp_id: [
- { required: true, message: '请选择运费模板', trigger: 'change' }
+ {required: true, message: '请选择运费模板', trigger: 'change'}
],
once_max_count: [
- { required: true, message: '请输入限购数量', trigger: 'change' }
+ {required: true, message: '请输入限购数量', trigger: 'change'}
],
- image: [{ required: true, message: '请上传商品图', trigger: 'change' }],
+ image: [{required: true, message: '请上传商品图', trigger: 'change'}],
slider_image: [
{
required: true,
@@ -1637,10 +1620,10 @@ export default {
}
],
spec_type: [
- { required: true, message: '请选择商品规格', trigger: 'change' }
+ {required: true, message: '请选择商品规格', trigger: 'change'}
],
delivery_way: [
- { required: true, message: '请选择送货方式', trigger: 'change' }
+ {required: true, message: '请选择送货方式', trigger: 'change'}
]
},
attrInfo: {},
@@ -1650,11 +1633,11 @@ export default {
previewVisible: false,
previewKey: '',
deliveryType: [],
- virtual: [
- { tit: '普通商品', id: 0, tit2: '物流发货' },
- { tit: '虚拟商品', id: 1, tit2: '虚拟发货' }
- // { tit: '卡密/网盘', id: 2, tit2: '自动发货' }
- ],
+ // virtual: [
+ // {tit: '普通商品', id: 0, tit2: '物流发货'},
+ // {tit: '虚拟商品', id: 1, tit2: '虚拟发货'}
+ // // { tit: '卡密/网盘', id: 2, tit2: '自动发货' }
+ // ],
customBtn: 0, // 自定义留言开关
// 自定义留言下拉选择
CustomList: [
@@ -1694,14 +1677,6 @@ export default {
customess: {
content: []
}, // 自定义留言内容
- headTab: [
- { title: '商品信息', name: '1' },
- { title: '规格设置', name: '2' },
- { title: '商品详情', name: '3' },
- { title: '营销设置', name: '4' },
- { title: '积分设置', name: '5' },
- { title: '其他设置', name: '6' }
- ],
type: 0,
modals: false,
attrVal: {
@@ -1719,44 +1694,55 @@ export default {
merSpecsSelect: [],
sysSpecsSelect: [],
attrs: [],
- attrsList:[],
- activeAtter:[],
+ attrsList: [],
+ activeAtter: [],
attrShow: false,
isGenerate: false,
createProduct: false,
generateArr: [],
addGenerate: false,
createCount: this.$route.params.id ? 0 : -10,
- virtualList:[],
- carMyShow: false,//是否开启卡密弹窗
+ virtualList: [],
+ carMyShow: false,//是否开启卡密弹窗
tabIndex: 0,
- tabName: "",
- oneFormBatch: [
+ tabName: "",
+ oneFormBatch: [
{
- attr:"全部",
- image: "",
+ attr: "全部",
+ image: "",
price: "",
cost: "",
ot_price: "",
svip_price: "",
stock: "",
cdkey: {},
- code: "",
+ code: "",
weight: "",
volume: "",
},
],
- headerCarMy:{
+ headerCarMy: {
title: "卡密设置",
slot: "fictitious",
align: "center",
width: 95,
},
+ config: {},// 获取商户基本配置
}
},
computed: {
attrValue() {
const obj = Object.assign({}, this.attrVal)
+ if (this.config.merchant_type == 2) {
+ delete obj['cost']
+ delete obj['ot_price']
+ delete obj['bar_code']
+ delete obj['weight']
+ delete obj['volume']
+ }
+ console.log(obj)
+
+
return obj
},
// oneFormBatch() {
@@ -1769,16 +1755,24 @@ export default {
},
watch: {
'formValidate.attr': {
- handler: function(val) {
- this.createCount+=1
+ handler: function (val) {
+ this.createCount += 1
if (this.formValidate.spec_type === 1) this.watCh(val)
},
immediate: false,
deep: true
},
+ 'formValidate.batch_num': {
+ handler: function (val) {
+ let num = this.formValidate.batch_num || 0
+ if (Number(num) > 200) this.formValidate.batch_num = 200
+ },
+ immediate: false,
+ deep: true
+ },
currentTab(newVal) {
if (newVal == 5) {
- this.$nextTick(e=>{
+ this.$nextTick(e => {
this.setSort()
})
}
@@ -1817,7 +1811,10 @@ export default {
} else {
this.type = 0
}
-
+ // 获取配置信息
+ this.$root.getConfig().then((res) => {
+ this.config = res
+ })
},
destroyed() {
window.removeEventListener('popstate', this.goBack, false)
@@ -1830,7 +1827,7 @@ export default {
)[0]
this.sortable = Sortable.create(el, {
ghostClass: 'sortable-ghost',
- setData: function(dataTransfer) {
+ setData: function (dataTransfer) {
dataTransfer.setData('Text', '')
},
// 监听拖拽事件结束时触发
@@ -1866,18 +1863,18 @@ export default {
return doCombinationCallback(arr, 0);//从第一个开始
//js 没有静态数据,为了避免和外部数据混淆,需要使用闭包的形式
function doCombinationCallback(arr, curr_index) {
- for(let val of arr[curr_index]) {
+ for (let val of arr[curr_index]) {
tmp[curr_index] = val;//以curr_index为索引,加入数组
//当前循环下标小于数组总长度,则需要继续调用方法
- if(curr_index < count) {
+ if (curr_index < count) {
doCombinationCallback(arr, curr_index + 1);//继续调用
- }else{
+ } else {
totalArr.push(tmp.join(','));//(直接给push进去,push进去的不是值,而是值的地址)
}
//js 对象都是 地址引用(引用关系),每次都需要重新初始化,否则 totalArr的数据都会是最后一次的 tmp 数据;
let oldTmp = tmp;
tmp = [];
- for(let index of oldTmp) {
+ for (let index of oldTmp) {
tmp.push(index);
}
}
@@ -1885,53 +1882,53 @@ export default {
}
},
//提交属性值;
- subAttrs(e){
- let selectData = [];
- this.attrsList.forEach((el,index)=>{
- let obj = [];
- el.details.forEach((label)=>{
- if(label.select){
- obj.push(label.name);
- }
- })
- if(obj.length){
- selectData.push(obj)
- }
- })
- let newData = [];
- if(selectData.length){
- newData = this.doCombination(selectData);
- }
- this.attrShow = false;
- this.activeAtter = selectData;
- this.oneFormBatch[0].attr = newData.length?newData.join(';') : '全部';
+ subAttrs(e) {
+ let selectData = [];
+ this.attrsList.forEach((el, index) => {
+ let obj = [];
+ el.details.forEach((label) => {
+ if (label.select) {
+ obj.push(label.name);
+ }
+ })
+ if (obj.length) {
+ selectData.push(obj)
+ }
+ })
+ let newData = [];
+ if (selectData.length) {
+ newData = this.doCombination(selectData);
+ }
+ this.attrShow = false;
+ this.activeAtter = selectData;
+ this.oneFormBatch[0].attr = newData.length ? newData.join(';') : '全部';
let manyAttr = this.ManyAttrValue
- manyAttr.forEach(j=> {
- this.$set(j,'select',false)
- if(newData.length){
- newData.forEach(item=> {
- if(j.sku.split('').length == item.split('').length){
- if(j.sku == item){
- this.$set(j,'select',true)
+ manyAttr.forEach(j => {
+ this.$set(j, 'select', false)
+ if (newData.length) {
+ newData.forEach(item => {
+ if (j.sku.split('').length == item.split('').length) {
+ if (j.sku == item) {
+ this.$set(j, 'select', true)
}
- }else{
- if(j.sku == item){
- this.$set(j,'select',true)
+ } else {
+ if (j.sku == item) {
+ this.$set(j, 'select', true)
}
}
})
- }else{
- this.$set(j,'select',true)
- }
- })
- this.$nextTick(function(){
- this.$set(this,'ManyAttrValue',manyAttr)
+ } else {
+ this.$set(j, 'select', true)
+ }
})
- },
+ this.$nextTick(function () {
+ this.$set(this, 'ManyAttrValue', manyAttr)
+ })
+ },
// 参数模板
getSpecsLst(id) {
let cate_id = id ? id : this.formValidate.cate_id
- specsSelectedApi({ cate_id: cate_id })
+ specsSelectedApi({cate_id: cate_id})
.then(res => {
this.merSpecsSelect = res.data.mer
this.sysSpecsSelect = res.data.sys
@@ -1950,23 +1947,25 @@ export default {
res.data.mer_svip_status == 1 && res.data.svip_switch_status == 1
this.svip_rate = res.data.svip_store_rate
const name = this.formValidate.type == 0 ? '快递配送' : this.formValidate.type == 1 ? '虚拟发货' : '卡密发货'
- if (!this.$route.params.id) { this.formValidate.delivery_way = this.deliveryType }
+ if (!this.$route.params.id) {
+ this.formValidate.delivery_way = this.deliveryType
+ }
if (this.deliveryType.length == 2) {
- if(this.formValidate.type == 2){
+ if (this.formValidate.type == 2) {
this.deliveryList = [
- { value: '2', name: name }
+ {value: '2', name: name}
]
- }else{
+ } else {
this.deliveryList = [
- { value: '1', name: '到店自提' },
- { value: '2', name: name }
+ {value: '1', name: '到店自提'},
+ {value: '2', name: name}
]
}
} else {
if (this.deliveryType.length == 1 && this.deliveryType[0] == '1' && this.formValidate.type != 2) {
- this.deliveryList = [{ value: '1', name: '到店自提' }]
+ this.deliveryList = [{value: '1', name: '到店自提'}]
} else {
- this.deliveryList = [{ value: '2', name: name }]
+ this.deliveryList = [{value: '2', name: name}]
this.formValidate.delivery_way = ['2']
}
}
@@ -1992,7 +1991,7 @@ export default {
'wu',
_this.formValidate.give_coupon_ids,
(this.keyNum += 1),
- function(row) {
+ function (row) {
_this.formValidate.give_coupon_ids = []
_this.formValidate.couponData = row
row.map(item => {
@@ -2005,12 +2004,12 @@ export default {
this.formValidate.params.splice(index, 1)
},
addSpecs() {
- this.formValidate.params.push({ name: '', value: '', sort: 0 })
+ this.formValidate.params.push({name: '', value: '', sort: 0})
},
// 参数模板详情
getSpecsList() {
- let merParams = [...this.customSpecs],sysParams = [...[this.formValidate.param_temp_id]]
- let params = [...merParams,...sysParams]
+ let merParams = [...this.customSpecs], sysParams = [...[this.formValidate.param_temp_id]]
+ let params = [...merParams, ...sysParams]
if (params.length <= 0) {
this.formValidate.merParams = []
this.formValidate.sysParams = []
@@ -2021,77 +2020,77 @@ export default {
.then(res => {
let arr = []
this.formValidate.params.forEach((item, i) => {
- if(!item.parameter_id)arr.push(item)
+ if (!item.parameter_id) arr.push(item)
})
- this.formValidate.params = [...res.data,...arr]
+ this.formValidate.params = [...res.data, ...arr]
})
.catch(res => {
this.$message.error(res.message)
})
}
},
- //添加倒入卡密的值
- changeVirtual(e){
- this.virtualList = this.virtualList.concat(e);
- },
- //添加卡密
- addVirtual(index, name) {
+ //添加倒入卡密的值
+ changeVirtual(e) {
+ this.virtualList = this.virtualList.concat(e);
+ },
+ //添加卡密
+ addVirtual(index, name) {
this.$refs.addCarMy.carMyShow = true;
- this.tabIndex = index;
- this.tabName = name;
+ this.tabIndex = index;
+ this.tabName = name;
this.virtualListClear();
this.$refs.addCarMy.fixedCar = {
is_type: 0,
- key:'',
- stock:0
+ key: '',
+ stock: 0
}
- },
- //确认提交卡密
- fixdBtn(e){
- if(e.is_type == 0){
- this.$set(this[this.tabName][this.tabIndex]['cdkey'],"key",e.key);
- this.$set(this[this.tabName][this.tabIndex],"stock",Number(e.stock));
- this[this.tabName][this.tabIndex]['cdkey'].list = [];
- }else{
- this.$set(this[this.tabName][this.tabIndex]['cdkey'],"list",e.list);
- this.$set(this[this.tabName][this.tabIndex],"stock",e.list.length);
- this[this.tabName][this.tabIndex]['cdkey'].key = '';
- }
- this.$set(this[this.tabName][this.tabIndex]['cdkey'],"is_type",e.is_type);
- this.$refs.addCarMy.carMyShow = false;
- },
- closeCarMy(){
- this.$refs.addCarMy.carMyShow = false;
- },
- //清空卡密
- virtualListClear(){
- this.virtualList = [
- {
+ },
+ //确认提交卡密
+ fixdBtn(e) {
+ if (e.is_type == 0) {
+ this.$set(this[this.tabName][this.tabIndex]['cdkey'], "key", e.key);
+ this.$set(this[this.tabName][this.tabIndex], "stock", Number(e.stock));
+ this[this.tabName][this.tabIndex]['cdkey'].list = [];
+ } else {
+ this.$set(this[this.tabName][this.tabIndex]['cdkey'], "list", e.list);
+ this.$set(this[this.tabName][this.tabIndex], "stock", e.list.length);
+ this[this.tabName][this.tabIndex]['cdkey'].key = '';
+ }
+ this.$set(this[this.tabName][this.tabIndex]['cdkey'], "is_type", e.is_type);
+ this.$refs.addCarMy.carMyShow = false;
+ },
+ closeCarMy() {
+ this.$refs.addCarMy.carMyShow = false;
+ },
+ //清空卡密
+ virtualListClear() {
+ this.virtualList = [
+ {
is_type: 0,
- key: "",
- stock: "",
- },
- ];
- },
- seeVirtual(data, name, index) {
- this.tabName = name;
+ key: "",
+ stock: "",
+ },
+ ];
+ },
+ seeVirtual(data, name, index) {
+ this.tabName = name;
this.tabIndex = index;
this.virtualListClear();
this.$refs.addCarMy.fixedCar = {
is_type: 0,
- key:'',
- stock:0
+ key: '',
+ stock: 0
}
- if (data.cdkey && data.cdkey.list && data.cdkey.list.length && data.cdkey.is_type == 1) {
- this.$refs.addCarMy.fixedCar.is_type = 1;
- this.virtualList = data.cdkey.list;
- } else if (data.cdkey && data.cdkey.key) {
- this.$refs.addCarMy.fixedCar.is_type = 0;
- this.$refs.addCarMy.fixedCar.key = data.cdkey.key;
- this.$refs.addCarMy.fixedCar.stock = data.stock;
- }
- this.$refs.addCarMy.carMyShow = true;
- },
+ if (data.cdkey && data.cdkey.list && data.cdkey.list.length && data.cdkey.is_type == 1) {
+ this.$refs.addCarMy.fixedCar.is_type = 1;
+ this.virtualList = data.cdkey.list;
+ } else if (data.cdkey && data.cdkey.key) {
+ this.$refs.addCarMy.fixedCar.is_type = 0;
+ this.$refs.addCarMy.fixedCar.key = data.cdkey.key;
+ this.$refs.addCarMy.fixedCar.stock = data.stock;
+ }
+ this.$refs.addCarMy.carMyShow = true;
+ },
setTagsViewTitle() {
const title = '编辑商品'
const route = Object.assign({}, this.tempRoute, {
@@ -2108,10 +2107,10 @@ export default {
const tmp = {}
const tmpTab = {}
this.formValidate.attr.forEach((o, i) => {
- tmp['value' + i] = { title: o.value }
+ tmp['value' + i] = {title: o.value}
tmpTab['value' + i] = ''
})
- if(this.isGenerate || this.createCount == 1){
+ if (this.isGenerate || this.createCount == 1) {
this.ManyAttrValue = this.attrFormat(val)
this.manyTabTit = tmp
this.manyTabDate = tmpTab
@@ -2121,55 +2120,56 @@ export default {
this.addGenerate = false
},
attrFormat(arr) {
- let data = [],that = this;
+ let data = [], that = this;
let res = []
return format(arr)
+
function format(arr) {
if (arr.length > 1) {
arr.forEach((v, i) => {
if (i === 0) data = arr[i]['detail']
const tmp = []
- data.forEach(function(vv) {
+ data.forEach(function (vv) {
arr[i + 1] &&
- arr[i + 1]['detail'] &&
- arr[i + 1]['detail'].forEach(g => {
- const rep2 =
- (i !== 0 ? '' : arr[i]['value'] + '_$_') +
- vv +
- '-$-' +
- arr[i + 1]['value'] +
- '_$_' +
- g
- tmp.push(rep2)
- if (i === arr.length - 2) {
- const rep4 = {
- image: '',
- price: 0,
- cost: 0,
- ot_price: 0,
- select: true,
- sku: "",
- stock: 0,
- cdkey: {},
- bar_code: '',
- weight: 0,
- volume: 0,
- extension_one: 0,
- extension_two: 0
- }
- rep2.split('-$-').forEach((h, k) => {
- const rep3 = h.split('_$_')
- if (!rep4['detail']) rep4['detail'] = {}
- rep4['detail'][rep3[0]] = rep3.length > 1 ? rep3[1] : ''
- })
- // if(rep4.detail !== 'undefined' && rep4.detail !== null){
- Object.values(rep4.detail).forEach((v, i) => {
- rep4['value' + i] = v
- })
- // }
- res.push(rep4)
+ arr[i + 1]['detail'] &&
+ arr[i + 1]['detail'].forEach(g => {
+ const rep2 =
+ (i !== 0 ? '' : arr[i]['value'] + '_$_') +
+ vv +
+ '-$-' +
+ arr[i + 1]['value'] +
+ '_$_' +
+ g
+ tmp.push(rep2)
+ if (i === arr.length - 2) {
+ const rep4 = {
+ image: '',
+ price: 0,
+ cost: 0,
+ ot_price: 0,
+ select: true,
+ sku: "",
+ stock: 0,
+ cdkey: {},
+ bar_code: '',
+ weight: 0,
+ volume: 0,
+ extension_one: 0,
+ extension_two: 0
}
- })
+ rep2.split('-$-').forEach((h, k) => {
+ const rep3 = h.split('_$_')
+ if (!rep4['detail']) rep4['detail'] = {}
+ rep4['detail'][rep3[0]] = rep3.length > 1 ? rep3[1] : ''
+ })
+ // if(rep4.detail !== 'undefined' && rep4.detail !== null){
+ Object.values(rep4.detail).forEach((v, i) => {
+ rep4['value' + i] = v
+ })
+ // }
+ res.push(rep4)
+ }
+ })
})
data = tmp.length ? tmp : []
})
@@ -2193,7 +2193,7 @@ export default {
volume: 0,
extension_one: 0,
extension_two: 0,
- detail: { [v['value']]: vv }
+ detail: {[v['value']]: vv}
}
Object.values(res[kk].detail).forEach((v, i) => {
res[kk]['value' + i] = v
@@ -2202,7 +2202,7 @@ export default {
})
data.push(dataArr.join('$&'))
}
- if(that.generateArr.length>0){
+ if (that.generateArr.length > 0) {
that.generateArr.forEach((v, i) => {
res[i]['image'] = v.image
res[i]['price'] = v.price
@@ -2215,7 +2215,7 @@ export default {
res[i]['weight'] = v.weight
res[i]['extension_one'] = v.extension_one
res[i]['extension_two'] = v.extension_two
- res[i]['cdkey'] = v.cdkey&&v.cdkey.length&&v.cdkey[0] || null
+ res[i]['cdkey'] = v.cdkey && v.cdkey.length && v.cdkey[0] || null
res[i]['svip_price'] = v.svip_price || ""
})
}
@@ -2225,7 +2225,7 @@ export default {
// 运费模板
addTem() {
const _this = this
- this.$modalTemplates(0, function() {
+ this.$modalTemplates(0, function () {
_this.getShippingList()
})
},
@@ -2256,29 +2256,29 @@ export default {
}
productGetTempKeysApi().then(res => {
that.$videoCloud
- .videoUpload({
- type: res.data.type,
- evfile: evfile,
- res: res,
- uploading(status, progress) {
- that.upload.videoIng = status
- }
- })
- .then(res => {
- that.formValidate.video_link = res.url || res.data.src
- that.$message.success('视频上传成功')
- that.progress = 100
- })
- .catch(res => {
- that.upload.videoIng = false
- that.$message.error(res.msg&&res.msg.message || res.message)
- })
+ .videoUpload({
+ type: res.data.type,
+ evfile: evfile,
+ res: res,
+ uploading(status, progress) {
+ that.upload.videoIng = status
+ }
+ })
+ .then(res => {
+ that.formValidate.video_link = res.url || res.data.src
+ that.$message.success('视频上传成功')
+ that.progress = 100
+ })
+ .catch(res => {
+ that.upload.videoIng = false
+ that.$message.error(res.msg && res.msg.message || res.message)
+ })
})
},
// 添加规则;
addRule() {
const _this = this
- this.$modalAttr(this.formDynamics, function() {
+ this.$modalAttr(this.formDynamics, function () {
_this.productGetRule()
})
},
@@ -2308,39 +2308,39 @@ export default {
this.addmanyData(this.ManyAttrValue)
this.getAttr();
},
- addmanyData(data){
- data.forEach(item=>{
+ addmanyData(data) {
+ data.forEach(item => {
item.select = true
})
this.ManyAttrValue = data;
},
//打开属性
- batchAttr(){
- this.attrShow = true;
- },
+ batchAttr() {
+ this.attrShow = true;
+ },
//选中属性
- activeAttr(e){
- this.attrsList = e;
- },
- //关闭属性弹窗
- labelAttr(){
- this.attrShow = false;
- },
+ activeAttr(e) {
+ this.attrsList = e;
+ },
+ //关闭属性弹窗
+ labelAttr() {
+ this.attrShow = false;
+ },
//获取属性
- getAttr(){
- this.oneFormBatch[0].attr = '全部';
- let data = this.attrs;
- data.map(el=>{
- el.details = [];
- el.detail.map(label=>{
- el.details.push({
- name:label,
- select:false
- })
- })
- })
- this.attrsList = data;
- },
+ getAttr() {
+ this.oneFormBatch[0].attr = '全部';
+ let data = this.attrs;
+ data.map(el => {
+ el.details = [];
+ el.detail.map(label => {
+ el.details.push({
+ name: label,
+ select: false
+ })
+ })
+ })
+ this.attrsList = data;
+ },
// 商户分类;
getCategorySelect() {
categorySelectApi()
@@ -2444,8 +2444,8 @@ export default {
},
onChangeSpecs(item) {
if (item == 1 || item == 2 && this.open_svip) {
- this.formThead.svip_price = { title: "付费会员价" }
- this.attrVal = {
+ this.formThead.svip_price = {title: "付费会员价"}
+ this.attrVal = {
price: null,
cost: null,
ot_price: null,
@@ -2489,10 +2489,12 @@ export default {
var s2 = arg2.toString()
try {
max += s1.split('.')[1].length
- } catch (e) {}
+ } catch (e) {
+ }
try {
max += s2.split('.')[1].length
- } catch (e) {}
+ } catch (e) {
+ }
return (
(Number(s1.replace('.', '')) * Number(s2.replace('.', ''))) /
Math.pow(10, max)
@@ -2505,31 +2507,31 @@ export default {
// 批量添加
batchAdd() {
for (const val of this.ManyAttrValue) {
- if(val.select){
- if(this.oneFormBatch[0].attr!= '')this.$set(val, 'attr', this.oneFormBatch[0].attr)
- if(this.oneFormBatch[0].image!= '')this.$set(val, 'image', this.oneFormBatch[0].image)
- if(this.oneFormBatch[0].price!= null && this.oneFormBatch[0].price!= '')this.$set(val, 'price', this.oneFormBatch[0].price)
- if(this.oneFormBatch[0].cost!= null && this.oneFormBatch[0].cost!= '')this.$set(val, 'cost', this.oneFormBatch[0].cost)
- if(this.oneFormBatch[0].ot_price!= null && this.oneFormBatch[0].ot_price!= '')this.$set(val, 'ot_price', this.oneFormBatch[0].ot_price)
- if(this.oneFormBatch[0].svip_price!= null && this.oneFormBatch[0].svip_price!= '')this.$set(val, 'svip_price', this.oneFormBatch[0].svip_price)
- if(this.oneFormBatch[0].stock!= null && this.oneFormBatch[0].stock!= '')this.$set(val, 'stock', this.oneFormBatch[0].stock)
- if(this.oneFormBatch[0].bar_code!= null && this.oneFormBatch[0].bar_code!= '')this.$set(val, 'bar_code', this.oneFormBatch[0].bar_code)
- if(this.oneFormBatch[0].weight!= null && this.oneFormBatch[0].weight!= '')this.$set(val, 'weight', this.oneFormBatch[0].weight)
- if(this.oneFormBatch[0].volume!= null && this.oneFormBatch[0].volume!= '')this.$set(val, 'volume', this.oneFormBatch[0].volume)
- if(this.oneFormBatch[0].extension_one!= null && this.oneFormBatch[0].extension_one!= '')this.$set(val, 'extension_one', this.oneFormBatch[0].extension_one)
- if(this.oneFormBatch[0].extension_two!= null && this.oneFormBatch[0].extension_two!= '')this.$set(val, 'extension_two', this.oneFormBatch[0].extension_two)
- if(this.formValidate.type == 2){
+ if (val.select) {
+ if (this.oneFormBatch[0].attr != '') this.$set(val, 'attr', this.oneFormBatch[0].attr)
+ if (this.oneFormBatch[0].image != '') this.$set(val, 'image', this.oneFormBatch[0].image)
+ if (this.oneFormBatch[0].price != null && this.oneFormBatch[0].price != '') this.$set(val, 'price', this.oneFormBatch[0].price)
+ if (this.oneFormBatch[0].cost != null && this.oneFormBatch[0].cost != '') this.$set(val, 'cost', this.oneFormBatch[0].cost)
+ if (this.oneFormBatch[0].ot_price != null && this.oneFormBatch[0].ot_price != '') this.$set(val, 'ot_price', this.oneFormBatch[0].ot_price)
+ if (this.oneFormBatch[0].svip_price != null && this.oneFormBatch[0].svip_price != '') this.$set(val, 'svip_price', this.oneFormBatch[0].svip_price)
+ if (this.oneFormBatch[0].stock != null && this.oneFormBatch[0].stock != '') this.$set(val, 'stock', this.oneFormBatch[0].stock)
+ if (this.oneFormBatch[0].bar_code != null && this.oneFormBatch[0].bar_code != '') this.$set(val, 'bar_code', this.oneFormBatch[0].bar_code)
+ if (this.oneFormBatch[0].weight != null && this.oneFormBatch[0].weight != '') this.$set(val, 'weight', this.oneFormBatch[0].weight)
+ if (this.oneFormBatch[0].volume != null && this.oneFormBatch[0].volume != '') this.$set(val, 'volume', this.oneFormBatch[0].volume)
+ if (this.oneFormBatch[0].extension_one != null && this.oneFormBatch[0].extension_one != '') this.$set(val, 'extension_one', this.oneFormBatch[0].extension_one)
+ if (this.oneFormBatch[0].extension_two != null && this.oneFormBatch[0].extension_two != '') this.$set(val, 'extension_two', this.oneFormBatch[0].extension_two)
+ if (this.formValidate.type == 2) {
val.cdkey = {}
- if(this.oneFormBatch[0]['cdkey'].is_type == 1){
- if(this.oneFormBatch[0]['cdkey'].list && this.oneFormBatch[0]['cdkey'].list.length){
+ if (this.oneFormBatch[0]['cdkey'].is_type == 1) {
+ if (this.oneFormBatch[0]['cdkey'].list && this.oneFormBatch[0]['cdkey'].list.length) {
this.$set(val.cdkey, "list", this.oneFormBatch[0]['cdkey'].list);
this.$set(val, "stock", this.oneFormBatch[0]['cdkey'].list.length);
}
- }else if(this.oneFormBatch[0]['cdkey'].key){
+ } else if (this.oneFormBatch[0]['cdkey'].key) {
this.$set(val.cdkey, "key", this.oneFormBatch[0]['cdkey'].key);
}
- this.$set(val.cdkey, "is_type",this.oneFormBatch[0]['cdkey'].is_type);
- }
+ this.$set(val.cdkey, "is_type", this.oneFormBatch[0]['cdkey'].is_type);
+ }
}
}
},
@@ -2566,15 +2568,15 @@ export default {
}
this.formValidate.attr.push(data)
var hash = {}
- this.formValidate.attr = this.formValidate.attr.reduce(function(
- item,
- next
- ) {
- /* eslint-disable */
- hash[next.value] ? "" : (hash[next.value] = true && item.push(next));
- return item;
- },
- []);
+ this.formValidate.attr = this.formValidate.attr.reduce(function (
+ item,
+ next
+ ) {
+ /* eslint-disable */
+ hash[next.value] ? "" : (hash[next.value] = true && item.push(next));
+ return item;
+ },
+ []);
this.clearAttr();
this.attrs = this.formValidate.attr;
this.isGenerate = true;
@@ -2590,7 +2592,7 @@ export default {
var hash = {};
this.formValidate.attr[idx].detail = this.formValidate.attr[
idx
- ].detail.reduce(function(item, next) {
+ ].detail.reduce(function (item, next) {
/* eslint-disable */
hash[next] ? "" : (hash[next] = true && item.push(next));
return item;
@@ -2601,10 +2603,10 @@ export default {
}
this.attrs = this.formValidate.attr;
},
- // 立即生成
+ // 立即生成
generate() {
let id = this.$route.params.id || 0;
- generateAttrApi(id,{ attrs: this.formValidate.attr,product_type: this.formValidate.product_type })
+ generateAttrApi(id, {attrs: this.formValidate.attr, product_type: this.formValidate.product_type})
.then((res) => {
let info = res.data
this.generateArr = res.data.value
@@ -2612,7 +2614,7 @@ export default {
this.createProduct = true
this.isGenerate = true
if (this.$route.params.id !== "0") {
- this.addmanyData(info.value);
+ this.addmanyData(info.value);
}
if (!this.$route.params.id && this.formValidate.spec_type === 1) {
this.ManyAttrValue.map((item) => {
@@ -2621,7 +2623,7 @@ export default {
});
this.oneFormBatch[0].pic = this.formValidate.slider_image[0];
}
- this.getAttr();
+ this.getAttr();
})
.catch((res) => {
this.$message.error(res.message);
@@ -2646,7 +2648,7 @@ export default {
this.deduction_set = info.integral_rate == -1 ? -1 : 1;
this.attrs = info.attr || [];
info.attrValue.forEach(val => {
- this.$set(val,'select', true)
+ this.$set(val, 'select', true)
});
this.formValidate = {
product_type: info.product_type || 0,
@@ -2695,9 +2697,13 @@ export default {
integral_give_money: info.integral_give_money || 0,
//积分抵扣
integral_deduction_type: info.integral_deduction_type || 0,
- integral_deduction_money: info.integral_deduction_money || 0
+ integral_deduction_money: info.integral_deduction_money || 0,
+ // 按照批量购买设置
+ is_batch: info.is_batch || 0,
+ batch_num: info.batch_num || 0,
+ batch_unit: info.batch_unit || '',
};
- if (info.svip_price_type != 0 && info.mer_svip_status){
+ if (info.svip_price_type != 0 && info.mer_svip_status) {
this.attrVal = {
price: null,
cost: null,
@@ -2715,7 +2721,7 @@ export default {
}
if (this.formValidate.spec_type === 0) {
info.attrValue[0].list = [],
- this.OneattrValue = info.attrValue;
+ this.OneattrValue = info.attrValue;
} else {
this.ManyAttrValue = info.attrValue;
this.generate();
@@ -2738,7 +2744,7 @@ export default {
modalPicTap(tit, num, i) {
const _this = this;
const attr = [];
- this.$modalUpload(function(img) {
+ this.$modalUpload(function (img) {
if (tit === "1" && !num) {
_this.formValidate.image = img[0];
_this.OneattrValue[0].image = img[0];
@@ -2764,12 +2770,16 @@ export default {
}, tit);
},
handleSubmitUp() {
- this.currentTab = (Number(this.currentTab) - 1).toString();
+ let currentTab = (Number(this.currentTab) - 1).toString();
+ if(this.config.merchant_type == 2 && (currentTab == 4 || currentTab == 5)) currentTab = '3';
+ this.currentTab = currentTab;
},
handleSubmitNest(name) {
this.$refs[name].validate(valid => {
if (valid) {
- this.currentTab = (Number(this.currentTab) + 1).toString();
+ let currentTab = (Number(this.currentTab) + 1).toString();
+ if(this.config.merchant_type == 2 && (currentTab == 4 || currentTab == 5)) currentTab = '6';
+ this.currentTab = currentTab;
}
});
},
@@ -2790,31 +2800,31 @@ export default {
let disCreate = this.$route.params.id && !this.$route.query.type;
disCreate
? productUpdateApi(this.$route.params.id, this.formValidate)
- .then(async res => {
- this.fullscreenLoading = false;
- this.$message.success(res.message);
- this.$router.push({ path: this.roterPre + "/product/list" });
- this.$refs[name].resetFields();
- this.formValidate.slider_image = [];
- this.loading = false;
- })
- .catch(res => {
- this.fullscreenLoading = false;
- this.loading = false;
- this.$message.error(res.message);
- })
+ .then(async res => {
+ this.fullscreenLoading = false;
+ this.$message.success(res.message);
+ this.$router.push({path: this.roterPre + "/product/list"});
+ this.$refs[name].resetFields();
+ this.formValidate.slider_image = [];
+ this.loading = false;
+ })
+ .catch(res => {
+ this.fullscreenLoading = false;
+ this.loading = false;
+ this.$message.error(res.message);
+ })
: productCreateApi(this.formValidate)
- .then(async res => {
- this.fullscreenLoading = false;
- this.$message.success(res.message);
- this.$router.push({ path: this.roterPre + "/product/list" });
- this.loading = false;
- })
- .catch(res => {
- this.fullscreenLoading = false;
- this.loading = false;
- this.$message.error(res.message);
- });
+ .then(async res => {
+ this.fullscreenLoading = false;
+ this.$message.success(res.message);
+ this.$router.push({path: this.roterPre + "/product/list"});
+ this.loading = false;
+ })
+ .catch(res => {
+ this.fullscreenLoading = false;
+ this.loading = false;
+ this.$message.error(res.message);
+ });
} else {
if (!this.formValidate.store_name.trim()) {
return this.$message.warning("基本信息-商品名称不能为空");
@@ -2896,7 +2906,7 @@ export default {
addCustomDialog(editorId) {
window.UE.registerUI(
"test-dialog",
- function(editor, uiName) {
+ function (editor, uiName) {
// 创建 dialog
let dialog = new window.UE.ui.Dialog({
iframeUrl: roterPre + "/admin/widget/image?field=dialog",
@@ -2910,7 +2920,7 @@ export default {
name: "dialog-button",
title: "上传图片",
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,
- onclick: function() {
+ onclick: function () {
// 渲染dialog
dialog.render();
dialog.open();
@@ -2922,7 +2932,7 @@ export default {
);
window.UE.registerUI(
"video-dialog",
- function(editor, uiName) {
+ function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({
iframeUrl: roterPre + "/admin/widget/video?fodder=video",
editor: editor,
@@ -2935,7 +2945,7 @@ export default {
name: "video-button",
title: "上传视频",
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -320px -20px;`,
- onclick: function() {
+ onclick: function () {
// 渲染dialog
dialog.render();
dialog.open();
@@ -2959,9 +2969,11 @@ export default {
height: 100%;
background: rgba(0, 0, 0, 0.5);
}
+
.goods_detail .goods_detail_wrapper {
z-index: -10;
}
+
/deep/ .upLoadPicBox {
.upLoad {
-webkit-box-orient: vertical;
@@ -2972,72 +2984,90 @@ export default {
flex-direction: column;
line-height: 20px;
}
+
span {
font-size: 10px;
}
}
+
.proCoupon {
/deep/ .el-form-item__content {
margin-top: 5px;
}
}
+
.tabPic {
width: 40px !important;
height: 40px !important;
+
img {
width: 100%;
height: 100%;
}
}
+
.noLeft {
/deep/ .el-form-item__content {
margin-left: 0 !important;
}
}
+
.tabNumWidth {
/deep/ .el-input-number--medium {
width: 100px;
}
+
/deep/ .el-input-number__increase {
width: 20px !important;
font-size: 12px !important;
}
+
/deep/ .el-input-number__decrease {
width: 20px !important;
font-size: 12px !important;
}
+
/deep/ .el-input-number--medium .el-input__inner {
padding-left: 25px !important;
padding-right: 25px !important;
}
- /deep/.priceBox .el-input-number__decrease,
- /deep/.priceBox .el-input-number__increase {
+
+ /deep/ .priceBox .el-input-number__decrease,
+ /deep/ .priceBox .el-input-number__increase {
display: none;
}
- /deep/.priceBox .el-input-number.is-controls-right .el-input__inner {
+
+ /deep/ .priceBox .el-input-number.is-controls-right .el-input__inner {
padding: 0 5px;
}
+
/deep/ thead {
line-height: normal !important;
}
- /deep/.cell {
+
+ /deep/ .cell {
line-height: normal !important;
text-overflow: clip !important;
}
}
+
.seeCatMy {
color: #437FFD;
cursor: pointer;
}
-.selectOn{
- color: #437FFD;
+
+.selectOn {
+ color: #437FFD;
}
+
.virtual_boder {
border: 1px solid #437FFD;
}
+
.virtual_boder2 {
border: 1px solid #e7e7e7;
}
+
.virtual_san {
position: absolute;
bottom: 0;
@@ -3047,6 +3077,7 @@ export default {
border-bottom: 26px solid #437FFD;
border-left: 26px solid transparent;
}
+
.virtual_dui {
position: absolute;
bottom: -2px;
@@ -3054,6 +3085,7 @@ export default {
color: #ffffff;
font-family: system-ui;
}
+
.virtual {
width: 120px;
height: 60px;
@@ -3065,20 +3097,24 @@ export default {
position: relative;
cursor: pointer;
line-height: 23px;
+
.virtual_top {
font-size: 14px;
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
}
+
.virtual_bottom {
font-size: 12px;
font-weight: 400;
color: #999999;
}
}
+
.virtual:nth-child(2n) {
margin: 0 12px;
}
+
.addfont {
display: inline-block;
font-size: 13px;
@@ -3087,49 +3123,60 @@ export default {
margin-left: 14px;
cursor: pointer;
}
+
.titTip {
display: inline-bolck;
font-size: 12px;
font-weight: 400;
color: #999999;
}
+
.addCustom_content {
margin-top: 20px;
+
.custom_box {
margin-bottom: 10px;
}
}
+
.addCustomBox {
margin-top: 12px;
font-size: 13px;
font-weight: 400;
color: #437FFD;
+
.btn {
cursor: pointer;
width: max-content;
}
+
.remark {
display: flex;
margin-top: 14px;
}
}
+
.selWidth {
width: 50%;
}
+
.ml15 {
margin-left: 15px;
}
+
.button-new-tag {
height: 28px;
line-height: 26px;
padding-top: 0;
padding-bottom: 0;
}
+
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
+
.pictrue {
width: 60px;
height: 60px;
@@ -3137,11 +3184,13 @@ export default {
margin-right: 10px;
position: relative;
cursor: pointer;
+
img {
width: 100%;
height: 100%;
}
}
+
.iview-video-style {
width: 40%;
height: 180px;
@@ -3151,6 +3200,7 @@ export default {
position: relative;
overflow: hidden;
}
+
.iconv {
color: #fff;
line-height: 180px;
@@ -3161,6 +3211,7 @@ export default {
left: 50%;
margin-left: -25px;
}
+
.iview-video-style .mark {
position: absolute;
width: 100%;
@@ -3169,15 +3220,19 @@ export default {
background-color: rgba(0, 0, 0, 0.5);
text-align: center;
}
+
.uploadVideo {
margin-left: 10px;
}
+
.perW50 {
width: 50%;
}
+
.submission {
margin-left: 10px;
}
+
.btndel {
position: absolute;
z-index: 1;
@@ -3186,6 +3241,7 @@ export default {
left: 46px;
top: -4px;
}
+
.labeltop {
/deep/ .el-form-item__label {
float: none !important;
@@ -3194,11 +3250,12 @@ export default {
width: auto !important;
}
}
-.tips{
+
+.tips {
height: 50px;
line-height: 50px;
color: #999;
font-size: 12px;
- border-bottom: 1px solid rgba(0,0,0,0.05);
+ border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}