Selaa lähdekoodia

🐛 用户手机号无法修改问题

谢创宏 3 vuotta sitten
vanhempi
commit
fc9bb57a46

+ 2 - 1
app.json

@@ -21,7 +21,8 @@
21 21
     "pages/login/login",
22 22
     "pages/phone/phone",
23 23
     "pages/customerList/customerList",
24
-    "pages/historyOrder/historyOrder"
24
+    "pages/historyOrder/historyOrder",
25
+    "pages/phoneEdit/phoneEdit"
25 26
   ],
26 27
   "tabBar": {
27 28
     "color": "#666666",

+ 1 - 0
pages/clientInfo/clientInfo.wxml

@@ -88,6 +88,7 @@
88 88
         <!-- <image src="{{item}}" data-index="{{item}}" bindtap="previewImage" wx:for="{{urls}}" wx:key="index"></image> -->
89 89
       </view>
90 90
     </view>
91
+    <view class="no-more-data" style="display: {{list.length == 0 ? 'block' : 'none'}};">暂无数据~</view>
91 92
   </view>
92 93
   <view class="no-more-data" style="display: {{list.length > 0 && list.length >= total ? 'block' : 'none'}};">已经到底啦~~</view>
93 94
 </view>

+ 9 - 7
pages/clientInfoEdit/clientInfoEdit.wxml

@@ -51,14 +51,16 @@
51 51
       <image class="icon-right" src="/images/icon_02.png"></image>
52 52
     </view>
53 53
   </picker>
54
-  <view class="item flex-align-center" data-key="visible" data-value="{{true}}">
55
-    <!-- bindtap="onPopupState" -->
56
-    <view class="flex-column flex1">
57
-      <text class="title">手机号码</text>
58
-      <text class="flex1">{{ userInfo.mobile }}</text>
54
+  <navigator url="/pages/phoneEdit/phoneEdit?phone={{ userInfo.mobile }}&userId={{ userInfo.user_id }}" hover-class="none">
55
+    <view class="item flex-align-center" data-key="visible" data-value="{{true}}">
56
+      <!-- bindtap="onPopupState" -->
57
+      <view class="flex-column flex1">
58
+        <text class="title">手机号码</text>
59
+        <text class="flex1">{{ userInfo.mobile }}</text>
60
+      </view>
61
+      <image class="icon-right" src="/images/icon_02.png"></image>
59 62
     </view>
60
-    <!-- <image class="icon-right" src="/images/icon_02.png"></image> -->
61
-  </view>
63
+  </navigator>
62 64
   <picker mode="region" bindchange="bindRegionChange">
63 65
     <view class="item flex-align-center">
64 66
       <view class="flex-column flex1">

+ 5 - 2
pages/feedback/feedback.js

@@ -68,7 +68,8 @@ Page({
68 68
       4: '满意',
69 69
       5: '非常好',
70 70
     },
71
-    edit: "false"
71
+    edit: "false",
72
+    score: false
72 73
   },
73 74
 
74 75
   /**
@@ -76,12 +77,14 @@ Page({
76 77
    */
77 78
   onLoad: function (options) {
78 79
     console.log(options)
80
+    console.log(options)
79 81
     if(options.orderId) {
80 82
       this.setData({
81 83
         orderId: options.orderId,
82 84
         cover: options.cover,
83 85
         name: options.name,
84
-        edit: options.edit || "false" 
86
+        edit: options.edit || "false",
87
+        score: options.score
85 88
       })
86 89
       if(options.edit == "true") {
87 90
         this.getfeedbackInfo(options.orderId)

+ 1 - 1
pages/feedback/feedback.wxml

@@ -44,7 +44,7 @@
44 44
       </view>
45 45
     </view>
46 46
   </view>
47
-  <view class="detail border-radius rater" wx:if="{{ raterList.length > 0 }}">
47
+  <view class="detail border-radius rater" wx:if="{{ raterList.length > 0 && score == 'false' }}">
48 48
     <view class="rater-text">
49 49
       <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">客户评价</text>
50 50
       <text style="font-size: 28rpx;color:#999;">(选填,且只有第一次填写生效)</text>

+ 1 - 0
pages/orderDetail/orderDetail.js

@@ -24,6 +24,7 @@ Page({
24 24
       2: '进行中',
25 25
       3: '已完成'
26 26
     },
27
+    detailData: {},
27 28
     list: [],
28 29
     total: 0,
29 30
     page: 1,

+ 10 - 3
pages/orderDetail/orderDetail.wxml

@@ -58,12 +58,19 @@
58 58
   <view class="list border-radius">
59 59
     <view class="item-top flex-align-center">
60 60
       <text class="flex1">反馈记录</text>
61
-      <navigator url="/pages/feedback/feedback?orderId={{ id }}&cover={{ detailData.cover_url }}&name={{ detailData.project_name }}" hover-class="none" wx:if="{{ detailData.allow_feedback == 1 }}">
61
+      <navigator url="/pages/feedback/feedback?orderId={{ id }}&cover={{ detailData.cover_url }}&name={{ detailData.project_name }}&score={{ detailData.score ? true : false }}" hover-class="none" wx:if="{{ detailData.allow_feedback == 1 }}">
62 62
         <view class="btn flex-center">新增反馈</view>
63 63
       </navigator>
64 64
     </view>
65
-    <view class="detail border-radius rater">
66
-      <view class="rater-item flex-align-center" >
65
+    <view class="detail rater" style="padding: 0 28rpx 28rpx;border-bottom: 2rpx solid #f2f2f2;" wx:if="{{ detailData && detailData.score }}">
66
+      <view class="user-info flex-align-center">
67
+        <image src="{{ detailData.score.avatar_url }}"></image>
68
+        <view class="info flex-column flex1">
69
+          <text style="font-size: 28rpx;margin-bottom: 6rpx;">{{ detailData.score.user_name }}</text>
70
+          <text style="font-size: 20rpx;color: #999;">{{ detailData.score.update_time }}</text>
71
+        </view>
72
+      </view>
73
+      <view class="rater-item flex-align-center" style="margin-top: 0;">
67 74
         <text class="text-01">整体满意度</text>
68 75
         <wux-rater slot="footer" active-color="#FF77B0" margin="{{ 12 }}" font-size="{{ 18 }}" default-value="{{ detailData.score.score_whole }}" data-index="{{ index }}" bind:change="onChange" />
69 76
         <text class="text-02">{{ raterStatus[detailData.score.score_whole] }}</text>

+ 160 - 0
pages/phoneEdit/phoneEdit.js

@@ -0,0 +1,160 @@
1
+import {
2
+  get, post,
3
+} from '../../utils/http';
4
+Page({
5
+
6
+  /**
7
+   * 页面的初始数据
8
+   */
9
+  data: {
10
+    userInfo: {},
11
+    customerInfo: {},
12
+    name: '',
13
+    type: '',
14
+    userId: '',
15
+    phone:''
16
+  },
17
+
18
+  /**
19
+   * 生命周期函数--监听页面加载
20
+   */
21
+  onLoad: function (options) {
22
+    console.log(options)
23
+    if(options.userId) {
24
+      this.setData({
25
+        phone: options.phone,
26
+        name: options.name,
27
+        type: options.type,
28
+        userId: options.userId
29
+      })
30
+    } else {
31
+      this.getUserFiles()
32
+    }
33
+  },
34
+
35
+  /**
36
+   * 生命周期函数--监听页面初次渲染完成
37
+   */
38
+  onReady: function () {
39
+
40
+  },
41
+
42
+  /**
43
+   * 生命周期函数--监听页面显示
44
+   */
45
+  onShow: function () {
46
+
47
+  },
48
+
49
+  /**
50
+   * 生命周期函数--监听页面隐藏
51
+   */
52
+  onHide: function () {
53
+
54
+  },
55
+
56
+  /**
57
+   * 生命周期函数--监听页面卸载
58
+   */
59
+  onUnload: function () {
60
+
61
+  },
62
+
63
+  /**
64
+   * 页面相关事件处理函数--监听用户下拉动作
65
+   */
66
+  onPullDownRefresh: function () {
67
+
68
+  },
69
+
70
+  /**
71
+   * 页面上拉触底事件的处理函数
72
+   */
73
+  onReachBottom: function () {
74
+
75
+  },
76
+
77
+  /**
78
+   * 用户点击右上角分享
79
+   */
80
+  onShareAppMessage: function () {
81
+
82
+  },
83
+
84
+  /**
85
+   * 监听输入姓名
86
+   */
87
+  onChangePhone(e) {
88
+    this.setData({
89
+      phone: e.detail.value,
90
+    })
91
+  },
92
+
93
+  /**
94
+   * 更新客户档案
95
+   * Customer
96
+   * 
97
+  */
98
+  setCustomerInfo() {
99
+    let { userInfo,type,userId,phone } = this.data;
100
+    var myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
101
+    if(!myreg.test(phone)) {
102
+      wx.showToast({
103
+        title: '手机号格式不正确',
104
+        icon: 'none'
105
+      })
106
+      return;
107
+    }
108
+    post('api/user/update',{
109
+      user_id: userId,
110
+      mobile: phone
111
+    },(res) => {
112
+      wx.showToast({
113
+        title: '修改成功',
114
+      })
115
+      setTimeout(() => {
116
+        wx.navigateBack()
117
+      }, 1000);
118
+    })
119
+  },
120
+
121
+  /**
122
+   * 获取美导师用户档案
123
+   * api/user/files
124
+   */
125
+  getUserFiles() {
126
+    get('api/mruser/info', {}, (res) => {
127
+      this.setData({
128
+        userInfo: res.data
129
+      })
130
+    })
131
+  },
132
+
133
+  /**
134
+   * 更新美导师档案
135
+   * api/user/save_files
136
+   */
137
+  setUserFiles() {
138
+    let {
139
+      avatar_url,
140
+      realname,
141
+      birthday,
142
+      sex,
143
+      city
144
+    } = this.data.userInfo;
145
+    post('api/mruser/update', {
146
+      avatar_url,
147
+      realname,
148
+      birthday,
149
+      sex,
150
+      city
151
+    }, () => {
152
+      wx.showToast({
153
+        title: '修改成功',
154
+      })
155
+      setTimeout(() => {
156
+        wx.navigateBack()
157
+      }, 1000);
158
+    })
159
+  }
160
+})

+ 4 - 0
pages/phoneEdit/phoneEdit.json

@@ -0,0 +1,4 @@
1
+{
2
+  "navigationBarTitleText": "修改手机号",
3
+  "usingComponents": {}
4
+}

+ 4 - 0
pages/phoneEdit/phoneEdit.wxml

@@ -0,0 +1,4 @@
1
+<view class="content flex-column flex-align-center">
2
+  <input type="number" focus maxlength="11" placeholder="请输入手机号" value="{{phone}}" bindinput="onChangePhone"/>
3
+  <view class="btn border-radius flex-center" bindtap="setCustomerInfo">确定</view>
4
+</view>

+ 29 - 0
pages/phoneEdit/phoneEdit.wxss

@@ -0,0 +1,29 @@
1
+page {
2
+  background: #F9F9F9;
3
+}
4
+
5
+.content {
6
+  padding: 30rpx;
7
+}
8
+
9
+input {
10
+  width: 100%;
11
+  height: 132rpx;
12
+  box-sizing: border-box;
13
+  border-radius: 16rpx;
14
+  background: #fff;
15
+  padding: 0 30rpx;
16
+}
17
+
18
+.btn {
19
+  margin-top: 430rpx;
20
+  width: 566rpx;
21
+  height: 92rpx;
22
+  background: #FF77B0;
23
+  box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(109, 0, 46, 0.15);
24
+  border-radius: 50rpx;
25
+  color: #fff;
26
+  font-size: 36rpx;
27
+  font-family: PingFangSC-Medium, PingFang SC;
28
+  font-weight: 500;
29
+}