Commit 56c36e4e by 李伟康

提交

1 parent 0362e858
...@@ -162,6 +162,16 @@ const getOilCouponListApi = params => { ...@@ -162,6 +162,16 @@ const getOilCouponListApi = params => {
data: params data: params
}) })
} }
const getAllMerchantListApi = params => {
params.method = 'scrm.api.carlife.merchant.listWithPageByCurMerchant'
return http({
url: 'rop-scrm-carlife/router',
method: 'POST',
data: params,
sign: true
})
}
export default { export default {
getGoodsListApi, getGoodsListApi,
updateGoodsStatusApi, updateGoodsStatusApi,
...@@ -177,5 +187,6 @@ export default { ...@@ -177,5 +187,6 @@ export default {
exportBrowseApi, exportBrowseApi,
exportGoodsApi, exportGoodsApi,
getSelfGoodsDetailApi, getSelfGoodsDetailApi,
getOilCouponListApi getOilCouponListApi,
getAllMerchantListApi
} }
\ No newline at end of file \ No newline at end of file
...@@ -948,8 +948,8 @@ export default { ...@@ -948,8 +948,8 @@ export default {
this.goodsVisible = false this.goodsVisible = false
}, },
handleGoodsConfirm (e) { handleGoodsConfirm (e) {
console.log(e) const {goodsSource} = this.formObj
if (this.formObj.smartcarlifeInfoId != e?.id) this.saleMerchantList = [] if (this.formObj.smartcarlifeInfoId != e?.id && goodsSource != 3) 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
retailPrice = retailPrice ? Number(Number(retailPrice / 100).toFixed(2)) : 0 retailPrice = retailPrice ? Number(Number(retailPrice / 100).toFixed(2)) : 0
...@@ -1019,7 +1019,8 @@ export default { ...@@ -1019,7 +1019,8 @@ export default {
this.closeDialog() this.closeDialog()
}, },
closeDialog () { closeDialog () {
if (!this.merchantDialogVisible && !this.formObj.smartcarlifeInfoId) { const { goodsSource } = this.formObj
if (goodsSource != 3 && !this.merchantDialogVisible && !this.formObj.smartcarlifeInfoId) {
return this.$message.error('请先选择商品') return this.$message.error('请先选择商品')
} }
this.merchantDialogVisible = !this.merchantDialogVisible this.merchantDialogVisible = !this.merchantDialogVisible
...@@ -1040,6 +1041,7 @@ export default { ...@@ -1040,6 +1041,7 @@ export default {
delete obj.styleBImgList delete obj.styleBImgList
let saleMerchantList = this.saleMerchantList.map(item => { let saleMerchantList = this.saleMerchantList.map(item => {
let { merchantId, merchantName, activityPrice, giveIntegral, originalPrice, exchangeIntegralFlag, exchangeIntegral } = item let { merchantId, merchantName, activityPrice, giveIntegral, originalPrice, exchangeIntegralFlag, exchangeIntegral } = item
if (obj.goodsSource == 3) merchantId = item.merchantNo
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 }
......
...@@ -342,6 +342,7 @@ export default { ...@@ -342,6 +342,7 @@ export default {
}, },
handleConfirm () { handleConfirm () {
if (Object.keys(this.curInfo).length) this.$emit('handleGoodsConfirm', this.curInfo) if (Object.keys(this.curInfo).length) this.$emit('handleGoodsConfirm', this.curInfo)
else this.$message.error('请选择商品')
} }
} }
} }
......
<template> <template>
<GLDialog bigTitle="选择门店" mode="big" :visible.sync="isVisible" :show-close="true" :before-close="handleClose" :close-on-click-modal="false" @onOk="onOk" @onCancel="handleClose"> <GLDialog
bigTitle="选择门店"
mode="big"
:visible.sync="isVisible"
:show-close="true"
:before-close="handleClose"
:close-on-click-modal="false"
@onOk="onOk"
@onCancel="handleClose"
>
<div class="dialog_body"> <div class="dialog_body">
<!-- <GLCombiForm :rowNumber="1" class="dialog_search" ref="searchRef" :formObj="dialogSearchForm" :formData="dialogFormData" @handleOk="handleOk" @handleRest="handleRest"></GLCombiForm> --> <!-- <GLCombiForm :rowNumber="1" class="dialog_search" ref="searchRef" :formObj="dialogSearchForm" :formData="dialogFormData" @handleOk="handleOk" @handleRest="handleRest"></GLCombiForm> -->
<div class="dialog_table"> <div class="dialog_table">
<GLTable v-if="showTable" :hasPage="false" :pageSizes="pageSizes" ref="tableRef" :beforeSearchFn="beforeSearchFn" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun" :searchForm="dialogSearchForm" :tableParams="tableParams" :getListApi="getListApi"> <GLTable
<div slot="spreadPrice" slot-scope="scope"> v-if="showTable"
:hasPage="isOil"
:pageSizes="pageSizes"
ref="tableRef"
:beforeSearchFn="beforeSearchFn"
:pageConf="pageConf"
@setTableFinishFun="setTableFinishFun"
:searchForm="dialogSearchForm"
:tableParams="tableParams"
:getListApi="getListApi"
>
<div
slot="spreadPrice"
slot-scope="scope"
>
<span :style="{ color: Number(scope.scope.lineationPrice - scope.scope.costPrice) <= 0 ? '#eb4e4e' : '#666666' }">{{ Number(Number(scope.scope.lineationPrice - scope.scope.costPrice).toFixed(1)) }}</span> <span :style="{ color: Number(scope.scope.lineationPrice - scope.scope.costPrice) <= 0 ? '#eb4e4e' : '#666666' }">{{ Number(Number(scope.scope.lineationPrice - scope.scope.costPrice).toFixed(1)) }}</span>
</div> </div>
</GLTable> </GLTable>
...@@ -23,14 +46,14 @@ export default { ...@@ -23,14 +46,14 @@ export default {
}, },
selectedList: { selectedList: {
type: Array, type: Array,
default: ()=> [] default: () => []
}, },
goodsId:{ goodsId: {
type: String, type: String,
default: '' default: ''
} }
}, },
data() { data () {
return { return {
showTable: true, showTable: true,
copyList: [], copyList: [],
...@@ -55,7 +78,7 @@ export default { ...@@ -55,7 +78,7 @@ export default {
isClear: true isClear: true
} }
], ],
getListApi: this.$apis.goods.getMerchantListApi, getListApi: null,
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
tableParams: { tableParams: {
listName: 'merchantList', listName: 'merchantList',
...@@ -72,24 +95,29 @@ export default { ...@@ -72,24 +95,29 @@ export default {
prop: 'merchantId' prop: 'merchantId'
}, },
] ]
} },
isOil: this.$parent.formObj.goodsSource == 3
} }
}, },
created() { created () {
const { isOil } = this
this.copyList = JSON.parse(JSON.stringify(this.selectedList)) this.copyList = JSON.parse(JSON.stringify(this.selectedList))
this.getListApi = this.$apis.goods[isOil ? 'getAllMerchantListApi' : 'getMerchantListApi']
this.tableParams.listName = isOil ? 'list' : 'merchantList'
this.tableParams.tableColumns[1].prop = isOil ? 'merchantNo' : 'merchantId'
}, },
methods: { methods: {
handleOk() { handleOk () {
this.$refs.tableRef.refreshTable() this.$refs.tableRef.refreshTable()
}, },
handleRest() { handleRest () {
this.dialogSearchForm = { this.dialogSearchForm = {
merchantName: '', merchantName: '',
merchantId: '' merchantId: ''
} }
this.handleOk() this.handleOk()
}, },
beforeSearchFn(){ beforeSearchFn () {
return new Promise(resolve => { return new Promise(resolve => {
this.dialogSearchForm = { this.dialogSearchForm = {
id: this.goodsId id: this.goodsId
...@@ -97,7 +125,7 @@ export default { ...@@ -97,7 +125,7 @@ export default {
resolve() resolve()
}) })
}, },
onOk() { onOk () {
let list = this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName] || [] let list = this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName] || []
// for (let i = 0; i < this.selectedList.length; i++) { // for (let i = 0; i < this.selectedList.length; i++) {
// let idx = list.findIndex(item => item.id == this.selectedList[i].id) // let idx = list.findIndex(item => item.id == this.selectedList[i].id)
...@@ -107,19 +135,20 @@ export default { ...@@ -107,19 +135,20 @@ export default {
// } // }
list.map(item => this.$set(item, 'activityPrice', '')) list.map(item => this.$set(item, 'activityPrice', ''))
list.map(item => this.$set(item, 'originalPrice', '')) list.map(item => this.$set(item, 'originalPrice', ''))
this.$emit('confirmDialog', [...list, ...this.copyList]) this.$emit('confirmDialog', [...list, ...this.copyList])
}, },
handleClose() { handleClose () {
this.$emit('closeDialog') this.$emit('closeDialog')
}, },
setTableFinishFun() { setTableFinishFun () {
const KEY = this.isOil ? 'merchantNo' : 'merchantId'
this.copyList.forEach(row => { this.copyList.forEach(row => {
this.$nextTick(() => { this.$nextTick(() => {
let idx = this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data.findIndex(item => item.merchantId == row.merchantId) let idx = this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data.findIndex(item =>item[KEY] == row[KEY])
if (idx > -1) { if (idx > -1) {
try { try {
this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data[idx], true) this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data[idx], true)
let id = this.copyList.findIndex(item => item.merchantId == row.merchantId) let id = this.copyList.findIndex(item => item[KEY] == row[KEY])
if (id > -1) this.copyList.splice(id, 1) if (id > -1) this.copyList.splice(id, 1)
} catch (err) { } catch (err) {
console.log(err) console.log(err)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!