Commit 31dea37dac820ba4df6c0d427911262561714861
1 parent
0c6c0f3c42
Exists in
master
新增验光单和修改验光单
Showing
5 changed files
with
401 additions
and
49 deletions
Show diff stats
src/pages/addOpticsData/addOpticsData.vue
... | ... | @@ -26,9 +26,9 @@ |
26 | 26 | <!-- 数据展示部分 --> |
27 | 27 | <view class="dataMenu"> |
28 | 28 | <uni-collapse accordion="true"> |
29 | - <view class="item" v-for="(loveItem,index) in loveList" :key="index"> | |
29 | + <view class="item" v-for="(loveItem,index) in loveList" :key="index" > | |
30 | 30 | <uni-collapse-item :title='loveItem.name' :time='getRightTime(loveItem.in_time)' :iconText='getFirstName(loveItem.name)' showAnimation='true'> |
31 | - <view class="loveDataInfo"> | |
31 | + <view class="loveDataInfo" @click="toNewData(2,index)"> | |
32 | 32 | <view class="dataInfoItem"> |
33 | 33 | <text>度数(SPH):</text><text>左:{{loveItem.leftSph}}</text><text>右:{{loveItem.rightSph}}</text> |
34 | 34 | </view> |
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | </uni-collapse> |
48 | 48 | </view> |
49 | 49 | <view class="footer"> |
50 | - <button class="btn" type="default" @click="toNewData">新建验光单</button> | |
50 | + <button class="btn" type="default" @click="toNewData(1)">新建验光单</button> | |
51 | 51 | </view> |
52 | 52 | </view> |
53 | 53 | </template> |
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | onLoad: function(option) { |
68 | 68 | //获取关心的人列表 |
69 | 69 | store.dispatch('myLoveList/getLoveList', { |
70 | - uid: "1", | |
70 | + uid: this.$store.state.user.userInfo.uid, | |
71 | 71 | }); |
72 | 72 | }, |
73 | 73 | computed:{ |
... | ... | @@ -99,9 +99,21 @@ |
99 | 99 | getFirstName(name){ |
100 | 100 | return name.substring(0,1) |
101 | 101 | }, |
102 | - toNewData(){ | |
102 | + toNewData(item,index){ | |
103 | + // const args={ | |
104 | + // name:loveItem.name, | |
105 | + // pd:loveItem.pd, | |
106 | + // leftSph:loveItem.leftSph, | |
107 | + // rightSph:loveItem.rightSph, | |
108 | + // leftCyl:loveItem.leftCyl, | |
109 | + // rightCyl:loveItem.rightCyl, | |
110 | + // leftAxi:loveItem.leftAxi, | |
111 | + // rightAxi:loveItem.rightAxi | |
112 | + // } | |
103 | 113 | uni.navigateTo({ |
104 | - url:'../newOpticsData/newOpticsData' | |
114 | + // kinds 参数为 1 表示添加新的验光单, 2 表示更新验光单 | |
115 | + // name 表示修改的人名儿,pd瞳距 | |
116 | + url:'../newOpticsData/newOpticsData?kinds='+item+'&index='+index | |
105 | 117 | }) |
106 | 118 | } |
107 | 119 | } |
... | ... | @@ -145,6 +157,7 @@ |
145 | 157 | box-shadow: 0 0 4px 0 rgba(133,107,107,0.10); |
146 | 158 | width: 100%; |
147 | 159 | background-color: #FFFFFF; |
160 | + margin-bottom: 120rpx; | |
148 | 161 | .item{ |
149 | 162 | padding: 0 40rpx; |
150 | 163 | .loveDataInfo{ | ... | ... |
src/pages/newOpticsData/newOpticsData.vue
... | ... | @@ -8,6 +8,16 @@ |
8 | 8 | 填写验光数据 |
9 | 9 | </view> |
10 | 10 | <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text> |
11 | + <view class="use_name"> | |
12 | + <text>验光单取名:</text> | |
13 | + <input type="text" @change="handleInput" | |
14 | + placeholder="请输入名称" maxlength="30" :value="name" /> | |
15 | + </view> | |
16 | + <view class="use_pd"> | |
17 | + <text>瞳距:</text> | |
18 | + <input type="number" @change="handleInputPd" | |
19 | + placeholder="请输入瞳距,单位cm" maxlength="20" :value="pd" /> | |
20 | + </view> | |
11 | 21 | <view class="picker" > |
12 | 22 | <view class="picker-choice"> |
13 | 23 | <view class="choice-left"> |
... | ... | @@ -62,7 +72,7 @@ |
62 | 72 | </picker> |
63 | 73 | </view> |
64 | 74 | </view> |
65 | - <view class="picker" > | |
75 | +<!-- <view class="picker" > | |
66 | 76 | <view class="picker-choice"> |
67 | 77 | <view class="choice-left"> |
68 | 78 | <text class="p11">{{pickerInfoList[3].nameC}}</text> |
... | ... | @@ -79,31 +89,31 @@ |
79 | 89 | <image src="../../static/detail-tabicon.png" ></image> |
80 | 90 | </picker> |
81 | 91 | </view> |
82 | - </view> | |
92 | + </view> --> | |
83 | 93 | <view class="picker" > |
84 | 94 | <view class="picker-choice"> |
85 | 95 | <view class="choice-left"> |
86 | - <text class="p11">{{pickerInfoList[4].nameC}}</text> | |
96 | + <text class="p11">{{pickerInfoList[3].nameC}}</text> | |
87 | 97 | </view> |
88 | 98 | <text class="p13-date">年 (Y)</text> |
89 | - <text class="p14" style="width: 34px;">{{pickerInfoList[4].nameArray1[pickerInfoList[4].nameIndex1]}}</text> | |
90 | - <picker @change="bindPickerChange41" :value="pickerInfoList[4].nameIndex1" :range="pickerInfoList[4].nameArray1"> | |
99 | + <text class="p14" style="width: 34px;">{{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}}</text> | |
100 | + <picker @change="bindPickerChange41" :value="pickerInfoList[3].nameIndex1" :range="pickerInfoList[3].nameArray1"> | |
91 | 101 | <image src="../../static/detail-tabicon.png" ></image> |
92 | 102 | </picker> |
93 | 103 | <text class="p13-date">月 (M)</text> |
94 | - <text class="p14" style="width: 30px;">{{pickerInfoList[4].nameArray2[pickerInfoList[4].nameIndex2]}}</text> | |
95 | - <picker @change="bindPickerChange42" :value="pickerInfoList[4].nameIndex2" :range="pickerInfoList[4].nameArray2"> | |
104 | + <text class="p14" style="width: 30px;">{{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}}</text> | |
105 | + <picker @change="bindPickerChange42" :value="pickerInfoList[3].nameIndex2" :range="pickerInfoList[3].nameArray2"> | |
96 | 106 | <image src="../../static/detail-tabicon.png" ></image> |
97 | 107 | </picker> |
98 | 108 | <text class="p13-date">日 (D)</text> |
99 | - <text class="p14" style="width: 30px;">{{pickerInfoList[4].nameArray3[pickerInfoList[4].nameIndex3]}}</text> | |
100 | - <picker @change="bindPickerChange43" :value="pickerInfoList[4].nameIndex3" :range="pickerInfoList[4].nameArray3"> | |
109 | + <text class="p14" style="width: 30px;">{{pickerInfoList[3].nameArray3[pickerInfoList[3].nameIndex3]}}</text> | |
110 | + <picker @change="bindPickerChange43" :value="pickerInfoList[3].nameIndex3" :range="pickerInfoList[3].nameArray3"> | |
101 | 111 | <image src="../../static/detail-tabicon.png" ></image> |
102 | 112 | </picker> |
103 | 113 | </view> |
104 | 114 | </view> |
105 | 115 | <view class="confirm"> |
106 | - <image :src="tablist.confirm ? tabicon[0] : tabicon[1]" @click="changeConfirm"></image> | |
116 | + <image :src="confirm ? tabicon[0] : tabicon[1]" @click="changeConfirm"></image> | |
107 | 117 | <text>确认以上输入信息来源于我的验光数据!</text> |
108 | 118 | </view> |
109 | 119 | </view> |
... | ... | @@ -112,72 +122,261 @@ |
112 | 122 | </view> |
113 | 123 | |
114 | 124 | |
115 | - <view class="footer"> | |
125 | + <view class="footer" @click="handleSubmit"> | |
116 | 126 | <button class="btn" type="default">提 交</button> |
117 | 127 | </view> |
118 | 128 | </view> |
119 | 129 | </template> |
120 | 130 | |
121 | -<script> | |
131 | +<script> | |
132 | + import store from '@/store'; | |
133 | + | |
122 | 134 | export default { |
123 | 135 | data() { |
124 | 136 | return { |
125 | 137 | pickerInfoList:[ |
126 | - {nameC:"度数",nameE:"(SPH)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:0}, | |
127 | - {nameC:"散光",nameE:"(CYL)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:1}, | |
128 | - {nameC:"散光轴位",nameE:"(AXI)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:2}, | |
129 | - {nameC:"双眼瞳距",nameE:"(PD)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:3}, | |
130 | - {nameC:"验光日期",nameE:'',nameArray1:[2017,2018,2019,2020,2021],nameIndex1:0,nameArray2:[1,2,3,4,5,6,7],nameIndex2:0,nameArray3:[1,2,3,4,5,6],nameIndex3:0} | |
138 | + {nameC:"度数",nameE:"(SPH)",nameArray1:[''],nameIndex1:0,nameArray2:[''],nameIndex2:0,key:0}, | |
139 | + {nameC:"散光",nameE:"(CYL)",nameArray1:[''],nameIndex1:0,nameArray2:[''],nameIndex2:0,key:1}, | |
140 | + {nameC:"散光轴位",nameE:"(AXI)",nameArray1:[''],nameIndex1:0,nameArray2:[''],nameIndex2:0,key:2}, | |
141 | + {nameC:"验光日期",nameE:'',nameArray1:[''],nameIndex1:0,nameArray2:['',1,2,3,4,5,6,7,8,9,10,11,12],nameIndex2:0,nameArray3:[''],nameIndex3:0} | |
131 | 142 | ], |
132 | - tablist: { | |
133 | - // read: true, | |
134 | - // seeLong: false, | |
135 | - confirm: false | |
143 | + confirm: false, // 用户是否确认 | |
144 | + tabicon:['/static/detail-button.png','/static/detail-button-unselected.png'], | |
145 | + name: '夏小花', | |
146 | + pickerInfoChioce:{ | |
147 | + "leftSph": 0, | |
148 | + "rightSph": 0, | |
149 | + "leftCyl": 0, | |
150 | + "rightCyl": 0, | |
151 | + "leftAxi": 0, | |
152 | + "rightAxi": 0, | |
153 | + "time":{ | |
154 | + "year":0, | |
155 | + "month": 0, | |
156 | + "day":0 , | |
157 | + } | |
136 | 158 | }, |
137 | - tabicon:['/static/detail-button.png','/static/detail-button-unselected.png'], | |
159 | + pd: '',// 瞳距 | |
160 | + kinds:Number, // kinds=1,提交为新增验光,2为修改 | |
161 | + mp_id: Number | |
138 | 162 | }; |
139 | 163 | }, |
164 | + onLoad: function (option) { | |
165 | + //option为object类型,会序列化上个页面传递的参数 | |
166 | + // 初始化SPL、CYL、AXI的值 | |
167 | + for (let j = 0; j < 3; j++) { | |
168 | + for(let i=-12;i<6;i++){ | |
169 | + this.pickerInfoList[j].nameArray1.push(i) | |
170 | + this.pickerInfoList[j].nameArray1.push(i+0.5) | |
171 | + this.pickerInfoList[j].nameArray2.push(i) | |
172 | + this.pickerInfoList[j].nameArray2.push(i+0.5) | |
173 | + if(i>=-6){ | |
174 | + this.pickerInfoList[j].nameArray1.push(i+0.25) | |
175 | + this.pickerInfoList[j].nameArray1.push(i+0.75) | |
176 | + this.pickerInfoList[j].nameArray2.push(i+0.25) | |
177 | + this.pickerInfoList[j].nameArray2.push(i+0.75) | |
178 | + } | |
179 | + if(i==5){ | |
180 | + this.pickerInfoList[j].nameArray1.push(i+1) | |
181 | + this.pickerInfoList[j].nameArray2.push(i+1) | |
182 | + } | |
183 | + } | |
184 | + } | |
185 | + // 初始化日期值 | |
186 | + for (let i = 1; i < 32; i++){ | |
187 | + this.pickerInfoList[3].nameArray3.push(i) | |
188 | + } | |
189 | + // 初始化年份前后五年 | |
190 | + let myDate = new Date(); | |
191 | + let nowYear = myDate.getFullYear(); | |
192 | + for(let i=0;i<5;i++){ | |
193 | + this.pickerInfoList[3].nameArray1.push(nowYear-i) | |
194 | + } | |
195 | + | |
196 | + this.kinds=option.kinds | |
197 | + if(option.kinds==1){ | |
198 | + this.name= ''; | |
199 | + this.pd= ''; | |
200 | + } else{ | |
201 | + console.log('args===>',option.index) | |
202 | + const loveList=Object.assign({},this.$store.state.myLoveList.loveList) | |
203 | + console.log('args===>',loveList[option.index].in_time) | |
204 | + console.log('args===>',loveList[option.index].in_time.toString().slice(0,4)) | |
205 | + console.log('args===>',loveList[option.index].in_time.toString().slice(5,6)==0) | |
206 | + console.log('args===>',loveList[option.index].in_time.toString().slice(8,10)) | |
207 | + this.name=loveList[option.index].name | |
208 | + this.pd=loveList[option.index].pd | |
209 | + this.mp_id=loveList[option.index].mp_id | |
210 | + // 将kinds =2时的值传到该页面 | |
211 | + this.pickerInfoList[0].nameArray1.unshift(loveList[option.index].leftSph) | |
212 | + this.pickerInfoList[0].nameArray2.unshift(loveList[option.index].rightSph) | |
213 | + this.pickerInfoList[1].nameArray1.unshift(loveList[option.index].leftCyl) | |
214 | + this.pickerInfoList[1].nameArray2.unshift(loveList[option.index].rightCyl) | |
215 | + this.pickerInfoList[2].nameArray1.unshift(loveList[option.index].leftAxi) | |
216 | + this.pickerInfoList[2].nameArray2.unshift(loveList[option.index].rightAxi) | |
217 | + | |
218 | + this.pickerInfoList[3].nameArray1.unshift(loveList[option.index].in_time.toString().slice(0,4)) | |
219 | + if(loveList[option.index].in_time.toString().slice(5,6)==0){ | |
220 | + this.pickerInfoList[3].nameArray2.unshift(loveList[option.index].in_time.toString().slice(6,7)) | |
221 | + } else{ | |
222 | + this.pickerInfoList[3].nameArray2.unshift(loveList[option.index].in_time.toString().slice(5,7)) | |
223 | + } | |
224 | + if(loveList[option.index].in_time.toString().slice(8,9)==0){ | |
225 | + this.pickerInfoList[3].nameArray3.unshift(loveList[option.index].in_time.toString().slice(9,10)) | |
226 | + } else{ | |
227 | + this.pickerInfoList[3].nameArray3.unshift(loveList[option.index].in_time.toString().slice(8,10)) | |
228 | + } | |
229 | + } | |
230 | + }, | |
140 | 231 | methods:{ |
232 | + handleInput(e){ | |
233 | + this.name=e.target.value | |
234 | + }, | |
235 | + handleInputPd(e){ | |
236 | + // 只能输入正浮点数或正数 | |
237 | + if(/^\d+(\.\d+)?$/.test(e.target.value)){ | |
238 | + this.pd=e.target.value | |
239 | + } else { | |
240 | + uni.showToast({ | |
241 | + title:"请输入有效数据;示例:89", | |
242 | + icon: "none", | |
243 | + duration: 3000, | |
244 | + }) | |
245 | + this.pd = '' | |
246 | + } | |
247 | + | |
248 | + }, | |
249 | + // 用户提交 | |
250 | + handleSubmit(){ | |
251 | + if(this.name==''){ | |
252 | + uni.showToast({ | |
253 | + title:"请输入验光单取名", | |
254 | + icon: "none", | |
255 | + duration: 3000, | |
256 | + }) | |
257 | + } | |
258 | + if(this.pd==''){ | |
259 | + uni.showToast({ | |
260 | + title:"请输入瞳距", | |
261 | + icon: "none", | |
262 | + duration: 3000, | |
263 | + }) | |
264 | + } | |
265 | + if(this.confirm){ | |
266 | + if(this.kinds==1){ | |
267 | + // 添加用户验光单 | |
268 | + console.log('kinds====>',this.kinds) | |
269 | + store.dispatch('myLoveList/addMylove', { | |
270 | + | |
271 | + uid: this.$store.state.user.userInfo.uid, | |
272 | + openid: this.$store.state.user.userInfo.openid, | |
273 | + // mp_name: this.$store.state.user.userInfo.mp_name, | |
274 | + leftSph: this.pickerInfoChioce.leftSph, | |
275 | + rightSph: this.pickerInfoChioce.rightSph, | |
276 | + leftCyl: this.pickerInfoChioce.leftCyl, | |
277 | + rightCyl: this.pickerInfoChioce.rightCyl, | |
278 | + leftAxi: this.pickerInfoChioce.leftAxi, | |
279 | + rightAxi: this.pickerInfoChioce.rightAxi, | |
280 | + pd: this.pd,// 瞳距 | |
281 | + mp_name:this.name, | |
282 | + // time: this.pickerInfoChioce.time, | |
283 | + // img_url2: "http://localhost:8087/images/shop_1/1/", | |
284 | + }); | |
285 | + store.dispatch('myLoveList/getLoveList', { | |
286 | + uid: this.$store.state.user.userInfo.uid, | |
287 | + }); | |
288 | + uni.navigateBack({ | |
289 | + delta:1, | |
290 | + animationDuration:2000 | |
291 | + }) | |
292 | + } | |
293 | + if(this.kinds==2){ | |
294 | + // console.log('kinds====>',this.kinds) | |
295 | + // console.log('pickerindex=====>',this.pickerInfoList[0].nameIndex1) | |
296 | + // console.log('this.pickerInfoChioce====>',type(this.pickerInfoChioce)) | |
297 | + const leftList = ["leftSph","leftCyl","leftAxi"]; | |
298 | + const rightList = ["rightSph", "rightCyl", "rigthAxi"]; | |
299 | + for (let j=0; j<3; j++) { | |
300 | + if(this.pickerInfoList[j].nameIndex1!=0){ | |
301 | + | |
302 | + store.dispatch('myLoveList/updateMylove', { | |
303 | + uid: this.$store.state.user.userInfo.uid, | |
304 | + openid: this.$store.state.user.userInfo.openid, | |
305 | + mp_id: this.mp_id, | |
306 | + keyname: leftList[j], | |
307 | + keyvalue: this.pickerInfoList[j].nameArray1[this.pickerInfoList[j].nameIndex1], | |
308 | + }); | |
309 | + } | |
310 | + if(this.pickerInfoList[j].nameIndex2 !=0) { | |
311 | + store.dispatch('myLoveList/updateMylove', { | |
312 | + uid: this.$store.state.user.userInfo.uid, | |
313 | + openid: this.$store.state.user.userInfo.openid, | |
314 | + mp_id: this.mp_id, | |
315 | + keyname: rightList[j], | |
316 | + keyvalue: this.pickerInfoList[j].nameArray2[this.pickerInfoList[j].nameIndex2] | |
317 | + }); | |
318 | + } | |
319 | + } | |
320 | + store.dispatch('myLoveList/getLoveList', { | |
321 | + uid: this.$store.state.user.userInfo.uid, | |
322 | + }); | |
323 | + uni.navigateBack({ | |
324 | + delta:1, | |
325 | + animationDuration:2000 | |
326 | + }) | |
327 | + | |
328 | + } | |
329 | + | |
330 | + } else{ | |
331 | + uni.showToast({ | |
332 | + title:"请确认你的验光数据", | |
333 | + icon: "none", | |
334 | + duration: 3000, | |
335 | + }) | |
336 | + } | |
337 | + }, | |
141 | 338 | changeConfirm() { |
142 | - this.tablist.confirm = !this.tablist.confirm | |
339 | + this.confirm = !this.confirm | |
143 | 340 | }, |
144 | 341 | |
145 | 342 | bindPickerChange01: function(e) { |
146 | 343 | this.pickerInfoList[0].nameIndex1 = e.target.value |
344 | + this.pickerInfoChioce.leftSph=this.pickerInfoList[0].nameArray1[e.target.value] | |
147 | 345 | }, |
148 | 346 | bindPickerChange02: function(e) { |
149 | 347 | this.pickerInfoList[0].nameIndex2 = e.target.value |
348 | + this.pickerInfoChioce.rightSph=this.pickerInfoList[0].nameArray2[e.target.value] | |
150 | 349 | }, |
151 | 350 | |
152 | 351 | bindPickerChange11: function(e) { |
153 | 352 | this.pickerInfoList[1].nameIndex1 = e.target.value |
353 | + this.pickerInfoChioce.leftCyl=this.pickerInfoList[1].nameArray1[e.target.value] | |
154 | 354 | }, |
155 | 355 | bindPickerChange12: function(e) { |
156 | 356 | this.pickerInfoList[1].nameIndex2 = e.target.value |
357 | + this.pickerInfoChioce.rightCyl=this.pickerInfoList[1].nameArray2[e.target.value] | |
157 | 358 | }, |
158 | 359 | |
159 | 360 | bindPickerChange21: function(e) { |
160 | 361 | this.pickerInfoList[2].nameIndex1 = e.target.value |
362 | + this.pickerInfoChioce.leftAxi=this.pickerInfoList[2].nameArray1[e.target.value] | |
161 | 363 | }, |
162 | 364 | bindPickerChange22: function(e) { |
163 | - this.pickerInfoList[2].nameIndex2 = e.target.value | |
365 | + this.pickerInfoList[2].nameIndex2 = e.target.value | |
366 | + this.pickerInfoChioce.rightAxi=this.pickerInfoList[2].nameArray2[e.target.value] | |
164 | 367 | }, |
165 | 368 | |
166 | - bindPickerChange31: function(e) { | |
167 | - this.pickerInfoList[3].nameIndex1 = e.target.value | |
168 | - }, | |
169 | - bindPickerChange32: function(e) { | |
170 | - this.pickerInfoList[3].nameIndex2 = e.target.value | |
171 | - }, | |
172 | - | |
173 | 369 | bindPickerChange41: function(e) { |
174 | - this.pickerInfoList[4].nameIndex1 = e.target.value | |
370 | + this.pickerInfoList[3].nameIndex1 = e.target.value | |
371 | + this.pickerInfoChioce.time.year=this.pickerInfoList[3].nameArray1[e.target.value] | |
175 | 372 | }, |
176 | 373 | bindPickerChange42: function(e) { |
177 | - this.pickerInfoList[4].nameIndex2 = e.target.value | |
374 | + this.pickerInfoList[3].nameIndex2 = e.target.value | |
375 | + this.pickerInfoChioce.time.month=this.pickerInfoList[3].nameArray2[e.target.value] | |
178 | 376 | }, |
179 | 377 | bindPickerChange43: function(e) { |
180 | - this.pickerInfoList[4].nameIndex3 = e.target.value | |
378 | + this.pickerInfoList[3].nameIndex3 = e.target.value | |
379 | + this.pickerInfoChioce.time.day=this.pickerInfoList[3].nameArray3[e.target.value] | |
181 | 380 | }, |
182 | 381 | } |
183 | 382 | } |
... | ... | @@ -237,6 +436,36 @@ |
237 | 436 | letter-spacing: -0.23px; |
238 | 437 | margin-bottom: 18rpx; |
239 | 438 | } |
439 | + .use_pd{ | |
440 | + display: flex; | |
441 | + height: 48rpx; | |
442 | + line-height: 48rpx; | |
443 | + margin-left: -298rpx; | |
444 | + margin-top: 30rpx; | |
445 | + margin-bottom: 40rpx; | |
446 | + align-items: center; | |
447 | + justify-content: center; | |
448 | + text{ | |
449 | + font-size: 14px; | |
450 | + color: #333333; | |
451 | + margin-right: 44rpx; | |
452 | + } | |
453 | + } | |
454 | + .use_name{ | |
455 | + display: flex; | |
456 | + height: 48rpx; | |
457 | + line-height: 48rpx; | |
458 | + margin-left: -220rpx; | |
459 | + margin-top: 20rpx; | |
460 | + align-items: center; | |
461 | + justify-content: center; | |
462 | + // text-align: center; | |
463 | + text{ | |
464 | + font-size: 14px; | |
465 | + color: #333333; | |
466 | + margin-right: 44rpx; | |
467 | + } | |
468 | + } | |
240 | 469 | image{ |
241 | 470 | width: 28rpx; |
242 | 471 | height: 26rpx; |
... | ... | @@ -307,6 +536,8 @@ |
307 | 536 | text-align: center; |
308 | 537 | width: 124rpx; |
309 | 538 | border-bottom: 1px solid #CFCFCF; |
539 | + height: 40rpx; | |
540 | + | |
310 | 541 | } |
311 | 542 | |
312 | 543 | } | ... | ... |
src/pages/user/user.vue
1 | 1 | <template> |
2 | 2 | <view class="wrap"> |
3 | + <!-- 弹窗 --> | |
4 | + <uni-popup ref="popup" type="center"> | |
5 | + <!-- 给一个左边弹窗的样式 --> | |
6 | + <!-- 关闭弹窗按钮 --> | |
7 | + <view class="closeBtn" @click="this.$refs.popup.close()">x</view> | |
8 | + <view class="popUpWrap" v-if="whichTap==0"> | |
9 | + <text>这是一款眼镜及周边产品的销售平台,我们将帮您进行建立全球销售网络,欢迎入驻。</text> | |
10 | + | |
11 | + <!-- 左 --> | |
12 | + <!-- <image class="glassInfo" src="../../static/img/myOpticsData/glassInfo.png" v-if="whichTap == 0" mode="aspectFit"></image> --> | |
13 | + <!-- 右 --> | |
14 | + <!-- <image class="dataInfo" src="../../static/img/myOpticsData/dataInfo.png" v-else mode="aspectFit"></image> --> | |
15 | + </view> | |
16 | + <view class="popUpWrap" v-if="whichTap==1"> | |
17 | + <text>本平台欢迎全国各地的眼镜工厂、品牌、眼镜店加入。请联系我们申请注册账号。</text> | |
18 | + </view> | |
19 | + <view class="popUpWrap" v-if="whichTap==2"> | |
20 | + <button @click="chatOur(1)">客服1</button> | |
21 | + <button @click="chatOur(2)">客服2</button> | |
22 | + </view> | |
23 | + </uni-popup> | |
3 | 24 | <view v-if="isAuth" class="content"> |
4 | 25 | <view class="userInfo"> |
5 | 26 | <view class="info"> |
... | ... | @@ -54,21 +75,21 @@ |
54 | 75 | </view> |
55 | 76 | <image src="../../static/right.png" mode="aspectFit"></image> |
56 | 77 | </view> --> |
57 | - <view class="item"> | |
78 | + <view class="item" @click="changeTap(0)"> | |
58 | 79 | <view class="left"> |
59 | 80 | <image src="../../static/img/user/introduce.png" mode="aspectFit"></image> |
60 | 81 | <text>系统介绍</text> |
61 | 82 | </view> |
62 | 83 | <image src="../../static/right.png" mode="aspectFit"></image> |
63 | 84 | </view> |
64 | - <view class="item"> | |
85 | + <view class="item" @click="changeTap(1)"> | |
65 | 86 | <view class="left"> |
66 | 87 | <image src="../../static/img/user/joinUs.png" mode="aspectFit"></image> |
67 | 88 | <text>加入我们</text> |
68 | 89 | </view> |
69 | 90 | <image src="../../static/right.png" mode="aspectFit"></image> |
70 | 91 | </view> |
71 | - <view class="item"> | |
92 | + <view class="item" @click="changeTap(2)"> | |
72 | 93 | <view class="left"> |
73 | 94 | <image src="../../static/img/user/service.png" mode="aspectFit"></image> |
74 | 95 | <text>联系客服</text> |
... | ... | @@ -112,15 +133,18 @@ |
112 | 133 | <script> |
113 | 134 | import Card from "@/components/CommodityCard/CommodityCard.vue"; |
114 | 135 | import store from '@/store'; |
136 | + import UniPopup from '@/components/UniPopup/uni-popup.vue' | |
115 | 137 | |
116 | 138 | export default { |
117 | 139 | components: { |
118 | - 'Card':Card | |
140 | + 'Card':Card, | |
141 | + UniPopup | |
119 | 142 | }, |
120 | 143 | data() { |
121 | 144 | return { |
122 | 145 | isAuth: true, // 是否显示授权页面, |
123 | - pagesnum:1 // 分页请求初始值 | |
146 | + pagesnum:1, // 分页请求初始值 | |
147 | + whichTap:0, // 弹窗渲染选择条件 | |
124 | 148 | } |
125 | 149 | }, |
126 | 150 | onLoad() { |
... | ... | @@ -163,6 +187,22 @@ |
163 | 187 | }, |
164 | 188 | |
165 | 189 | methods: { |
190 | + // 弹窗 | |
191 | + changeTap(item){ | |
192 | + this.whichTap = item | |
193 | + this.$refs.popup.open() | |
194 | + }, | |
195 | + chatOur(item){ | |
196 | + if(item==1){ | |
197 | + uni.makePhoneCall({ | |
198 | + phoneNumber:13376189297, // 客服1 电话 | |
199 | + }) | |
200 | + } else{ | |
201 | + uni.makePhoneCall({ | |
202 | + phoneNumber:18014995101 // 客服2 电话 | |
203 | + }) | |
204 | + } | |
205 | + }, | |
166 | 206 | // 授权 |
167 | 207 | onGotUserInfo(e) { |
168 | 208 | console.log('anthInfo', e); |
... | ... | @@ -477,5 +517,40 @@ |
477 | 517 | border-radius: 30rpx; |
478 | 518 | } |
479 | 519 | } |
520 | + | |
521 | + .popUpWrap{ | |
522 | + height: 200rpx; | |
523 | + width: 542rpx; | |
524 | + background-color: #FFFFFF; | |
525 | + border-radius: 4px; | |
526 | + border: 1px solid #979797; | |
527 | + display: flex; | |
528 | + align-items: center; | |
529 | + justify-items: center; | |
530 | + box-sizing: border-box; | |
531 | + padding: 0 20rpx; | |
532 | + text{ | |
533 | + font-size: 12px; | |
534 | + color: #333333; | |
535 | + } | |
536 | + button{ | |
537 | + width: 150rpx; | |
538 | + height: 80rpx; | |
539 | + border-radius: 4px; | |
540 | + text-align: center; | |
541 | + line-height: 80rpx; | |
542 | + font-size: 14px; | |
543 | + | |
544 | + } | |
545 | + } | |
546 | + .closeBtn{ | |
547 | + height: 28rpx; | |
548 | + width: 28rpx; | |
549 | + // border: 1px solid red; | |
550 | + position: absolute; | |
551 | + top: 20rpx; | |
552 | + right: 10rpx; | |
553 | + } | |
554 | + | |
480 | 555 | |
481 | 556 | </style> | ... | ... |
src/store/modules/myLoveList.js
... | ... | @@ -2,7 +2,9 @@ import urlAlias from '../url'; |
2 | 2 | import request from '../request'; |
3 | 3 | |
4 | 4 | const { |
5 | - mylovelist | |
5 | + mylovelist, | |
6 | + myloveadd, | |
7 | + myloveupdate | |
6 | 8 | } = urlAlias; |
7 | 9 | |
8 | 10 | const state = { |
... | ... | @@ -12,7 +14,12 @@ const state = { |
12 | 14 | const mutations = { |
13 | 15 | INIT: (state, data) => { |
14 | 16 | state.loveList = data; |
15 | - }, | |
17 | + }, | |
18 | + // 更新关心人验光单 | |
19 | + UPDATE:(state, data) => { | |
20 | + // state.loveList.push(data) | |
21 | + // console.log('UPDATA=====>',data) | |
22 | + } | |
16 | 23 | }; |
17 | 24 | |
18 | 25 | const actions = { |
... | ... | @@ -25,7 +32,32 @@ const actions = { |
25 | 32 | commit("INIT", res.data.data); |
26 | 33 | }, |
27 | 34 | }) |
28 | - } | |
35 | + }, | |
36 | + addMylove({ commit }, param) { | |
37 | + | |
38 | + console.log('myloveupdate-parm====>',param) | |
39 | + request({ | |
40 | + url: myloveadd, | |
41 | + data: param, | |
42 | + success: (res) => { | |
43 | + console.log('addMylove-parm====>',param) | |
44 | + console.log(res.data); | |
45 | + // commit("ADD", args); | |
46 | + }, | |
47 | + }) | |
48 | + }, | |
49 | + updateMylove({ commit }, param) { | |
50 | + request({ | |
51 | + url: myloveupdate, | |
52 | + data: param, | |
53 | + success: (res) => { | |
54 | + console.log('myloveupdate-parm====>',param) | |
55 | + console.log(res); | |
56 | + // commit("UPDATE", param); | |
57 | + }, | |
58 | + }) | |
59 | + }, | |
60 | + | |
29 | 61 | } |
30 | 62 | |
31 | 63 | export default { | ... | ... |
src/store/url.js
... | ... | @@ -40,7 +40,8 @@ const urlAlias = { |
40 | 40 | |
41 | 41 | // 用户数据 |
42 | 42 | mylovelist: '/app/user/mylovelist', // 关心的人的数据 |
43 | - myloveadd: '/app/user/myloveadd' // 添加关心的人 | |
43 | + myloveadd: '/app/user/myloveadd', // 添加关心的人 | |
44 | + myloveupdate: '/app/user/myloveupdate' // 更新关心人的数据 | |
44 | 45 | } |
45 | 46 | |
46 | 47 | export default urlAlias | ... | ... |