#
whycq
2022-12-15 3933f2736aea7d9bcabecae636461026d1746f13
#
1个文件已修改
83 ■■■■ 已修改文件
pages/business/cstmr/addCsmtr.vue 83 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/business/cstmr/addCsmtr.vue
@@ -9,8 +9,28 @@
                    <uni-easyinput v-model="baseFormData.rela" placeholder="请输入客户关系" />
                </uni-forms-item>
                <uni-forms-item label="客户类别" required name="cstmrType">
                    <uni-combox :candidates="cstmrTypes" placeholder="请选择客户类别"
                    v-model="baseFormData.cstmrType" @input="autoLoad('cstmrType',baseFormData.cstmrType)"></uni-combox>
                    <view class="uni-list">
                        <view class="uni-list-cell">
                            <view class="uni-list-cell-db" >
                                <picker style="border: 1px solid #e5e5e5;height: 80rpx;border-radius: 4px;line-height: 80rpx;padding-left: 10px;font-size: 14px;" @change="bindPickerChange" :value="cstmrTypeIndex" :range="cstmrTypes" range-key="value">
                                    <view class="uni-input">{{cstmrTypes[cstmrTypeIndex].value}}</view>
                                </picker>
                            </view>
                        </view>
                    </view>
                    <!-- <uni-combox :candidates="cstmrTypes" placeholder="请选择客户类别"
                    v-model="baseFormData.cstmrType" @input="autoLoad('cstmrType',baseFormData.cstmrType)"></uni-combox> -->
                    <!-- <uni-easyinput v-model="baseFormData.cstmrType" placeholder="请输入客户类别" /> -->
                </uni-forms-item>
                <uni-forms-item label="区分" required name="type">
@@ -51,6 +71,7 @@
                baseUrl: '',
                cstmrTypes: [],
                cstmrType: '',
                cstmrTypeIndex: 0,
                directors: [],
                director: '',
                baseFormData: {
@@ -117,7 +138,8 @@
                    value: 2
                }],
                citysData: [],
                userArea: ''
                userArea: '',
                cstmrList: [],
            }
        },
        onReady() {
@@ -135,6 +157,12 @@
            // this.getUser()
        },
        methods: {
            bindPickerChange: function(e) {
                console.log(e);
                console.log('picker发送选择改变,携带值为:' + e.detail.value)
                console.log(this.cstmrTypes[e.detail.value].id);
                this.cstmrTypeIndex = e.detail.value
            },
            autoLoad(type,condition) {
                let that = this
                var a = that.baseUrl + '/' + type + 'Query/auth'
@@ -145,11 +173,12 @@
                    method: 'GET',
                    success(result) {
                        var res = result.data
                        console.log(res);
                        if (res.code === 200) {
                            var element;
                            if (type == 'cstmrType') {
                                for(element of res.data) {
                                    that.cstmrTypes.push(element.value)
                                    that.cstmrTypes.push(element)
                                }
                                return
                            }
@@ -166,24 +195,40 @@
            },
            // 添加用户
            addCstmr() {
                let that = this
                uni.request({
                    // url: that.baseUrl + '/cstmr/add/auth',
                    url: "http://localhost:9528" + '/cstmr/add/auth',
                    header:{
                        'token':uni.getStorageSync('token'),
                        // 'content-type':'application/json',
                        },
                    data: {
                        addr: "滨江路35号",
                        contacts: "程燕",
                        cstmrType: 1,
                        cstmrType$: "第一类",
                        director: "19",
                        director$: "超级管理员",
                        id: "",
                        name: "测试2",
                        pcd:"14000,140100,140105",
                        rela: "",
                        remarks: "",
                        tel: "15987462587",
                        type: "1"
                    },
                    method: 'POST',
                    success(result) {
                        var res = result.data
                        console.log(res);
                    }
                })
                return
                this.$refs.baseForm.validate().then(res=>{
                    console.log(res);
                    var a = JSON.stringify(res)
                    console.log(a);
                    uni.request({
                        url: that.baseUrl + '/cstmr/add/auth',
                        header:{
                            'token':uni.getStorageSync('token'),
                            // 'content-type':'application/json',
                            },
                        data: a,
                        method: 'POST',
                        success(result) {
                            var res = result.data
                            console.log(res);
                        }
                    })
                }).catch(err =>{
                })
            }