Commit 86f3940c by 王志慧

commit

1 parent 0b9b22a5
import { http,http_common } from '@/main'
import { http, http_common } from '@/main'
const path = "dj.api."
const defaultPath = 'scrm.api.carlife.'
......@@ -40,5 +40,15 @@ const uploadImg = params => {
noSignAttr: ['file']
})
}
// 获取省市区信息
const getAreaInfoApi = function (params) {
params.method = `${path}yseMerchantOffline.getAreaInfo`
return http({
url: 'rop-scrm-smartcarlife/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getGoodsCategoryConfiguration, uploadImg, uploadVideo }
export default { getAreaInfoApi, getGoodsCategoryConfiguration, uploadImg, uploadVideo }
<template>
<el-drawer class="shoppingCartDrawerCon" title="收货地址管理" size="500px" :visible.sync="dialogShow" :direction="direction">
<glsx-combi-form class="edit-form-container" ref="editFormRef" label-width="100px" default-width="350px"
:form-ref="editChildRef" :form-obj="editForm" :form-data="editFormData" :form-rules="editRule"></glsx-combi-form>
<glsx-combi-form class="edit-form-container" ref="editFormRef" label-width="100px" default-width="350px" :form-ref="editChildRef" :form-obj="editForm" :form-data="editFormData" :form-rules="editRule">
<span slot="provincesAndCities">
<!-- slot-scope="scope" -->
<el-cascader v-model="editForm.provincesAndCities" size="mini" ref="cascader" placeholder="请选择 省/市/区" style="width:350px" :options="provincesAndCities_options" :props="{ label: 'name', value: 'code', children: 'childrenList' }" />
</span>
</glsx-combi-form>
<div class="footer-btn">
<el-button @click="submit" type="primary">保存</el-button>
<el-button @click="dialogShow = false">取消</el-button>
</div>
</el-drawer>
</template>
......@@ -52,29 +55,45 @@ export default {
placeholder: '请输入电话号码'
},
{
label: '收货地址',
label: '',
name: 'provincesAndCities',
type: 'other',
addHtml: 'provincesAndCities',
style: {
'padding-left': '104px'
}
},
{
label: '',
name: 'contactAddress',
type: 'input',
maxlength: 50,
placeholder: '请输入收货地址',
inputType: 'textarea'
inputType: 'textarea',
rows: 3,
style: {
'padding-left': '104px'
}
// tips: '如XX店车主关怀活动'
}
],
editForm: {
contactName: '',
contactPhone: '',
contactAddress: ''
contactAddress: '',
provincesAndCities: []
},
provincesAndCities_options: [],
editRule: {
contactName: [{ required: true, message: '请输入姓名', trigger: 'change' }],
contactPhone: [{ required: true, message: '请输入电话号码', trigger: 'change' },
{ validator: checkPhone, trigger: 'blur' }],
contactAddress: [{ required: true, message: '请输入收货地址', trigger: 'change' }]
contactPhone: [
{ required: true, message: '请输入电话号码', trigger: 'change' },
{ validator: checkPhone, trigger: 'blur' }
],
contactAddress: [{ required: true, message: '请输入收货地址', trigger: 'change' }],
provincesAndCities: [{ required: true, message: '请选择省市区', trigger: 'change' }]
},
editChildRef: 'editChildRef'
}
},
computed: {
......@@ -90,13 +109,22 @@ export default {
watch: {
visible(val) {
if (val) {
this.editForm = this.addressInfo ? this.$common.utils.deepClone(this.addressInfo) : {}
console.log(this.addressInfo)
if (this.addressInfo) {
this.editForm = this.$common.utils.deepClone(this.addressInfo)
this.editForm.provincesAndCities = [this.addressInfo.provinceId, this.addressInfo.cityId, this.addressInfo.countyId]
} else {
this.editForm = {}
}
}
}
},
methods: {
handleDetailClose() {
// 获取省市区信息
getAreaInfo() {
this.$apis.sysBase.getAreaInfoApi({ areaType: '2' }).then(res => {
this.provincesAndCities_options = res.areaList
})
},
handleOkFn() {
// console.log('您点击了确定')
......@@ -108,38 +136,40 @@ export default {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
const params = this.$common.utils.deepClone(this.editForm)
this.$apis.purchaseShopping.addressSave(params).then((result) => {
this.$notify({
type: 'success',
title: '保存成功'
this.$apis.purchaseShopping
.addressSave(params)
.then(result => {
this.$notify({
type: 'success',
title: '保存成功'
})
this.dialogShow = false
this.$emit('handleConfirmAddress')
})
this.dialogShow = false
this.$emit('handleConfirmAddress')
}).catch((err) => {
})
.catch(err => {})
}
})
},
navBack() {
}
navBack() {}
}
}
</script>
<style lang="scss" scoped>
.shoppingCartDrawerCon {
// position: relative;
::v-deep .el-drawer__header {
/deep/ .el-drawer__header {
border-bottom: 1px solid #e7eaec;
margin-bottom: 20px;
padding-bottom: 10px;
font-weight: 600;
font-size: 20px;
}
/deep/ .el-textarea {
.el-textarea__inner {
height: auto !important;
}
}
.footer-btn {
text-align: center;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!