Commit ca39bf88 by 李伟康

提交

1 parent 896d6276
...@@ -1966,7 +1966,7 @@ ...@@ -1966,7 +1966,7 @@
} }
}, },
"vue-loader-v16": { "vue-loader-v16": {
"version": "npm:vue-loader@16.8.3", "version": "npm:vue-loader-v16@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==", "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true, "dev": true,
...@@ -8787,6 +8787,11 @@ ...@@ -8787,6 +8787,11 @@
"integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
"dev": true "dev": true
}, },
"number-precision": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/number-precision/-/number-precision-1.6.0.tgz",
"integrity": "sha512-05OLPgbgmnixJw+VvEh18yNPUo3iyp4BEWJcrLu4X9W05KmMifN7Mu5exYvQXqxxeNWhvIF+j3Rij+HmddM/hQ=="
},
"oauth-sign": { "oauth-sign": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"element-ui": "^2.4.5", "element-ui": "^2.4.5",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.6",
"glsx-components": "^1.5.4", "glsx-components": "^1.5.4",
"number-precision": "^1.6.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuex": "^3.1.2", "vuex": "^3.1.2",
......
...@@ -119,17 +119,17 @@ const getSharedListApi = params => { ...@@ -119,17 +119,17 @@ const getSharedListApi = params => {
const exportBrowseApi = (params, TYPE = 1) => { const exportBrowseApi = (params, TYPE = 1) => {
//TYPE 1 浏览 2 访客 3 分享 //TYPE 1 浏览 2 访客 3 分享
params.method = { params.method = {
1: 'scrm.api.shopmall.discover.goods.browse.records.export', 1: 'scrm.api.shopmall.discover.goods.browse.records.export',
2: 'scrm.api.shopmall.discover.goods.visitor.records.export', 2: 'scrm.api.shopmall.discover.goods.visitor.records.export',
3: 'scrm.api.shopmall.discover.goods.shared.records.export' 3: 'scrm.api.shopmall.discover.goods.shared.records.export'
}[TYPE] }[TYPE]
return http({ return http({
url, url,
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const exportGoodsApi = params => { const exportGoodsApi = params => {
params.method = 'scrm.api.shopmall.goods.configuration.export' params.method = 'scrm.api.shopmall.goods.configuration.export'
...@@ -150,7 +150,18 @@ const getSelfGoodsDetailApi = params => { ...@@ -150,7 +150,18 @@ const getSelfGoodsDetailApi = params => {
sign: true sign: true
}) })
} }
/**
* 获取油劵列表
*/
const getOilCouponListApi = params => {
params.method = 'scrm.api.shopmall.goods.oil.coupon.list'
params.status = 1
return http({
url,
data: params
})
}
export default { export default {
getGoodsListApi, getGoodsListApi,
updateGoodsStatusApi, updateGoodsStatusApi,
...@@ -165,5 +176,6 @@ export default { ...@@ -165,5 +176,6 @@ export default {
getSharedListApi, getSharedListApi,
exportBrowseApi, exportBrowseApi,
exportGoodsApi, exportGoodsApi,
getSelfGoodsDetailApi getSelfGoodsDetailApi,
getOilCouponListApi
} }
\ No newline at end of file \ No newline at end of file
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
<template v-else> <template v-else>
<glsx-combi-form <glsx-combi-form
:isInline="false" :isInline="false"
ref="goodsInfoRef"
labelWidth="154px" labelWidth="154px"
defaultWidth="432px" defaultWidth="432px"
:formObj.sync="formObj" :formObj.sync="formObj"
...@@ -61,7 +60,8 @@ ...@@ -61,7 +60,8 @@
class="upload-class" class="upload-class"
> >
<el-image <el-image
style="width: 106px; height: 106px" v-if="formObj.coverList && formObj.coverList[0]"
class="img"
:src="formObj.coverList[0]" :src="formObj.coverList[0]"
:preview-src-list="formObj.coverList" :preview-src-list="formObj.coverList"
> >
...@@ -69,6 +69,11 @@ ...@@ -69,6 +69,11 @@
</div> </div>
</el-image> </el-image>
</div> </div>
<template slot="retailPrice">
<div>
{{formObj.retailPrice || '--'}}
</div>
</template>
</glsx-combi-form> </glsx-combi-form>
</template> </template>
</div> </div>
...@@ -147,39 +152,52 @@ ...@@ -147,39 +152,52 @@
v-model="scope.scope.exchangeIntegral" v-model="scope.scope.exchangeIntegral"
></format-input> ></format-input>
</div> </div>
<!-- 油券 -->
<template <template
slot="yuan" slot="activityPrice"
slot-scope="scope" slot-scope="scope"
> >
<el-input <format-input
:intDigit="5"
:precise="0"
placeholder="请输入" placeholder="请输入"
v-model.number.trim="scope.scope.yuan" v-model="scope.scope.activityPrice"
maxlength="5" @blur="setDefault(scope.scope,'activityPrice')"
@blur="setInt(scope.scope,'yuan')" :disabled="disabled"
></el-input> ></format-input>
</template> </template>
<template <template
slot="jifenkaiguan" slot="exchangeIntegralFlag"
slot-scope="scope" slot-scope="scope"
> >
<el-switch <el-switch
v-model="scope.scope.jifenkaiguan" v-model="scope.scope.exchangeIntegralFlag"
@change="integralSwitch($event, scope.scope)" @change="integralSwitch($event, scope.scope)"
:active-value="1"
:inactive-value="0"
:disabled="disabled"
> >
</el-switch> </el-switch>
<div class="switch">
<div :class="['text',{'off':scope.scope.exchangeIntegralFlag == 0}]">{{
scope.scope.exchangeIntegralFlag == 0 ?'否':'是'
}}</div>
</div>
</template> </template>
<template <template
slot="jifen" slot="exchangeIntegral"
slot-scope="scope" slot-scope="scope"
> >
<el-input <format-input
:disabled="!scope.scope.jifenkaiguan" :disabled="disabled || scope.scope.exchangeIntegralFlag == 0"
:intDigit="5"
:precise="0"
placeholder="请输入" placeholder="请输入"
v-model.number.trim="scope.scope.jifen" v-model="scope.scope.exchangeIntegral"
maxlength="5" @blur="setDefault(scope.scope,'exchangeIntegral','')"
@blur="setInt(scope.scope,'jifen','')" ></format-input>
></el-input>
</template> </template>
<!-- 油券end -->
<div <div
slot="auth-button" slot="auth-button"
slot-scope="scope" slot-scope="scope"
...@@ -424,18 +442,18 @@ const GasColumns = [ ...@@ -424,18 +442,18 @@ const GasColumns = [
}, },
{ {
label: '门店价/元', label: '门店价/元',
addHtml: 'yuan', addHtml: 'activityPrice',
minWidth: 100, minWidth: 100,
}, },
{ {
label: '是否支持积分兑换', label: '是否支持积分兑换',
minWidth: 150, width: 150,
addHtml: 'jifenkaiguan' addHtml: 'exchangeIntegralFlag'
}, },
{ {
label: '兑换积分', label: '兑换积分',
minWidth: 100, minWidth: 100,
addHtml: 'jifen' addHtml: 'exchangeIntegral'
} }
] ]
const defaultExpreeColFn = (vn) => { const defaultExpreeColFn = (vn) => {
...@@ -486,7 +504,7 @@ const selfGoodsExpreeCol = [ ...@@ -486,7 +504,7 @@ const selfGoodsExpreeCol = [
import glsxCombiForm from '@/components/glsx-combi-form' import glsxCombiForm from '@/components/glsx-combi-form'
import selectGoods from './components/selectGoods' import selectGoods from './components/selectGoods'
import selectMerchantDialog from './components/selectMerchantDialog' import selectMerchantDialog from './components/selectMerchantDialog'
import NP from 'number-precision'
export default { export default {
name: 'add', name: 'add',
components: { components: {
...@@ -551,18 +569,17 @@ export default { ...@@ -551,18 +569,17 @@ export default {
}, },
{ {
label: '面值/元', label: '面值/元',
name: 'goodsName', name: 'oilCouponFaceValue',
type: 'showTxt' type: 'showTxt'
}, },
{ {
label: '采购价/元', label: '成本价/元',
name: 'goodsName', name: 'minSellPrice',
type: 'showTxt' type: 'showTxt'
}, },
{ {
label: '销售价/元', label: '销售价/元',
name: 'goodsName', addHtml: 'retailPrice'
type: 'showTxt'
}, },
], ],
expressInfoFormData: defaultExpreeColFn(this), expressInfoFormData: defaultExpreeColFn(this),
...@@ -583,7 +600,8 @@ export default { ...@@ -583,7 +600,8 @@ export default {
styleBImgList: [], styleBImgList: [],
coverList: [], coverList: [],
associationClassifyFirstId: '', associationClassifyFirstId: '',
introduction: '' introduction: '',
oilCouponFaceValue: ''
}, },
saleMerchantList: [], saleMerchantList: [],
myRule: { myRule: {
...@@ -616,10 +634,13 @@ export default { ...@@ -616,10 +634,13 @@ export default {
saleStoreSlot: [{ saleStoreSlot: [{
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if (!this.saleMerchantList.length) {
callback(new Error('请选择门店'))
}
const { goodsSource } = this.formObj const { goodsSource } = this.formObj
if (goodsSource == 3) { if (goodsSource == 3) {
const _jifen = this.saleMerchantList.find(item => !item.jifen && item.jifenkaiguan) const _exchangeIntegral = this.saleMerchantList.find(item => !item.exchangeIntegral && item.exchangeIntegralFlag)
if (_jifen) { if (_exchangeIntegral) {
callback(new Error('请输入兑换积分')) callback(new Error('请输入兑换积分'))
} else callback() } else callback()
} else { } else {
...@@ -636,9 +657,7 @@ export default { ...@@ -636,9 +657,7 @@ export default {
let minSellPrice = this.formObj.minSellPrice || 0 let minSellPrice = this.formObj.minSellPrice || 0
return (+activityPrice > +originalPrice || +originalPrice < minSellPrice) return (+activityPrice > +originalPrice || +originalPrice < minSellPrice)
}) })
if (!this.saleMerchantList.length) { if (_target) {
callback(new Error('请选择门店'))
} else if (_target) {
callback(new Error(`门店${this.formObj.goodsSource == 2 ? '零售价' : '活动价和原价'}请填写大于0的数值`)) callback(new Error(`门店${this.formObj.goodsSource == 2 ? '零售价' : '活动价和原价'}请填写大于0的数值`))
} else if (this.formObj.goodsSource != 2 && hasTarget) { } else if (this.formObj.goodsSource != 2 && hasTarget) {
callback(new Error('原价不能小于最低售价和活动价')) callback(new Error('原价不能小于最低售价和活动价'))
...@@ -769,7 +788,7 @@ export default { ...@@ -769,7 +788,7 @@ export default {
}) })
this.myRule.deliveryType[0].required = n != 3 this.myRule.deliveryType[0].required = n != 3
this.myRule.expressFee[0].required = n != 3 this.myRule.expressFee[0].required = n != 3
this.validateField('saleStoreSlot') this.$refs.baseInfoRef.$refs.formRef.clearValidate()
} }
}, },
created () { created () {
...@@ -818,6 +837,9 @@ export default { ...@@ -818,6 +837,9 @@ export default {
2: MerchantColumns, 2: MerchantColumns,
3: GasColumns 3: GasColumns
}[e] }[e]
if (this.routeInfo.type != 1) this.selectedtableParams.tableOption = e == 2 ? null : {
width: 100
}
if (isClear) this.clearDataFn() if (isClear) this.clearDataFn()
}, },
clearDataFn () { clearDataFn () {
...@@ -832,7 +854,8 @@ export default { ...@@ -832,7 +854,8 @@ export default {
goodsVideo: '', goodsVideo: '',
goodsType: '2', goodsType: '2',
expressFee: '', expressFee: '',
introduction: '' introduction: '',
oilCouponFaceValue: ''
} }
this.saleMerchantList = [] this.saleMerchantList = []
}, },
...@@ -926,6 +949,7 @@ export default { ...@@ -926,6 +949,7 @@ export default {
this.goodsVisible = false this.goodsVisible = false
}, },
handleGoodsConfirm (e) { handleGoodsConfirm (e) {
console.log(e)
if (this.formObj.smartcarlifeInfoId != e?.id) this.saleMerchantList = [] if (this.formObj.smartcarlifeInfoId != e?.id) this.saleMerchantList = []
let { id, goodsName, goodsImage, minSellPrice, retailPrice, goodsVideo, goodsId } = e || {} let { id, goodsName, goodsImage, minSellPrice, retailPrice, goodsVideo, goodsId } = e || {}
minSellPrice = minSellPrice ? Number(Number(minSellPrice / 100).toFixed(2)) : 0 minSellPrice = minSellPrice ? Number(Number(minSellPrice / 100).toFixed(2)) : 0
...@@ -946,6 +970,7 @@ export default { ...@@ -946,6 +970,7 @@ export default {
if (this.formObj.goodsSource == 2) { if (this.formObj.goodsSource == 2) {
this.setSelfGoodsInfo(e) this.setSelfGoodsInfo(e)
} }
if (this.formObj.goodsSource == 3) this.setGasGoodsInfo(e)
this.validateField(['selectBtnSlot', 'goodsInfoSlot']) this.validateField(['selectBtnSlot', 'goodsInfoSlot'])
}, },
setSelfGoodsInfo (row) { setSelfGoodsInfo (row) {
...@@ -956,17 +981,41 @@ export default { ...@@ -956,17 +981,41 @@ export default {
originalPrice = originalPrice ? Number(Number(originalPrice / 100).toFixed(2)) : 0 originalPrice = originalPrice ? Number(Number(originalPrice / 100).toFixed(2)) : 0
this.saleMerchantList = [{ merchantId, merchantName, activityPrice: retailPrice, originalPrice, giveIntegral: '' }] this.saleMerchantList = [{ merchantId, merchantName, activityPrice: retailPrice, originalPrice, giveIntegral: '' }]
}, },
setGasGoodsInfo (row) {
const salesPrice = row.salesPrice ? NP.divide(row.salesPrice, 100).toFixed(2) : 0
this.formObj = {
...this.formObj,
...row,
coverList: [row.aliasUrl],
originalPrice: salesPrice,
goodsName: row.aliasName,
salesPrice: salesPrice,
retailPrice: salesPrice,
oilCouponFaceValue: row.faceValue,
minSellPrice: row.sellPrice
}
},
confirmDialog (e) { confirmDialog (e) {
this.saleMerchantList = e || [] const { saleMerchantList } = this
this.saleMerchantList.map(item => { e && e.map(item => {
this.$set(item, 'giveIntegral', '') if (this.formObj.goodsSource != 3) {
this.$set(item, 'exchangeIntegralFlag', 0) this.$set(item, 'giveIntegral', '')
this.$set(item, 'exchangeIntegral', '') this.$set(item, 'exchangeIntegralFlag', 0)
//修改 this.$set(item, 'exchangeIntegral', '')
this.$set(item, 'yuan', 0) } else {
this.$set(item, 'jifenkaiguan', true) this.$set(item, 'activityPrice', 0)
this.$set(item, 'jifen', '') this.$set(item, 'exchangeIntegralFlag', 1)
this.$set(item, 'exchangeIntegral', '')
saleMerchantList.map(i => {
if (i.merchantId === item.merchantId) {
item.activityPrice = i.activityPrice
item.exchangeIntegralFlag = i.exchangeIntegralFlag
item.exchangeIntegral = i.exchangeIntegral
}
})
}
}) })
this.saleMerchantList = e || []
this.validateField('saleStoreSlot') this.validateField('saleStoreSlot')
this.closeDialog() this.closeDialog()
}, },
...@@ -979,6 +1028,7 @@ export default { ...@@ -979,6 +1028,7 @@ export default {
handleDel (row) { handleDel (row) {
const idx = this.saleMerchantList.findIndex(item => item.merchantId == row.merchantId) const idx = this.saleMerchantList.findIndex(item => item.merchantId == row.merchantId)
if (idx > -1) this.saleMerchantList.splice(idx, 1) if (idx > -1) this.saleMerchantList.splice(idx, 1)
this.validateField('saleStoreSlot')
}, },
getParams () { getParams () {
let obj = JSON.parse(JSON.stringify(this.formObj)) let obj = JSON.parse(JSON.stringify(this.formObj))
...@@ -994,7 +1044,7 @@ export default { ...@@ -994,7 +1044,7 @@ export default {
activityPrice = activityPrice ? Number(Number(activityPrice * 10 * 10).toFixed(0)) : 0 activityPrice = activityPrice ? Number(Number(activityPrice * 10 * 10).toFixed(0)) : 0
originalPrice = originalPrice ? Number(Number(originalPrice * 10 * 10).toFixed(0)) : 0 originalPrice = originalPrice ? Number(Number(originalPrice * 10 * 10).toFixed(0)) : 0
let saleMerchantItem = { merchantId, merchantName, activityPrice, giveIntegral, originalPrice } let saleMerchantItem = { merchantId, merchantName, activityPrice, giveIntegral, originalPrice }
if (this.formObj.goodsSource == 1) { if (this.formObj.goodsSource != 2) {
saleMerchantItem.exchangeIntegralFlag = exchangeIntegralFlag saleMerchantItem.exchangeIntegralFlag = exchangeIntegralFlag
saleMerchantItem.exchangeIntegral = exchangeIntegralFlag ? exchangeIntegral : '' saleMerchantItem.exchangeIntegral = exchangeIntegralFlag ? exchangeIntegral : ''
} }
...@@ -1033,9 +1083,9 @@ export default { ...@@ -1033,9 +1083,9 @@ export default {
this.$apis.goods.getGoodsDetail(params).then(res => { this.$apis.goods.getGoodsDetail(params).then(res => {
if (res) { if (res) {
for (const key in this.formObj) { for (const key in this.formObj) {
const formatAttr = ['depositPrice', 'minSellPrice', 'retailPrice', 'expressFee'] const formatAttr = ['depositPrice', 'minSellPrice', 'retailPrice', 'expressFee', 'oilCouponFaceValue']
if (formatAttr.includes(key)) { if (formatAttr.includes(key)) {
this.formObj[key] = res[key] ? Number(Number(res[key] / 100).toFixed(2)) : 0 this.formObj[key] = res[key] ? NP.divide(res[key], 100).toFixed(2) : 0
} else { } else {
this.formObj[key] = res[key] this.formObj[key] = res[key]
} }
...@@ -1058,13 +1108,13 @@ export default { ...@@ -1058,13 +1108,13 @@ export default {
} }
}) })
}, },
setInt (e, target, min = 0) { setDefault (e, target, min = 0) {
if (e[target]) e[target] = Math.abs(e[target]) if (e[target]) e[target] = Math.abs(e[target])
if (!e[target] || e[target] < min) e[target] = min if (!e[target] || e[target] < min) e[target] = min
if(target == 'yuan' && e[target] == 0) e.jifenkaiguan = true if (target == 'activityPrice' && e[target] == 0) e.exchangeIntegralFlag = 1
}, },
integralSwitch (e, row) { integralSwitch (e, row) {
if (!e && row.yuan == 0) row.jifenkaiguan = true if (!e && row.activityPrice == 0) row.exchangeIntegralFlag = 1
} }
} }
} }
...@@ -1092,14 +1142,17 @@ export default { ...@@ -1092,14 +1142,17 @@ export default {
background: #f9f9f9; background: #f9f9f9;
border-radius: 4px; border-radius: 4px;
.upload-calss { .upload-class {
display: flex; display: flex;
/deep/.img {
width: 106px;
height: 106px;
}
} }
} }
.selected-table { .selected-table {
margin-top: 10px; margin-top: 10px;
width: 1200px; max-width: 1200px;
.el-button--text { .el-button--text {
padding: 0; padding: 0;
...@@ -1247,4 +1300,29 @@ export default { ...@@ -1247,4 +1300,29 @@ export default {
height: 720px; height: 720px;
} }
} }
.switch {
width: 40px;
height: 20px;
position: absolute;
pointer-events: none;
left: 16px;
top: 50%;
transform: translateY(-50%);
.text {
position: absolute;
top: 50%;
transform: translateY(-50%);
color: #fff;
left: 6px;
font-size: 12px;
color: #ffffff;
user-select: none;
}
.off {
left: auto;
right: 6px;
color: #999999;
}
}
</style> </style>
<template> <template>
<div class="select-store"> <div class="select-store">
<GLDialog bigTitle="选择商品" <GLDialog
mode="big" bigTitle="选择商品"
:visible.sync="dialogVisible" mode="big"
:before-close="handleClose" :visible.sync="dialogVisible"
:close-on-click-modal="false" :before-close="handleClose"
@onOk="handleConfirm" :close-on-click-modal="false"
@onCancel="handleClose"> @onOk="handleConfirm"
<glsx-combi-form ref="showSearch" @onCancel="handleClose"
labelWidth="105px" >
:formObj="searchForm" <glsx-combi-form
:formData="searchFormData"> ref="showSearch"
labelWidth="105px"
:formObj="searchForm"
:formData="searchFormData"
>
<span slot="footer"> <span slot="footer">
<el-button :size="size" <el-button
type="primary" :size="size"
@click="resetTable">查询</el-button> type="primary"
<el-button :size="size" v-if="goodsInfo.goodsSource==2" @click="resetTable"
@click="resetSearch">重置</el-button> >查询</el-button>
<el-button
:size="size"
v-if="goodsInfo.goodsSource==2"
@click="resetSearch"
>重置</el-button>
</span> </span>
</glsx-combi-form> </glsx-combi-form>
<GLTable ref="goodsRef" <GLTable
:noDataImg="url" ref="goodsRef"
:searchForm="searchForm" :noDataImg="url"
:tableParams="tableParams" :searchForm="searchForm"
:beforeSearchFn="beforeSearchFn" :tableParams="tableParams"
:pageConf="pageConf" :beforeSearchFn="beforeSearchFn"
@refreshTable="getList" :pageConf="pageConf"
:getListApi="getListApi" @refreshTable="getList"
:pageSizes="pageSizes" :getListApi="getListApi"
:hasNum="false" :pageSizes="pageSizes"
:setTableFinishFun="setTableFinishFun"> :hasNum="false"
<div slot="radioHtml" :setTableFinishFun="setTableFinishFun"
class="store-table" >
slot-scope="scope"> <div
<el-radio v-model="curInfo.id" slot="radioHtml"
:label="scope.scope.id" class="store-table"
@click.native="handleClick(scope.scope)"></el-radio> slot-scope="scope"
>
<el-radio
v-model="curInfo.id"
:label="scope.scope.id"
@click.native="handleClick(scope.scope)"
></el-radio>
</div> </div>
<div slot="selfRadioHtml" <div
class="store-table" slot="selfRadioHtml"
slot-scope="scope"> class="store-table"
<el-radio v-model="curInfo.goodsId" slot-scope="scope"
:label="scope.scope.goodsId" >
@click.native="handleClick(scope.scope)"></el-radio> <el-radio
v-model="curInfo.goodsId"
:label="scope.scope.goodsId"
@click.native="handleClick(scope.scope)"
></el-radio>
</div> </div>
<div slot="imageSlot" slot-scope="scope"> <div
<el-popover placement="top" width="160" trigger="hover" popper-class="table-popover-block"> slot="imageSlot"
<img class="table-popover-img" :src="scope.scope.goodsImage" /> slot-scope="scope"
<img class="img-36 pointer" slot="reference" :src="scope.scope.goodsImage" /> >
<el-popover
placement="top"
width="160"
trigger="hover"
popper-class="table-popover-block"
>
<img
class="table-popover-img"
:src="scope.scope.goodsImage"
/>
<img
class="img-36 pointer"
slot="reference"
:src="scope.scope.goodsImage"
/>
</el-popover> </el-popover>
</div> </div>
<div slot="goodsNameSlot" class="goodsNameSlot" slot-scope="scope"> <template
<img :src="scope.scope.goodsImage" alt="">{{ scope.scope.goodsName }} slot="gasImageSlot"
slot-scope="scope"
>
<el-popover
placement="top"
width="160"
trigger="hover"
popper-class="table-popover-block"
>
<img
class="table-popover-img"
:src="scope.scope.aliasUrl"
/>
<img
class="img-36 pointer"
slot="reference"
:src="scope.scope.aliasUrl"
/>
</el-popover>
</template>
<div
slot="goodsNameSlot"
class="goodsNameSlot"
slot-scope="scope"
>
<img
:src="scope.scope.goodsImage"
alt=""
>{{ scope.scope.goodsName }}
</div> </div>
</GLTable> </GLTable>
</GLDialog> </GLDialog>
...@@ -61,67 +123,105 @@ ...@@ -61,67 +123,105 @@
<script> <script>
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
const MERCHANT_SEARCH_ITEM = { const MERCHANT_SEARCH_ITEM = {
label: '门店名称', label: '门店名称',
name: 'merchantName', name: 'merchantName',
type: 'input', type: 'input',
width: '200px', width: '200px',
labelWidth: '10px', labelWidth: '10px',
isClear: true isClear: true
} }
const defaultTableCol = [ const defaultTableCol = [
{ {
label: '', label: '',
prop: '', prop: '',
width: 80, width: 80,
addHtml: 'radioHtml' addHtml: 'radioHtml'
}, },
{ {
label: '商品名称', label: '商品名称',
prop: 'goodsName' prop: 'goodsName'
}, },
{ {
label: '缩略图', label: '缩略图',
addHtml: 'imageSlot' addHtml: 'imageSlot'
}, },
{ {
label: '价格(元)', label: '价格(元)',
formatter: cellValue => { formatter: cellValue => {
return cellValue.retailPrice ? Number(Number(cellValue.retailPrice/100).toFixed(2)) : '--' return cellValue.retailPrice ? Number(Number(cellValue.retailPrice / 100).toFixed(2)) : '--'
} }
} }
] ]
const merchantGoodsTableCol = [ const merchantGoodsTableCol = [
{ {
label: '', label: '',
prop: '', prop: '',
width: 80, width: 80,
addHtml: 'selfRadioHtml' addHtml: 'selfRadioHtml'
}, },
{ {
label: '商品信息', label: '商品信息',
addHtml: 'goodsNameSlot' addHtml: 'goodsNameSlot'
}, },
{ {
label: '门店名称', label: '门店名称',
prop: 'merchantName' prop: 'merchantName'
}, },
{ {
label: '零售价(元)', label: '零售价(元)',
formatter: cellValue => { formatter: cellValue => {
return cellValue.retailPrice ? Number(Number(cellValue.retailPrice/100).toFixed(2)) : '--' return cellValue.retailPrice ? Number(Number(cellValue.retailPrice / 100).toFixed(2)) : '--'
} }
}, },
{ {
label: '划线价(元)', label: '划线价(元)',
formatter: cellValue => { formatter: cellValue => {
return cellValue.originalPrice ? Number(Number(cellValue.originalPrice/100).toFixed(2)) : '--' return cellValue.originalPrice ? Number(Number(cellValue.originalPrice / 100).toFixed(2)) : '--'
} }
} }
] ]
const gasGoodsTableCol = [
{
label: '',
prop: '',
width: 80,
addHtml: 'radioHtml'
},
{
label: '商品编码',
prop: 'alias'
},
{
label: '商品图片',
addHtml: 'gasImageSlot'
},
{
label: '商品信息',
prop: 'aliasName'
},
{
label: '销售价/元',
formatter: cellValue => {
return cellValue.salesPrice ? Number(Number(cellValue.salesPrice / 100).toFixed(2)) : '--'
}
},
{
label: '面额/元',
prop: 'faceValue'
},
{
label: '成本/元',
prop: 'sellPrice'
},
{
label: '库存',
prop: 'stock'
},
]
export default { export default {
name: 'selectStore', name: 'selectStore',
data() { data () {
return { return {
url: url, url: url,
searchForm: { searchForm: {
...@@ -149,17 +249,16 @@ export default { ...@@ -149,17 +249,16 @@ export default {
pageSize: 10, pageSize: 10,
pageNum: 1 pageNum: 1
}, },
getListApi: this.$apis.goods.getCarlifeGoodsApi, getListApi: null,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableColumns:defaultTableCol tableColumns: {}
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
pageSizes: [5, 10, 20, 30, 40], pageSizes: [5, 10, 20, 30, 40],
baseData: {} baseData: {}
} }
}, },
props: { props: {
dialogVisible: { dialogVisible: {
type: Boolean, type: Boolean,
...@@ -167,17 +266,17 @@ export default { ...@@ -167,17 +266,17 @@ export default {
}, },
routeInfo: { routeInfo: {
type: Object, type: Object,
default: ()=> {} default: () => { }
}, },
storeSearchForm: { storeSearchForm: {
type: Object type: Object
}, },
goodsInfo: { goodsInfo: {
required: true, required: true,
default: ()=> {} default: () => { }
} }
}, },
created() { created () {
// let { smartcarlifeInfoId, goodsName, coverList, goodsImage, minSellPrice, retailPrice } = this.goodsInfo || {} // let { smartcarlifeInfoId, goodsName, coverList, goodsImage, minSellPrice, retailPrice } = this.goodsInfo || {}
// this.curInfo = { // this.curInfo = {
// id: smartcarlifeInfoId, // id: smartcarlifeInfoId,
...@@ -186,25 +285,34 @@ export default { ...@@ -186,25 +285,34 @@ export default {
// minSellPrice: minSellPrice ? Number(Number(minSellPrice*10*10).toFixed(0)) : 0, // minSellPrice: minSellPrice ? Number(Number(minSellPrice*10*10).toFixed(0)) : 0,
// retailPrice: retailPrice ? Number(Number(retailPrice*10*10).toFixed(0)) : 0, // retailPrice: retailPrice ? Number(Number(retailPrice*10*10).toFixed(0)) : 0,
// } // }
this.searchForm.discoverGoodsId = this.routeInfo.type == 2 ? this.routeInfo.id : '' //1查看,2编辑,空是新增,编辑进来要传id const { goodsSource } = this.goodsInfo
this.searchForm.discoverGoodsId = this.routeInfo.type == 2 ? this.routeInfo.id : '' //1查看,2编辑,空是新增,编辑进来要传id
this.searchForm.goodsType = this.routeInfo.goodsType // 1是配置 2是车主 this.searchForm.goodsType = this.routeInfo.goodsType // 1是配置 2是车主
if(this.goodsInfo.goodsSource==2){ //来源是门店自营的搜素和列表字段都要改 if (goodsSource == 2) { //来源是门店自营的搜素和列表字段都要改
this.searchFormData.push(MERCHANT_SEARCH_ITEM) this.searchFormData.push(MERCHANT_SEARCH_ITEM)
this.tableParams.tableColumns = merchantGoodsTableCol
this.getListApi = this.$apis.goods.getSelfSupportGoodsApi
} }
this.tableParams.tableColumns = {
1: defaultTableCol,
2: merchantGoodsTableCol,
3: gasGoodsTableCol
}[goodsSource]
this.getListApi = this.$apis.goods[{
1: 'getCarlifeGoodsApi',
2: 'getSelfSupportGoodsApi',
3: 'getOilCouponListApi'
}[goodsSource]]
}, },
mounted() { mounted () {
let clientHeight = document.documentElement.clientHeight let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 0.15 * clientHeight - 425 this.heightBox = clientHeight - 0.15 * clientHeight - 425
}, },
methods: { methods: {
resetTable() { resetTable () {
this.$refs.goodsRef.refreshTable() this.$refs.goodsRef.refreshTable()
}, },
resetSearch(){ resetSearch () {
this.searchForm = { this.searchForm = {
goodsName: '', goodsName: '',
discoverGoodsId: '', discoverGoodsId: '',
...@@ -212,48 +320,48 @@ export default { ...@@ -212,48 +320,48 @@ export default {
} }
this.resetTable() this.resetTable()
}, },
beforeSearchFn() { beforeSearchFn () {
return new Promise(resolve => { return new Promise(resolve => {
if(this.goodsInfo.goodsSource==2){ if (this.goodsInfo.goodsSource == 2) {
delete this.searchForm.goodsType delete this.searchForm.goodsType
} }
resolve() resolve()
}) })
}, },
setTableFinishFun() { setTableFinishFun () {
this.$refs.goodsRef.tableHeightValues = '460px' this.$refs.goodsRef.tableHeightValues = '460px'
}, },
handleClick(item) { handleClick (item) {
console.log(item) console.log(item)
this.curInfo = item this.curInfo = item
}, },
handleClose() { handleClose () {
this.$emit('handleGoodsClose') this.$emit('handleGoodsClose')
}, },
handleConfirm() { handleConfirm () {
this.$emit('handleGoodsConfirm', this.curInfo) if (Object.keys(this.curInfo).length) this.$emit('handleGoodsConfirm', this.curInfo)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/.glsx-combi-form .el-form{ /deep/.glsx-combi-form .el-form {
.el-form-item{ .el-form-item {
margin-right: 12px!important; margin-right: 12px !important;
} }
.el-button { .el-button {
margin-top: 1px; margin-top: 1px;
} }
} }
.goodsNameSlot{ .goodsNameSlot {
img{ img {
width: 36px; width: 36px;
height: 36px; height: 36px;
vertical-align: middle; vertical-align: middle;
margin-right: 8px; margin-right: 8px;
} }
} }
.select-store { .select-store {
......
<template> <template>
<div class="prefer-list-cntr"> <div class="prefer-list-cntr">
<div class="table-wrap"> <div class="table-wrap">
<GLCombiForm ref="showSearch" class="search-wrap" :rowNumber="1" :formObj="tableSearchForm" <GLCombiForm
:formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"> ref="showSearch"
class="search-wrap"
:rowNumber="1"
:formObj="tableSearchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
>
</GLCombiForm> </GLCombiForm>
<div class="operate-wrap"> <div class="operate-wrap">
<span class="table-title">车主优选商品列表</span> <span class="table-title">车主优选商品列表</span>
<div> <div>
<el-button class="operate-btn" type="primary" size="small" @click="handleAdd">新增商品</el-button> <el-button
<el-button size="small" @click="handleExport">导出</el-button> class="operate-btn"
type="primary"
size="small"
@click="handleAdd"
>新增商品</el-button>
<el-button
size="small"
@click="handleExport"
>导出</el-button>
</div> </div>
</div> </div>
<GLTable ref="channelRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" <GLTable
:beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" ref="channelRef"
@setTableFinishFun="setTableFinishFun"> :getListApi="getListApi"
<div slot="imageSlot" class="table-image" slot-scope="scope"> :noDataImg="url"
<el-popover placement="top" width="160" trigger="hover" popper-class="table-popover-block"> :searchForm="searchForm"
<img class="table-popover-img" :src="scope.scope.goodsImage"/> :beforeSearchFn="beforeSearchFn"
<img class="img-36 pointer" slot="reference" :src="scope.scope.goodsImage"/> :tableParams="tableParams"
:pageConf="pageConf"
@setTableFinishFun="setTableFinishFun"
>
<div
slot="imageSlot"
class="table-image"
slot-scope="scope"
>
<el-popover
placement="top"
width="160"
trigger="hover"
popper-class="table-popover-block"
>
<img
class="table-popover-img"
:src="scope.scope.goodsImage"
/>
<img
class="img-36 pointer"
slot="reference"
:src="scope.scope.goodsImage"
/>
</el-popover> </el-popover>
</div> </div>
<div slot="statusSlot" slot-scope="scope"> <div
slot="statusSlot"
slot-scope="scope"
>
<span :class="['status', scope.scope.goodsStatus==1 ? 'success-status': 'error-status']"></span> <span :class="['status', scope.scope.goodsStatus==1 ? 'success-status': 'error-status']"></span>
<span>{{ scope.scope.goodsStatus == 1 ? '上架' : '下架' }}</span> <span>{{ scope.scope.goodsStatus == 1 ? '上架' : '下架' }}</span>
</div> </div>
<div slot="merchantNameSlot" slot-scope="scope"> <div
slot="merchantNameSlot"
slot-scope="scope"
>
<template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"> <template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1">
<span>{{ filterData(scope.scope,'merchantName').slice(0, 1).join('、') }}</span> <span>{{ filterData(scope.scope,'merchantName').slice(0, 1).join('、') }}</span>
<el-popover <el-popover
placement="top" placement="top"
width="fit-content" width="fit-content"
trigger="hover"> trigger="hover"
<div v-for="(item,index) in filterData(scope.scope, 'merchantName')" :key="index"> >
<div
v-for="(item,index) in filterData(scope.scope, 'merchantName')"
:key="index"
>
{{ item }} {{ item }}
</div> </div>
<span class="more-info" slot="reference">...[{{ scope.scope.saleMerchantList.length }}]</span> <span
class="more-info"
slot="reference"
>...[{{ scope.scope.saleMerchantList.length }}]</span>
</el-popover> </el-popover>
</template> </template>
<template v-else> <template v-else>
...@@ -42,17 +93,27 @@ ...@@ -42,17 +93,27 @@
<span v-else>{{ filterData(scope.scope, 'merchantName').join('、') }}</span> <span v-else>{{ filterData(scope.scope, 'merchantName').join('、') }}</span>
</template> </template>
</div> </div>
<div slot="merchantPriceSlot" slot-scope="scope"> <div
slot="merchantPriceSlot"
slot-scope="scope"
>
<template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"> <template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1">
<span>{{ filterData(scope.scope, 'price').slice(0, 1).join('、') }}</span> <span>{{ filterData(scope.scope, 'price').slice(0, 1).join('、') }}</span>
<el-popover <el-popover
placement="top" placement="top"
width="fit-content" width="fit-content"
trigger="hover"> trigger="hover"
<div v-for="(item,index) in filterData(scope.scope, 'price')" :key="index"> >
<div
v-for="(item,index) in filterData(scope.scope, 'price')"
:key="index"
>
{{ item }} {{ item }}
</div> </div>
<span class="more-info" slot="reference">...[{{ scope.scope.saleMerchantList.length }}]</span> <span
class="more-info"
slot="reference"
>...[{{ scope.scope.saleMerchantList.length }}]</span>
</el-popover> </el-popover>
</template> </template>
<template v-else> <template v-else>
...@@ -61,30 +122,40 @@ ...@@ -61,30 +122,40 @@
</template> </template>
</div> </div>
<div <div
slot="linkText" slot="linkText"
slot-scope="scope" slot-scope="scope"
> >
<template v-if="scope.scope.incrementFlag == 'Y' || hideStatus"> <template v-if="scope.scope.incrementFlag == 'Y' || hideStatus">
{{ scope.scope[scope.prop] || 0 }} {{ scope.scope[scope.prop] || 0 }}
</template> </template>
<template v-else> <template v-else>
<p <p
class="cursor-pointer" class="cursor-pointer"
@click="handleDetail(scope)" @click="handleDetail(scope)"
>{{ scope.scope[scope.prop] || 0 }}</p> >{{ scope.scope[scope.prop] || 0 }}</p>
</template> </template>
</div> </div>
<div slot="giveIntegralSlot" slot-scope="scope"> <div
slot="giveIntegralSlot"
slot-scope="scope"
>
<template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"> <template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1">
<span>{{ filterData(scope.scope, 'score').slice(0, 1).join('、') }}</span> <span>{{ filterData(scope.scope, 'score').slice(0, 1).join('、') }}</span>
<el-popover <el-popover
placement="top" placement="top"
width="400" width="400"
trigger="hover"> trigger="hover"
<div v-for="(item,index) in filterData(scope.scope,'score')" :key="index"> >
<div
v-for="(item,index) in filterData(scope.scope,'score')"
:key="index"
>
{{ item }} {{ item }}
</div> </div>
<span class="more-info" slot="reference">...({{ scope.scope.saleMerchantList.length }})</span> <span
class="more-info"
slot="reference"
>...({{ scope.scope.saleMerchantList.length }})</span>
</el-popover> </el-popover>
</template> </template>
<template v-else> <template v-else>
...@@ -92,17 +163,27 @@ ...@@ -92,17 +163,27 @@
<span v-else>{{ filterData(scope.scope, 'score').join('、') }}</span> <span v-else>{{ filterData(scope.scope, 'score').join('、') }}</span>
</template> </template>
</div> </div>
<div slot="exchangeIntegralSlot" slot-scope="scope"> <div
slot="exchangeIntegralSlot"
slot-scope="scope"
>
<template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"> <template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1">
<span>{{ filterData(scope.scope, 'exchange').slice(0, 1).join('、') }}</span> <span>{{ filterData(scope.scope, 'exchange').slice(0, 1).join('、') }}</span>
<el-popover <el-popover
placement="top" placement="top"
width="400" width="400"
trigger="hover"> trigger="hover"
<div v-for="(item,index) in filterData(scope.scope,'exchange')" :key="index"> >
<div
v-for="(item,index) in filterData(scope.scope,'exchange')"
:key="index"
>
{{ item }} {{ item }}
</div> </div>
<span class="more-info" slot="reference">...({{ scope.scope.saleMerchantList.length }})</span> <span
class="more-info"
slot="reference"
>...({{ scope.scope.saleMerchantList.length }})</span>
</el-popover> </el-popover>
</template> </template>
<template v-else> <template v-else>
...@@ -110,8 +191,16 @@ ...@@ -110,8 +191,16 @@
<span v-else>{{ filterData(scope.scope, 'exchange').join('、') }}</span> <span v-else>{{ filterData(scope.scope, 'exchange').join('、') }}</span>
</template> </template>
</div> </div>
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="4"></GLTableButton> class="table-btns"
slot="auth-button"
slot-scope="scope"
>
<GLTableButton
:buttonList="buttonList"
:buttonItem="scope"
:buttonNum="4"
></GLTableButton>
</div> </div>
</GLTable> </GLTable>
</div> </div>
...@@ -123,7 +212,7 @@ import url from '@/assets/empty.png' ...@@ -123,7 +212,7 @@ import url from '@/assets/empty.png'
import { exportFn } from '@/common/constant' import { exportFn } from '@/common/constant'
export default { export default {
name: 'App', name: 'App',
data() { data () {
return { return {
tableSearchForm: { tableSearchForm: {
channelName: '', channelName: '',
...@@ -133,7 +222,7 @@ export default { ...@@ -133,7 +222,7 @@ export default {
merchantName: '', merchantName: '',
goodsType: '2', goodsType: '2',
}, },
tabPaneList: [{name: 'sa', label: '配置升级'}, {name: 'sa', label: '车主优选'}], tabPaneList: [{ name: 'sa', label: '配置升级' }, { name: 'sa', label: '车主优选' }],
buttonList: [ buttonList: [
{ {
type: 'el-button', type: 'el-button',
...@@ -214,7 +303,7 @@ export default { ...@@ -214,7 +303,7 @@ export default {
type: 'datePicker', type: 'datePicker',
isClear: true, isClear: true,
customPickerOptions: { customPickerOptions: {
disabledDate(date) { disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate())) const yesterday = new Date(new Date().setDate(new Date().getDate()))
if (date > yesterday) { if (date > yesterday) {
return true return true
...@@ -242,12 +331,16 @@ export default { ...@@ -242,12 +331,16 @@ export default {
}, },
{ {
id: 1, id: 1,
name: '嘀加智享' name: '嘀加智享平台'
}, },
{ {
id: 2, id: 2,
name: '门店自营' name: '门店自营'
}, },
{
id: 3,
name: '油券'
},
], ],
optionId: 'id', optionId: 'id',
optionLabel: 'name' optionLabel: 'name'
...@@ -270,7 +363,11 @@ export default { ...@@ -270,7 +363,11 @@ export default {
prop: 'goodsSource', prop: 'goodsSource',
width: 150, width: 150,
formatter: cellValue => { formatter: cellValue => {
return cellValue.goodsSource==1 ? '嘀加智享平台' : '门店自营' return {
1: '嘀加智享平台',
2: '门店自营',
3: '油券'
}[cellValue.goodsSource]
} }
}, },
{ {
...@@ -360,17 +457,17 @@ export default { ...@@ -360,17 +457,17 @@ export default {
}, },
] ]
}, },
pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total'} pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
} }
}, },
created() { created () {
this.getCategory() this.getCategory()
}, },
mounted() { mounted () {
}, },
methods: { methods: {
// 明细 // 明细
handleDetail({prop, scope}) { handleDetail ({ prop, scope }) {
let data = { let data = {
viewAmount: { viewAmount: {
type: 1, type: 1,
...@@ -392,19 +489,19 @@ export default { ...@@ -392,19 +489,19 @@ export default {
activityName: scope.goodsName, activityName: scope.goodsName,
type: data.type, type: data.type,
count: data.count, count: data.count,
activeName:'2' activeName: '2'
} }
}) })
}, },
handleExport () { handleExport () {
var params = this.$common.utils.deepClone(this.searchForm) var params = this.$common.utils.deepClone(this.searchForm)
params.goodsType = 2 params.goodsType = 2
this.$apis.goods.exportGoodsApi(params).then(res => { this.$apis.goods.exportGoodsApi(params).then(res => {
exportFn(res) exportFn(res)
}) })
}, },
getCategory() { getCategory () {
const params = { const params = {
pageSize: 10000, pageSize: 10000,
pageNum: 1, pageNum: 1,
...@@ -418,11 +515,11 @@ export default { ...@@ -418,11 +515,11 @@ export default {
} }
}) })
}, },
selectCategory(e) { selectCategory (e) {
this.tableSearchForm.associationClassifyFirstId = e?.parent?.id this.tableSearchForm.associationClassifyFirstId = e?.parent?.id
this.tableSearchForm.associationClassifySecondId = e?.data?.id this.tableSearchForm.associationClassifySecondId = e?.data?.id
}, },
shelfGoodsFn(item, type) { shelfGoodsFn (item, type) {
if (type == 1) { if (type == 1) {
this.updateStatus(item.id, type) this.updateStatus(item.id, type)
} else { } else {
...@@ -438,14 +535,14 @@ export default { ...@@ -438,14 +535,14 @@ export default {
}) })
} }
}, },
delGoodsFn(item) { delGoodsFn (item) {
this.$confirm(`确定删除该商品吗`, '提示', { this.$confirm(`确定删除该商品吗`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
callback: action => { callback: action => {
if (action == 'confirm') { if (action == 'confirm') {
this.$apis.goods.delGoodsApi({id: item.id}).then(res => { this.$apis.goods.delGoodsApi({ id: item.id }).then(res => {
if (res) { if (res) {
this.$message.success('删除成功') this.$message.success('删除成功')
this.handleSearch() this.handleSearch()
...@@ -455,33 +552,33 @@ export default { ...@@ -455,33 +552,33 @@ export default {
} }
}) })
}, },
updateStatus(id, goodsStatus) { updateStatus (id, goodsStatus) {
this.$apis.goods.updateGoodsStatusApi({id, goodsStatus}).then(res => { this.$apis.goods.updateGoodsStatusApi({ id, goodsStatus }).then(res => {
if (res) { if (res) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleSearch() this.handleSearch()
} }
}) })
}, },
filterData({saleMerchantList: list}, type) { filterData ({ saleMerchantList: list }, type) {
if (type=='score') { if (type == 'score') {
return list?.map(item => { return list?.map(item => {
return `${item.merchantName || '--'}:${item.giveIntegral || '0'}` return `${item.merchantName || '--'}:${item.giveIntegral || '0'}`
}) || [] }) || []
} else if(type=='exchange'){ } else if (type == 'exchange') {
return list?.map(item => { return list?.map(item => {
return `${item.merchantName || '--'}:${item.exchangeIntegral || '否'}` return `${item.merchantName || '--'}:${item.exchangeIntegral || '否'}`
}) || [] }) || []
}else if(type=='price') { } else if (type == 'price') {
return list?.map(item => { return list?.map(item => {
let activityPrice = item.activityPrice ? Number((Number(item.activityPrice) / 100).toFixed(2)) : 0 let activityPrice = item.activityPrice ? Number((Number(item.activityPrice) / 100).toFixed(2)) : 0
return `${activityPrice || '0'}` return `${activityPrice || '0'}`
}) || [] }) || []
}else{ } else {
return list?.map(item => item.merchantName) || [] return list?.map(item => item.merchantName) || []
} }
}, },
getParams() { getParams () {
var params = JSON.parse(JSON.stringify(this.tableSearchForm)) var params = JSON.parse(JSON.stringify(this.tableSearchForm))
if (this.tableSearchForm.createDate.length) { if (this.tableSearchForm.createDate.length) {
params.startCreatedDate = new Date(this.tableSearchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00' params.startCreatedDate = new Date(this.tableSearchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
...@@ -489,17 +586,17 @@ export default { ...@@ -489,17 +586,17 @@ export default {
} }
return params return params
}, },
beforeSearchFn() { beforeSearchFn () {
return new Promise(resolve => { return new Promise(resolve => {
this.searchForm = this.getParams() this.searchForm = this.getParams()
delete this.searchForm.createDate delete this.searchForm.createDate
resolve() resolve()
}) })
}, },
handleSearch() { handleSearch () {
this.$refs.channelRef.refreshTable() this.$refs.channelRef.refreshTable()
}, },
handleReset() { handleReset () {
this.tableSearchForm = { this.tableSearchForm = {
goodsType: '2', goodsType: '2',
createDate: [], createDate: [],
...@@ -507,15 +604,15 @@ export default { ...@@ -507,15 +604,15 @@ export default {
associationClassifySecondId: '', associationClassifySecondId: '',
merchantName: '' merchantName: ''
}, },
this.$refs?.cascaderRef?.curBrand && (this.$refs.cascaderRef.curBrand = {}) this.$refs?.cascaderRef?.curBrand && (this.$refs.cascaderRef.curBrand = {})
this.searchForm = {} this.searchForm = {}
this.handleSearch() this.handleSearch()
}, },
setTableFinishFun() { setTableFinishFun () {
//接收到的数据为空 //接收到的数据为空
this.$refs.channelRef.data.length ? (this.$refs.channelRef.tableHeightValues = '') : this.$refs.channelRef.setTableHeightFun() this.$refs.channelRef.data.length ? (this.$refs.channelRef.tableHeightValues = '') : this.$refs.channelRef.setTableHeightFun()
}, },
handleAdd(row = {}, type) { handleAdd (row = {}, type) {
const params = { const params = {
goodsType: '2' goodsType: '2'
} }
...@@ -527,7 +624,7 @@ export default { ...@@ -527,7 +624,7 @@ export default {
} }
const queryStr = encodeURIComponent(JSON.stringify(params)) const queryStr = encodeURIComponent(JSON.stringify(params))
this.$router.push({path: `/goods/addPrefer/` + queryStr, query: {$title: title}}) this.$router.push({ path: `/goods/addPrefer/` + queryStr, query: { $title: title } })
} }
} }
} }
...@@ -550,7 +647,7 @@ export default { ...@@ -550,7 +647,7 @@ export default {
} }
.success-status { .success-status {
background-color: #37C67F; background-color: #37c67f;
} }
.error-status { .error-status {
...@@ -559,13 +656,13 @@ export default { ...@@ -559,13 +656,13 @@ export default {
.more-info { .more-info {
white-space: nowrap; white-space: nowrap;
color: #5850FF; color: #5850ff;
cursor: pointer; cursor: pointer;
} }
} }
} }
.cursor-pointer{ .cursor-pointer {
cursor:pointer; cursor: pointer;
color:#5850FF; color: #5850ff;
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!