Browse Source

增加修改手机号码

zhangdan 4 years ago
parent
commit
89bd437d0d

+ 8 - 0
src/api/userInfo.js

@@ -63,3 +63,11 @@ export const updateGold = (params) => {
     method: 'post'
     method: 'post'
   })
   })
 }
 }
+// 修改手机号码
+export const updateMobile = (params) => {
+  return axios({
+    url: `customer/updateMobile`,
+    data: params,
+    method: 'post'
+  })
+}

+ 26 - 58
src/views/userInfo/editUserPhoneModal.vue

@@ -10,11 +10,11 @@
       <a-form id="components-form-demo-validate-other" ref="form" :form="form" @submit="handleSubmit">
       <a-form id="components-form-demo-validate-other" ref="form" :form="form" @submit="handleSubmit">
         <a-form-item label="手机号码" :label-col="{ span: 7 }" :wrapper-col="{ span: 12 }">
         <a-form-item label="手机号码" :label-col="{ span: 7 }" :wrapper-col="{ span: 12 }">
           <a-input
           <a-input
-            id="editUserPhoneModal-contactPhone"
+            id="editUserPhoneModal-mobile"
             :maxLength="11"
             :maxLength="11"
             v-decorator="[
             v-decorator="[
-              'formData.contactPhone',
-              { initialValue: formData.contactPhone, rules: [{ required: true, message: '请输入负责人手机号!' }, { pattern: /^\d{11}$/, message: '请输入正确的手机号' }] }
+              'formData.mobile',
+              { initialValue: formData.mobile, rules: [{ required: true, message: '请输入手机号码!' }, { pattern: /^\d{11}$/, message: '请输入正确的手机号' }] }
             ]"
             ]"
             placeholder="请输入手机号码"
             placeholder="请输入手机号码"
             allowClear />
             allowClear />
@@ -29,10 +29,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-// import {
-//   supplierDetails,
-//   saveSupplier
-// } from '@/api/shopSetting.js'
+import { updateMobile } from '@/api/userInfo.js'
 export default {
 export default {
   name: 'EditUserPhoneModal',
   name: 'EditUserPhoneModal',
   props: {
   props: {
@@ -40,63 +37,42 @@ export default {
       type: Boolean,
       type: Boolean,
       default: false
       default: false
     },
     },
-    userPhone: {
+    userId: {
       type: String,
       type: String,
       default: ''
       default: ''
-    },
-    itemData: {
-	  type: Object,
-	  default: function () {
-	    return {}
-	  }
     }
     }
+
   },
   },
   data () {
   data () {
     return {
     return {
       isShow: this.openUserPhoneMoadl,
       isShow: this.openUserPhoneMoadl,
       form: this.$form.createForm(this, { name: 'editUserPhoneModal' }),
       form: this.$form.createForm(this, { name: 'editUserPhoneModal' }),
       formData: {
       formData: {
-        contactPhone: '' // 手机号码
+        mobile: '' // 手机号码
       }
       }
     }
     }
   },
   },
   methods: {
   methods: {
-    // 查看详情
-    // getPageInfo () {
-    //   supplierDetails({
-    //     id: this.itemId
-    //   }).then(res => {
-    //     if (res.status == 200) {
-    //       // this.form.setFieldsValue({ 'formData': res.data })
-    //       this.form.setFieldsValue({ 'formData.name': res.data.name })
-    //       this.form.setFieldsValue({ 'formData.contactName': res.data.contactName })
-    //       this.form.setFieldsValue({ 'formData.simpleName': res.data.simpleName })
-    //       this.form.setFieldsValue({ 'formData.contactPhone': res.data.contactPhone })
-    //       this.form.setFieldsValue({ 'formData.remarks': res.data.remarks })
-    //     }
-    //   })
-    // },
     // 点击保存;
     // 点击保存;
     handleSubmit (e) {
     handleSubmit (e) {
-      this.$router.push({ path: `/userInfo/userManageList/list` })
-      // e.preventDefault()
-      // const _this = this
-      // this.form.validateFields((err, values) => {
-      //   if (!err) {
-      //     const formData = Object.assign({}, this.itemData, this.formData, values.formData)
-      //     formData.id = _this.itemId
-      //     saveSupplier(formData).then(res => {
-      //       console.log(res, 'rrrrrrrrr')
-      //       if (res.status == 200) {
-      //         _this.$message.success(res.message)
-      //         _this.$emit('refresh')
-      //         setTimeout(function () {
-      //           _this.isShow = false
-      //         }, 300)
-      //       }
-      //     })
-      //   }
-      // })
+      e.preventDefault()
+      const _this = this
+      this.form.validateFields((err, values) => {
+        if (!err) {
+          const formData = Object.assign({}, { id: this.userId }, this.formData, values.formData)
+          updateMobile(formData).then(res => {
+            console.log(res, 'rrrrrrrrr')
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              // _this.$emit('refresh')
+   		  _this.$router.push({ path: `/userInfo/userManageList/list` })
+              setTimeout(function () {
+                _this.isShow = false
+              }, 300)
+            }
+          })
+        }
+      })
     }
     }
   },
   },
   watch: {
   watch: {
@@ -104,21 +80,13 @@ export default {
       this.isShow = newValue
       this.isShow = newValue
     },
     },
     isShow (val) {
     isShow (val) {
+      console.log(this.userId)
       if (!val) {
       if (!val) {
         this.$emit('close')
         this.$emit('close')
       } else {
       } else {
    	  this.form.resetFields()
    	  this.form.resetFields()
       }
       }
     }
     }
-    // itemId (newValue, oldValue) {
-    //   console.log(newValue, '----------id')
-    //   if (newValue && this.isShow) {
-    //     this.titleText = '编辑'
-    //     this.getPageInfo(newValue)
-    //   } else {
-   	//   this.titleText = '新增'
-    //   }
-    // }
   }
   }
 }
 }
 </script>
 </script>

+ 6 - 6
src/views/userInfo/userDetails.vue

@@ -9,7 +9,7 @@
       <a-col :span="24" class="item-cont">
       <a-col :span="24" class="item-cont">
         <p class="item-label">手机号码:</p>
         <p class="item-label">手机号码:</p>
         <p class="item-main">{{ page.mobile ? page.mobile : '--' }}</p>
         <p class="item-main">{{ page.mobile ? page.mobile : '--' }}</p>
-        <!-- <a-icon type="edit" title="修改手机号码" style="font-size: 20px;color: #1890FF;padding: 0 10px;" @click="editPhone" v-hasPermission="'B_user_userdetails_editPhone'"/> -->
+        <a-icon type="edit" title="修改手机号码" style="font-size: 20px;color: #1890FF;padding: 0 10px;" @click="editPhone(page)" v-hasPermission="'B_user_userdetails_editPhone'"/>
         <!-- <a style="margin-left: 100px; color: #2D8CF0;" @click="editPhone">修改手机号码</a> -->
         <!-- <a style="margin-left: 100px; color: #2D8CF0;" @click="editPhone">修改手机号码</a> -->
       </a-col>
       </a-col>
       <a-col :span="24" class="item-cont">
       <a-col :span="24" class="item-cont">
@@ -47,7 +47,7 @@
       <a @click="goBack">返回列表</a>
       <a @click="goBack">返回列表</a>
     </div>
     </div>
     <!-- 修改用户手机号码弹窗 -->
     <!-- 修改用户手机号码弹窗 -->
-    <edit-user-phone-modal :userPhone="userPhone" :openUserPhoneMoadl="openUserPhoneMoadl" @close="openUserPhoneMoadl=false"></edit-user-phone-modal>
+    <edit-user-phone-modal :userId="userId" :openUserPhoneMoadl="openUserPhoneMoadl" @close="openUserPhoneMoadl=false"></edit-user-phone-modal>
     <!-- 修改乐豆余额弹窗 -->
     <!-- 修改乐豆余额弹窗 -->
     <edit-ldNum-modal :customerNo="customerNo" :openLdNumModal="openLdNumModal" @close="openLdNumModal=false"></edit-ldNum-modal>
     <edit-ldNum-modal :customerNo="customerNo" :openLdNumModal="openLdNumModal" @close="openLdNumModal=false"></edit-ldNum-modal>
   </a-card>
   </a-card>
@@ -67,7 +67,7 @@ export default {
   },
   },
   data () {
   data () {
     return {
     return {
-      userPhone: '', // 用户手机号码
+      userId: '', // 用户id
       openUserPhoneMoadl: false, // 默认关闭手机号码弹窗
       openUserPhoneMoadl: false, // 默认关闭手机号码弹窗
       customerNo: '', // 用户编号
       customerNo: '', // 用户编号
       openLdNumModal: false, // 默认关闭乐豆余额弹窗
       openLdNumModal: false, // 默认关闭乐豆余额弹窗
@@ -76,10 +76,10 @@ export default {
   },
   },
   methods: {
   methods: {
     // 详情
     // 详情
-    editPhone () {
-      // this.userPhone = record.userPhone
+    editPhone (page) {
+      this.userId = this.page.id
       this.openUserPhoneMoadl = true
       this.openUserPhoneMoadl = true
-      console.log('-----------修改手机号码')
+      console.log(this.userId,'-----------修改手机号码')
     },
     },
     editLd (page) {
     editLd (page) {
       this.customerNo = this.page.customerNo
       this.customerNo = this.page.customerNo

+ 2 - 2
src/views/userInfo/userManageList.vue

@@ -64,8 +64,8 @@
       <!-- 操作 -->
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
       <template slot="action" slot-scope="text, record">
         <a-button id="releaseRecordList-handleUser" type="link" @click="handleUser(record)" v-hasPermission="'B_user_userManage_userDetails'">用户详情</a-button>
         <a-button id="releaseRecordList-handleUser" type="link" @click="handleUser(record)" v-hasPermission="'B_user_userManage_userDetails'">用户详情</a-button>
-        <a-button id="releaseRecordList-handleLd" type="link" @click="handleLd(record)" v-hasPermission="'B_user_userManage_userDetails'">乐豆明细</a-button>
-        <span v-if="!$hasPermissions('B_user_userManage_userDetails') && !$hasPermissions('B_user_userManage_userDetails')">--</span>
+        <a-button id="releaseRecordList-handleLd" type="link" @click="handleLd(record)" v-hasPermission="'B_user_userManage_LdDetails'">乐豆明细</a-button>
+        <span v-if="!$hasPermissions('B_user_userManage_userDetails') && !$hasPermissions('B_user_userManage_LdDetails')">--</span>
       </template>
       </template>
     </s-table>
     </s-table>
   </a-card>
   </a-card>