Commit 86f3940c by 王志慧

commit

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