Commit ca39bf88 by 李伟康

提交

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