Commit 9e7b461d by cwq0219

修改

1 parent 82712eff
......@@ -13,6 +13,11 @@ export function getOrderDetail(data) {
return request(data)
}
export function getOrderTotal(data) {
data.method = 'dj.api.smartcarlife.yqAdvanceOrder.total'
return request(data)
}
// 文件导入
export function recordUpload(data) {
data.method = `${path}advanceOrder.import`
......
......@@ -22,18 +22,41 @@
v-model="form.sellerMerchantId"
placeholder="请选择"
class="el_select itd"
@change="handleSellerMerchantChange"
>
<el-option
v-for="item in storeIdList"
v-for="item in parkServiceList"
:key="item.merchantId"
:value="item.merchantId"
:label="item.merchantName"
/>
</el-select>
&nbsp;&nbsp;&nbsp;<span
<!-- &nbsp;&nbsp;&nbsp;<span
class="warningFont"
v-if="nostoreError"
>暂无服务的4S店</span>
>暂无服务的4S店</span> -->
</el-form-item>
<el-form-item
id="seller"
label="预录员:"
required
v-show="userInfo.beSuper"
>
<el-radio
v-for="item in sellerList"
:key="item.userId"
v-model="form.sellerUserId"
:label="item.userId"
>{{item.name}}</el-radio>
<p
class="warningFont"
v-if="!form.sellerUserId && !hasSellError"
>请选择预录员</p>
<p
class="warningFont"
v-if="hasSellError"
>请检查是否配置员工名片!</p>
</el-form-item>
<el-form-item
......@@ -380,6 +403,9 @@ export default {
userInfo: this.$store.state.d2admin.user.info,
key: new Date(),
form: {
merchantId: '',
sellerUserId: '',
userId: '',
newCarFlag: 'Y'
},
storeIdList: [
......@@ -393,6 +419,7 @@ export default {
// }
],
adviserList: [],
sellerList: [],
customerTypeList: [
{
id: 1,
......@@ -414,6 +441,8 @@ export default {
goodList: [],
baseGoodsIds: [],
nostoreError: false,
showChooseSellError: false,
hasSellError: false,
showChooseCusError: false,
hasCusError: false,
showChoosePrError: false,
......@@ -465,6 +494,7 @@ export default {
computed: {},
mounted() {
// console.log(this.userInfo)
// this.form.sellerUserId = this.userInfo.detail.id
// this.form.sellerName = this.userInfo.detail.merchantName
this.addOrEdit = this.$route.params.addOrEdit
......@@ -472,6 +502,7 @@ export default {
this.getBaseData()
this.userInfo.beSuper && getParkStore({}).then(res => {
this.parkServiceList = res
this.userInfo.beSuper && (this.form.yqMerchantId) && this.getSeller(this.form.yqMerchantId)
})
// this.form.sellerMerchantId = this.userInfo.detail.merchantId
if (!this.userInfo.beSuper && this.addOrEdit === 'add') {
......@@ -480,7 +511,8 @@ export default {
// this.getServiceStore()
if (this.addOrEdit === 'edit') {
this.form = _.cloneDeep(this.$route.params.form)
this.form.customerSex = this.form.customerSex + ''
this.form.customerSex = this.form.customerSex ? (this.form.customerSex + '') : ''
this.userInfo.beSuper && (this.form.sellerMerchantId = this.form.yqMerchantId)
console.log(this.form)
// if (this.form.carSeriesId) {
// customer.carSeriesId = this.form.carSeriesId
......@@ -498,7 +530,7 @@ export default {
})
})
})
this.getServiceStore(this.userInfo.detail.merchantId, () => {
this.getServiceStore(this.userInfo.beSuper ? this.form.yqMerchantId : this.userInfo.detail.merchantId, () => {
this.getAdviser(this.form.merchantId, () => {
this.form.userId = this.$route.params.form.userId
this.baseGoodsIds = this.$route.params.form.baseGoodsIds
......@@ -516,6 +548,18 @@ export default {
this.productTypeList = await this.get(BaseData.productType)
},
handleSellerMerchantChange(value) {
this.getServiceStore(value)
this.adviserList = []
this.sellerList = []
this.goodList = []
this.form.merchantId = ''
this.form.sellerUserId = ''
this.form.userId = ''
this.baseGoodsIds = []
this.getSeller(value)
},
/**
* 获取服务门店
*/
......@@ -534,6 +578,23 @@ export default {
},
/**
* 根据门店园区店获取预录员账号
*/
getSeller(merchantId) {
// console.log(this.parkServiceList)
const list = this.parkServiceList
const o = list.find(k => k.merchantId == merchantId)
const channelType = o.channelType
/** 根据门店商户号获取预录员列表 */
const params = { 'merchantId': merchantId, 'channelType': channelType }
getStaff(params).then(res => {
console.log(res)
this.sellerList = res || []
this.hasSellError = !res.length
})
},
/**
* 根据门店商户号获取员工列表
*/
getAdviser(merchantId, fn = () => { }) {
......@@ -702,13 +763,20 @@ export default {
* 保存信息
*/
handleSave() {
!this.userInfo.beSuper && (this.form.sellerMerchantId = this.userInfo.detail.merchantId)
if (!this.userInfo.beSuper) {
this.form.sellerMerchantId = this.userInfo.detail.merchantId
this.form.sellerUserId = this.userInfo.detail.id
}
this.$refs.editCusFrom.validate((valid, opt) => {
const validAttrList = ['sellerMerchantId', 'merchantId', 'customerName', 'customerPhone', 'standNo']
var hasError = Object.keys(opt)
if (!this.form.sellerUserId) {
this.showChooseSellError = true
}
if (!this.form.userId) {
this.showChooseCusError = true
}
if (this.baseGoodsIds.length === 0) {
this.showChoosePrError = true
}
......@@ -728,6 +796,16 @@ export default {
...this.form
}
// const goods = []
// seller
/** 判断是否选择预录员 */
// console.log(this.form.userId)
if (this.form.sellerUserId) {
this.showChooseSellError = false
} else {
this.jumpScroll('seller')
this.showChooseSellError = true
return false
}
/** 判断是否选择销售顾问 */
// console.log(this.form.userId)
if (this.form.userId) {
......@@ -751,8 +829,8 @@ export default {
return false
}
params.sellerMerchantId = this.form.sellerMerchantId
params.sellerUserId = this.userInfo.detail.id
params.sellerName = this.userInfo.detail.merchantName
params.sellerUserId = this.form.sellerUserId
params.sellerName = this.userInfo.beSuper ? this.sellerList.find(item => item.userId === this.form.sellerUserId).name : this.userInfo.detail.accountName
params.merchantId = this.form.merchantId
params.userId = this.form.userId
// this.adviserList.find(item => item.userId === this.$route.params.form.userId).name
......@@ -799,7 +877,7 @@ export default {
params.customer = customer
console.log(params)
if (this.addOrEdit === 'add') {
params.createdBy = this.userInfo.detail.accountName
addOrder(params).then(res => {
......
......@@ -41,7 +41,7 @@
style="{display: inline-block}"
showBtnName="['预录客户']"
></auth-button>
<span class="table-header-left-txt">已预录客户列表xx条记录。</span>
<span class="table-header-left-txt">已预录客户列表{{total}}条记录。</span>
</span>
<span>
<span class="btn-tips"><img src="../../assets/icon-warn.png">所有号码已启用隐私号码保护功能!</span>
......@@ -83,7 +83,10 @@
label="园区店:"
prop="yqMerchantId"
>
<el-select v-model="fileForm.yqMerchantId">
<el-select
v-model="fileForm.yqMerchantId"
@change="handleSellerMerchantChange"
>
<el-option
v-for="item in baseData.parkServiceList"
:key="item.merchantId"
......@@ -93,6 +96,27 @@
</el-select>
</el-form-item>
<el-form-item
id="seller"
label="预录员:"
required
v-show="userInfo.beSuper"
>
<el-radio
v-for="item in baseData.sellerList"
:key="item.userId"
v-model="fileForm.sellerUserId"
:label="item.userId"
>{{item.name}}</el-radio>
<p
class="warningFont"
v-if="!fileForm.sellerUserId && !hasSellError"
>请选择预录员</p>
<p
class="warningFont"
v-if="hasSellError"
>请检查是否配置员工名片!</p>
</el-form-item>
<el-form-item
label="导入文件:"
prop="fileName"
>
......@@ -133,7 +157,7 @@
</template>
<script>
import { getList, getOrderDetail, recordUpload } from '@api/recordList'
import { getList, getOrderDetail, recordUpload, getOrderTotal } from '@api/recordList'
import { getServiceStore, getParkStore, getStaff, getGoods } from '@api/editCustomer'
import { export_json_to_excel } from '@/common/Export2Excel.js'
export default {
......@@ -143,7 +167,10 @@ export default {
userInfo: this.$store.state.d2admin.user.info,
hideVisible: false,
fileVisible: false,
fileForm: {},
fileForm: {
sellerUserId: ''
},
total: 0,
showNum: false,
importNum: {
succNum: 0,
......@@ -275,6 +302,7 @@ export default {
baseData: {
parkServiceList: [],
storeIdList: [],
sellerList: [],
adviserList: [],
goodList: []
}
......@@ -282,6 +310,10 @@ export default {
},
mounted() {
var params = this.userInfo.beSuper ? {} : { yqMerchantId: this.userInfo.detail.merchantId }
getOrderTotal(params).then(res => {
this.total = res
})
if (this.userInfo.beSuper) {
getParkStore({}).then(res => {
// console.log(res)
......@@ -318,6 +350,27 @@ export default {
}
})
},
handleSellerMerchantChange(value) {
this.fileForm.sellerUserId = ''
this.getSeller(value)
},
/**
* 根据门店园区店获取预录员账号
*/
getSeller(merchantId) {
const list = this.baseData.parkServiceList
const o = list.find(k => k.merchantId == merchantId)
const channelType = o.channelType
/** 根据门店商户号获取预录员列表 */
const params = { 'merchantId': merchantId, 'channelType': channelType }
getStaff(params).then(res => {
console.log(res)
this.baseData.sellerList = res || []
this.hasSellError = !res.length
})
},
getServiceStore(merchantId) {
getServiceStore({
yqMerchantId: merchantId
......@@ -350,6 +403,7 @@ export default {
handleImport() {
this.fileForm = {
yqMerchantId: this.userInfo.beSuper ? '' : this.userInfo.detail.merchantId,
sellerUserId: '',
fileName: ''
}
this.showNum = false
......@@ -372,13 +426,17 @@ export default {
return jsonData.map(v => filterVal.map(j => v[j]))
},
handleConfirmImport() {
// console.log(this.userInfo)
// console.log(this.baseData.sellerList)
this.fileForm.sellerUserId = this.userInfo.beSuper ? this.fileForm.sellerUserId : this.userInfo.detail.id
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
if (!this.fileForm.sellerUserId) {
return true
}
var params = {
sellerUserId: this.userInfo.detail.id,
sellerName: this.userInfo.detail.accountName,
sellerMerchantId: this.userInfo.detail.merchantId,
sellerUserId: this.fileForm.sellerUserId,
sellerName: this.userInfo.beSuper ? this.baseData.sellerList.find(i => i.userId === this.fileForm.sellerUserId).name : this.userInfo.detail.accountName,
sellerMerchantId: this.userInfo.beSuper ? this.fileForm.yqMerchantId : this.userInfo.detail.merchantId,
yqMerchantId: this.userInfo.beSuper ? this.fileForm.yqMerchantId : this.userInfo.detail.id,
file: this.fileInfo
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!