Commit 56c36e4e by 李伟康

提交

1 parent 0362e858
......@@ -162,6 +162,16 @@ const getOilCouponListApi = 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 {
getGoodsListApi,
updateGoodsStatusApi,
......@@ -177,5 +187,6 @@ export default {
exportBrowseApi,
exportGoodsApi,
getSelfGoodsDetailApi,
getOilCouponListApi
getOilCouponListApi,
getAllMerchantListApi
}
\ No newline at end of file
......@@ -948,8 +948,8 @@ export default {
this.goodsVisible = false
},
handleGoodsConfirm (e) {
console.log(e)
if (this.formObj.smartcarlifeInfoId != e?.id) this.saleMerchantList = []
const {goodsSource} = this.formObj
if (this.formObj.smartcarlifeInfoId != e?.id && goodsSource != 3) this.saleMerchantList = []
let { id, goodsName, goodsImage, minSellPrice, retailPrice, goodsVideo, goodsId } = e || {}
minSellPrice = minSellPrice ? Number(Number(minSellPrice / 100).toFixed(2)) : 0
retailPrice = retailPrice ? Number(Number(retailPrice / 100).toFixed(2)) : 0
......@@ -1019,7 +1019,8 @@ export default {
this.closeDialog()
},
closeDialog () {
if (!this.merchantDialogVisible && !this.formObj.smartcarlifeInfoId) {
const { goodsSource } = this.formObj
if (goodsSource != 3 && !this.merchantDialogVisible && !this.formObj.smartcarlifeInfoId) {
return this.$message.error('请先选择商品')
}
this.merchantDialogVisible = !this.merchantDialogVisible
......@@ -1040,6 +1041,7 @@ export default {
delete obj.styleBImgList
let saleMerchantList = this.saleMerchantList.map(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
originalPrice = originalPrice ? Number(Number(originalPrice * 10 * 10).toFixed(0)) : 0
let saleMerchantItem = { merchantId, merchantName, activityPrice, giveIntegral, originalPrice }
......
......@@ -342,6 +342,7 @@ export default {
},
handleConfirm () {
if (Object.keys(this.curInfo).length) this.$emit('handleGoodsConfirm', this.curInfo)
else this.$message.error('请选择商品')
}
}
}
......
<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">
<!-- <GLCombiForm :rowNumber="1" class="dialog_search" ref="searchRef" :formObj="dialogSearchForm" :formData="dialogFormData" @handleOk="handleOk" @handleRest="handleRest"></GLCombiForm> -->
<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">
<div slot="spreadPrice" slot-scope="scope">
<GLTable
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>
</div>
</GLTable>
......@@ -23,14 +46,14 @@ export default {
},
selectedList: {
type: Array,
default: ()=> []
default: () => []
},
goodsId:{
goodsId: {
type: String,
default: ''
}
},
data() {
data () {
return {
showTable: true,
copyList: [],
......@@ -55,7 +78,7 @@ export default {
isClear: true
}
],
getListApi: this.$apis.goods.getMerchantListApi,
getListApi: null,
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
tableParams: {
listName: 'merchantList',
......@@ -72,24 +95,29 @@ export default {
prop: 'merchantId'
},
]
}
},
isOil: this.$parent.formObj.goodsSource == 3
}
},
created() {
created () {
const { isOil } = this
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: {
handleOk() {
handleOk () {
this.$refs.tableRef.refreshTable()
},
handleRest() {
handleRest () {
this.dialogSearchForm = {
merchantName: '',
merchantId: ''
}
this.handleOk()
},
beforeSearchFn(){
beforeSearchFn () {
return new Promise(resolve => {
this.dialogSearchForm = {
id: this.goodsId
......@@ -97,7 +125,7 @@ export default {
resolve()
})
},
onOk() {
onOk () {
let list = this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName] || []
// for (let i = 0; i < this.selectedList.length; i++) {
// let idx = list.findIndex(item => item.id == this.selectedList[i].id)
......@@ -107,19 +135,20 @@ export default {
// }
list.map(item => this.$set(item, 'activityPrice', ''))
list.map(item => this.$set(item, 'originalPrice', ''))
this.$emit('confirmDialog', [...list, ...this.copyList])
this.$emit('confirmDialog', [...list, ...this.copyList])
},
handleClose() {
handleClose () {
this.$emit('closeDialog')
},
setTableFinishFun() {
setTableFinishFun () {
const KEY = this.isOil ? 'merchantNo' : 'merchantId'
this.copyList.forEach(row => {
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) {
try {
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)
} catch (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!