Commit 089dce19da0a1073daa2d196144ffda8ef050f50
1 parent
5f77f7e7e6
Exists in
master
支付修改
Showing
10 changed files
with
793 additions
and
722 deletions
Show diff stats
.eslintrc.js
| ... | ... | @@ -26,6 +26,14 @@ module.exports = { |
| 26 | 26 | ], |
| 27 | 27 | "rules": { |
| 28 | 28 | quotes: ['error', 'single'], |
| 29 | - 'space-before-function-paren': 0 | |
| 29 | + 'space-before-function-paren': 0, | |
| 30 | + // 数组和对象键值对最后一个逗号, never参数:不能带末尾的逗号, always参数:必须带末尾的逗号, | |
| 31 | + // always-multiline:多行模式必须带逗号,单行模式不能带逗号 | |
| 32 | + "comma-dangle": [2, "always-multiline"], | |
| 33 | + // 控制逗号前后的空格 | |
| 34 | + "comma-spacing": [2, { "before": false, "after": true }], | |
| 35 | + // 控制逗号在行尾出现还是在行首出现 | |
| 36 | + // http://eslint.org/docs/rules/comma-style | |
| 37 | + "comma-style": [2, "last"], | |
| 30 | 38 | } |
| 31 | 39 | }; | ... | ... |
src/components/CommodityCard/CommodityCard.vue
| ... | ... | @@ -10,9 +10,10 @@ |
| 10 | 10 | <view class="name">{{goods.name?goods.name:goods.p_name}}</view> |
| 11 | 11 | <view class="info"> |
| 12 | 12 | <view class="priceBox"> |
| 13 | - <view class="price">{{goods.oldPrice !== undefined?goods.oldPrice:goods.old_price}}</view> | |
| 13 | + <view class="price">{{goods.old_price ? goods.old_price : (goods.rsSon && goods.rsSon.Min_Price)}}</view> | |
| 14 | 14 | <view class="originCost"> |
| 15 | - {{goods.price !== undefined?goods.price:goods.real_price}} | |
| 15 | + <!-- {{goods.price !== undefined?goods.price:goods.real_price}} --> | |
| 16 | + {{goods.real_price ? goods.real_price : parseInt(goods.rsSon && goods.rsSon.Min_Price*(1 + Number(goods.rsSon.discount)/100))}} | |
| 16 | 17 | </view> |
| 17 | 18 | </view> |
| 18 | 19 | <view class="trade_num">{{goods.trade_num}}人购买</view> |
| ... | ... | @@ -34,8 +35,8 @@ export default { |
| 34 | 35 | originCost: String, |
| 35 | 36 | price: String, |
| 36 | 37 | trade_num: String, |
| 37 | - goodType: String | |
| 38 | - } | |
| 38 | + goodType: String, | |
| 39 | + }, | |
| 39 | 40 | |
| 40 | 41 | }, |
| 41 | 42 | created () { |
| ... | ... | @@ -52,10 +53,10 @@ export default { |
| 52 | 53 | url: '../frameDetail/frameDetail?pid=' + id, |
| 53 | 54 | success: res => {}, |
| 54 | 55 | fail: () => {}, |
| 55 | - complete: () => {} | |
| 56 | + complete: () => {}, | |
| 56 | 57 | }) |
| 57 | - } | |
| 58 | - } | |
| 58 | + }, | |
| 59 | + }, | |
| 59 | 60 | } |
| 60 | 61 | </script> |
| 61 | 62 | ... | ... |
src/pages/confirmOrder/confirmOrder.vue
| ... | ... | @@ -61,7 +61,9 @@ |
| 61 | 61 | <text class="goodName">商品名称商品名称商品名称名称名称</text> |
| 62 | 62 | <text class="remarks">支持7天无理由退货 顺丰发货</text> |
| 63 | 63 | <view class="priceBox"> |
| 64 | - <view class="price">¥198</view> | |
| 64 | + <view class="price">¥{{Number(skuInfo.real_price) * count}}<text class="originCost"> | |
| 65 | + ¥{{parseInt(skuInfo.real_price * (1 + Number(skuInfo.discount) / 100))}} | |
| 66 | + </text></view> | |
| 65 | 67 | <view class="counter"> |
| 66 | 68 | <view |
| 67 | 69 | class="btn" |
| ... | ... | @@ -80,7 +82,13 @@ |
| 80 | 82 | </view> |
| 81 | 83 | </view> |
| 82 | 84 | <view class="infoBottom"> |
| 83 | - <view class="norm">规格 <text>玫瑰金/钛合金</text></view> | |
| 85 | + <view class="norm">规格 <text > | |
| 86 | + <!-- 长度超出变省略号未做 --> | |
| 87 | + <block | |
| 88 | + v-for="(item, index) in current" | |
| 89 | + :key="index" | |
| 90 | + >{{attrList[index].attr[item].name}}<block v-if="index !== current.length -1">/</block></block> | |
| 91 | + </text></view> | |
| 84 | 92 | <view class="shippingMethod">配送方式 <text>快递</text></view> |
| 85 | 93 | <view class="message">买家留言 |
| 86 | 94 | <input |
| ... | ... | @@ -136,7 +144,7 @@ |
| 136 | 144 | <view class="item"> |
| 137 | 145 | <text>合计</text> |
| 138 | 146 | <view class="itemRight"> |
| 139 | - <view class="total">¥{{total}}</view> | |
| 147 | + <view class="total">¥{{Number(skuInfo.real_price) * count}}</view> | |
| 140 | 148 | </view> |
| 141 | 149 | </view> |
| 142 | 150 | </view> |
| ... | ... | @@ -150,7 +158,7 @@ |
| 150 | 158 | </view> --> |
| 151 | 159 | </view> |
| 152 | 160 | <view class="footer"> |
| 153 | - <view class="footerLeft">实付金额:<text>¥{{total}}</text></view> | |
| 161 | + <view class="footerLeft">实付金额:<text>¥{{Number(skuInfo.real_price) * count}}</text></view> | |
| 154 | 162 | <view class="footerRight"> |
| 155 | 163 | <view |
| 156 | 164 | class="paybtn" |
| ... | ... | @@ -171,22 +179,21 @@ export default { |
| 171 | 179 | count: 1, |
| 172 | 180 | pid: 0, |
| 173 | 181 | disabled: false, |
| 174 | - total: 120, | |
| 175 | 182 | freight: 0.00, |
| 176 | 183 | showAddress: false, |
| 177 | 184 | note: '', |
| 178 | 185 | addressInfo: { |
| 179 | - address: '' | |
| 180 | - } | |
| 186 | + address: '', | |
| 187 | + }, | |
| 181 | 188 | // isAnonymous: |
| 182 | 189 | } |
| 183 | 190 | }, |
| 184 | - onLoad({ pid, addressId }) { | |
| 191 | + onLoad({ pid, addressId, isCart }) { | |
| 185 | 192 | this.pid = pid |
| 186 | 193 | // 若已经选择地址 |
| 187 | 194 | if (addressId) { |
| 188 | 195 | store.dispatch('address/details', { |
| 189 | - add_id: addressId | |
| 196 | + add_id: addressId, | |
| 190 | 197 | }).then(({ code, data }) => { |
| 191 | 198 | if (code === 1) { |
| 192 | 199 | console.log('code', code, data) |
| ... | ... | @@ -204,14 +211,23 @@ export default { |
| 204 | 211 | }) |
| 205 | 212 | } |
| 206 | 213 | store.dispatch('read/fetch', { |
| 207 | - pid | |
| 214 | + pid, | |
| 208 | 215 | }) |
| 209 | 216 | }, |
| 210 | 217 | computed: { |
| 211 | 218 | goodInfo () { |
| 212 | - console.log(this.$store.state.read.goodInfo) | |
| 219 | + console.log('state', this.$store.state) | |
| 213 | 220 | return this.$store.state.read.goodInfo |
| 214 | - } | |
| 221 | + }, | |
| 222 | + skuInfo () { | |
| 223 | + return this.$store.state.order.param.sk_id_arr | |
| 224 | + }, | |
| 225 | + attrList () { | |
| 226 | + return this.$store.state.order.param.attrList | |
| 227 | + }, | |
| 228 | + current () { | |
| 229 | + return this.$store.state.order.param.current | |
| 230 | + }, | |
| 215 | 231 | }, |
| 216 | 232 | methods: { |
| 217 | 233 | counter(isadd) { |
| ... | ... | @@ -221,40 +237,57 @@ export default { |
| 221 | 237 | this.count <= 1 ? this.disabled = true : this.count-- |
| 222 | 238 | } |
| 223 | 239 | }, |
| 240 | + // 跳转添加地址页面 | |
| 224 | 241 | toaddAddress() { |
| 225 | 242 | uni.navigateTo({ |
| 226 | 243 | url: `../address/addressList?edit=${1}`, |
| 227 | 244 | success: res => {}, |
| 228 | 245 | fail: (error) => { console.log('跳转到地址列表页面失败====>', error) }, |
| 229 | - complete: () => {} | |
| 246 | + complete: () => {}, | |
| 230 | 247 | }) |
| 231 | 248 | }, |
| 232 | 249 | // 下单 |
| 233 | 250 | orderBuild() { |
| 234 | 251 | console.log('this', this.$store.state) |
| 235 | - // store.dispatch('order/build', { | |
| 236 | - // pid: 2, | |
| 237 | - // sk_id: '23', | |
| 238 | - // number: 2, | |
| 239 | - // mp_id: '201', | |
| 240 | - // totalPrice: 101, | |
| 241 | - // address: this.addressInfo, | |
| 242 | - // dir: 1 | |
| 243 | - // }) | |
| 244 | - } | |
| 252 | + const { sk_id_arr: skId, mp_id: mpId } = this.$store.state.order.param | |
| 253 | + store.dispatch('order/buyNow', { | |
| 254 | + pid: skId.pid, | |
| 255 | + sk_id: skId.sk_id, | |
| 256 | + number: this.count, | |
| 257 | + mp_id: mpId, | |
| 258 | + address: JSON.stringify(this.addressInfo), | |
| 259 | + totalPrice: Number(this.skuInfo.real_price) * this.count * 100, | |
| 260 | + liuyan: this.note, | |
| 261 | + dir: 1, | |
| 262 | + }).then((res) => { | |
| 263 | + this.pay(res.data) | |
| 264 | + }) | |
| 265 | + }, | |
| 245 | 266 | // 支付 |
| 246 | - // pay() { | |
| 247 | - // const openId = uni.getStorageSync('openid') | |
| 248 | - // const fieldSet = { | |
| 249 | - // 'openid': this.$store.state.user.userInfo.openid, | |
| 250 | - // 'uid': this.$store.state.user.userInfo.uid, | |
| 251 | - // 'shopid': 0, | |
| 252 | - // 'payCate': 2020, | |
| 253 | - // 'payMoney': , | |
| 254 | - // '' | |
| 255 | - // } | |
| 256 | - // } | |
| 257 | - } | |
| 267 | + pay(res) { | |
| 268 | + console.log('pay', res) | |
| 269 | + const { data, exKeyName: keyName } = res | |
| 270 | + const uid = uni.getStorageSync('uid') | |
| 271 | + const fieldSet = { | |
| 272 | + openid: this.$store.state.user.userInfo.openid, | |
| 273 | + uid: this.$store.state.user.userInfo.uid, | |
| 274 | + shopid: 0, | |
| 275 | + payCate: 2020, | |
| 276 | + payMoney: Number(this.skuInfo.real_price) * this.count * 100, | |
| 277 | + payWoodId: `fcdj-${uid}-${keyName}`, | |
| 278 | + nonceStr: 'asfafasfasfasfasf', | |
| 279 | + signType: 'MD5', | |
| 280 | + app_uid: 2020, | |
| 281 | + timeStamp: new Date().getTime().toString(), | |
| 282 | + billInfo: JSON.stringify(data), | |
| 283 | + keyname: keyName, | |
| 284 | + } | |
| 285 | + console.log('fieldSet', fieldSet) | |
| 286 | + store.dispatch('order/pay', fieldSet).then((res) => { | |
| 287 | + console.log('res', res) | |
| 288 | + }) | |
| 289 | + }, | |
| 290 | + }, | |
| 258 | 291 | } |
| 259 | 292 | </script> |
| 260 | 293 | |
| ... | ... | @@ -355,6 +388,11 @@ export default { |
| 355 | 388 | color: #ff6b4a; |
| 356 | 389 | font-size: 28rpx; |
| 357 | 390 | } |
| 391 | + .originCost { | |
| 392 | + text-decoration: line-through; | |
| 393 | + color: #999999; | |
| 394 | + font-size: 20rpx; | |
| 395 | + } | |
| 358 | 396 | .counter { |
| 359 | 397 | display: flex; |
| 360 | 398 | flex-direction: row; | ... | ... |
src/pages/frameDetail/frameDetail.vue
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | ></image> |
| 20 | 20 | </swiper-item> |
| 21 | 21 | </swiper> |
| 22 | - <view class="D1_price">¥{{goodInfo.p_sale_price || '暂无'}}<span class="D1_number">{{goodInfo.trade_num || '暂无'}}人购买过</span></view> | |
| 22 | + <view class="D1_price">¥{{goodInfo.priceArea.Min_Price || '暂无'}}<span class="D1_number">{{goodInfo.trade_num || '暂无'}}人购买过</span></view> | |
| 23 | 23 | <view class="D1_name"><span class="D1_name1">{{goodInfo.p_name || '暂无'}}</span></view> |
| 24 | 24 | <view class="D1_spans"><span>支持7天无理由退货</span><span>顺丰发货</span><span>30天质量保证</span></view> |
| 25 | 25 | </view> |
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | <view><span class="D2_span1">风格:</span><span class="D2_span2">{{introduction.func}}</span></view> |
| 32 | 32 | <view><span class="D2_span1">适用性别:</span><span class="D2_span2">{{introduction.rate}}</span></view> |
| 33 | 33 | </view> |
| 34 | - <view | |
| 34 | + <!-- <view | |
| 35 | 35 | class="D2" |
| 36 | 36 | v-if="updateGoodType == 1" |
| 37 | 37 | > |
| ... | ... | @@ -46,7 +46,7 @@ |
| 46 | 46 | <view><span class="D2_span1">材质:</span><span class="D2_span2">{{introduction.material}}</span></view> |
| 47 | 47 | <view><span class="D2_span1">直径/基弧:</span><span class="D2_span2">{{introduction.func}}</span></view> |
| 48 | 48 | <view><span class="D2_span1">适用性别:</span><span class="D2_span2">{{introduction.rate}}</span></view> |
| 49 | - </view> | |
| 49 | + </view> --> | |
| 50 | 50 | <view class="D3"> |
| 51 | 51 | <view class="screenBar"> |
| 52 | 52 | <view |
| ... | ... | @@ -339,12 +339,12 @@ export default { |
| 339 | 339 | mp_id: 335, |
| 340 | 340 | sk_id: 0, |
| 341 | 341 | num: 1, |
| 342 | - price: '' | |
| 342 | + price: '', | |
| 343 | 343 | }, |
| 344 | 344 | screenItems: [ |
| 345 | 345 | { current: 0, text: '商品介绍' }, |
| 346 | 346 | { current: 1, text: '规格参数' }, |
| 347 | - { current: 2, text: '售后保障' } | |
| 347 | + { current: 2, text: '售后保障' }, | |
| 348 | 348 | ], |
| 349 | 349 | current: 0, |
| 350 | 350 | starCount: 5, |
| ... | ... | @@ -354,38 +354,38 @@ export default { |
| 354 | 354 | { key: 2, img: '/static/img/detail/d4.png', standard: '镜片高', slength: '45mm' }, |
| 355 | 355 | { key: 3, img: '/static/img/detail/d5.png', standard: '鼻架宽', slength: '19mm' }, |
| 356 | 356 | { key: 4, img: '/static/img/detail/d6.png', standard: '框架耳长', slength: '138mm' }, |
| 357 | - { key: 5, img: '/static/img/detail/d7.png', standard: '框架重', slength: '19mm' } | |
| 357 | + { key: 5, img: '/static/img/detail/d7.png', standard: '框架重', slength: '19mm' }, | |
| 358 | 358 | ], |
| 359 | 359 | esvalue: '宝贝好评率', |
| 360 | 360 | introduction: { |
| 361 | 361 | material: '钛合金', |
| 362 | 362 | func: '抗疲劳/防辐射', |
| 363 | - rate: '男/女' | |
| 363 | + rate: '男/女', | |
| 364 | 364 | }, |
| 365 | 365 | imgAll: '/static/img/detail/d8.png', |
| 366 | 366 | photoes: [ |
| 367 | 367 | { value: '日常办公', img: '/static/img/detail/d9.png' }, |
| 368 | 368 | { value: '上网', img: '/static/img/detail/d10.png' }, |
| 369 | 369 | { value: '追剧', img: '/static/img/detail/d11.png' }, |
| 370 | - { value: '玩游戏', img: '/static/img/detail/d12.png' } | |
| 370 | + { value: '玩游戏', img: '/static/img/detail/d12.png' }, | |
| 371 | 371 | ], |
| 372 | 372 | imgDetail: '/static/img/detail/d13.png', |
| 373 | 373 | imgShop: { |
| 374 | 374 | img: '/static/tab-cart.png', |
| 375 | - IsShown: false | |
| 375 | + IsShown: false, | |
| 376 | 376 | }, |
| 377 | 377 | tag: { |
| 378 | 378 | prod_tag_freesend: [{ |
| 379 | 379 | label: '眼镜盒', |
| 380 | - value: '262' | |
| 381 | - }] | |
| 382 | - } | |
| 380 | + value: '262', | |
| 381 | + }], | |
| 382 | + }, | |
| 383 | 383 | } |
| 384 | 384 | }, |
| 385 | 385 | onLoad: function ({ pid }) { |
| 386 | 386 | this.pid = pid |
| 387 | 387 | store.dispatch('read/fetch', { |
| 388 | - pid | |
| 388 | + pid, | |
| 389 | 389 | }).then(() => { |
| 390 | 390 | this.parameter[0].slength = `${this.goodInfo.frame_width}mm` |
| 391 | 391 | this.parameter[1].slength = `${this.goodInfo.glass_width}mm` |
| ... | ... | @@ -406,7 +406,7 @@ export default { |
| 406 | 406 | goodInfo () { |
| 407 | 407 | console.log(this.$store.state.read.goodInfo) |
| 408 | 408 | return this.$store.state.read.goodInfo |
| 409 | - } | |
| 409 | + }, | |
| 410 | 410 | }, |
| 411 | 411 | methods: { |
| 412 | 412 | // 前往购物车 |
| ... | ... | @@ -415,7 +415,7 @@ export default { |
| 415 | 415 | url: '/pages/cart/cart', |
| 416 | 416 | success: res => {}, |
| 417 | 417 | fail: (error) => { console.log('跳转购物车失败======>', error) }, |
| 418 | - complete: () => { console.log('toCart') } | |
| 418 | + complete: () => { console.log('toCart') }, | |
| 419 | 419 | }) |
| 420 | 420 | }, |
| 421 | 421 | // 加入购物车 |
| ... | ... | @@ -428,10 +428,10 @@ export default { |
| 428 | 428 | num: this.addCartList.num, |
| 429 | 429 | pid: this.pid, |
| 430 | 430 | price: this.addCartList.price, |
| 431 | - checkedSKU: {} | |
| 431 | + checkedSKU: {}, | |
| 432 | 432 | }) |
| 433 | 433 | store.dispatch('cart/getCartList', { |
| 434 | - uid: this.$store.state.user.userInfo.uid // 用户id | |
| 434 | + uid: this.$store.state.user.userInfo.uid, // 用户id | |
| 435 | 435 | }) |
| 436 | 436 | }, |
| 437 | 437 | goPerchase () { |
| ... | ... | @@ -442,7 +442,7 @@ export default { |
| 442 | 442 | url: `../purchaseLenses/purchaseLenses?pid=${this.pid}`, |
| 443 | 443 | success: res => {}, |
| 444 | 444 | fail: (error) => { console.log('跳转参数选择失败======>', error) }, |
| 445 | - complete: () => { console.log('goPerchase') } | |
| 445 | + complete: () => { console.log('goPerchase') }, | |
| 446 | 446 | }) |
| 447 | 447 | // break |
| 448 | 448 | // case '2': |
| ... | ... | @@ -479,18 +479,18 @@ export default { |
| 479 | 479 | uid: this.$store.state.user.userInfo.uid, |
| 480 | 480 | openid: this.$store.state.user.userInfo.openid, |
| 481 | 481 | pid: this.pid, |
| 482 | - checkedSKU: {} | |
| 482 | + checkedSKU: {}, | |
| 483 | 483 | }) |
| 484 | 484 | store.dispatch('cart/getCartList', { |
| 485 | - uid: this.$store.state.user.userInfo.uid // 用户id | |
| 485 | + uid: this.$store.state.user.userInfo.uid, // 用户id | |
| 486 | 486 | }) |
| 487 | 487 | }, |
| 488 | 488 | tabChange (e) { |
| 489 | 489 | if (this.current !== e) { |
| 490 | 490 | this.current = e |
| 491 | 491 | } |
| 492 | - } | |
| 493 | - } | |
| 492 | + }, | |
| 493 | + }, | |
| 494 | 494 | } |
| 495 | 495 | </script> |
| 496 | 496 | <style lang='scss'> | ... | ... |
src/pages/myOrder/myOrder.vue
| ... | ... | @@ -39,7 +39,7 @@ import store from '@/store' |
| 39 | 39 | |
| 40 | 40 | export default { |
| 41 | 41 | components: { |
| 42 | - OrderCard: OrderCard | |
| 42 | + OrderCard: OrderCard, | |
| 43 | 43 | }, |
| 44 | 44 | data() { |
| 45 | 45 | return { |
| ... | ... | @@ -48,20 +48,19 @@ export default { |
| 48 | 48 | { current: '10', text: '全部' }, |
| 49 | 49 | { current: '0', text: '待付款' }, |
| 50 | 50 | { current: '1', text: '待收货' }, |
| 51 | - { current: '2', text: '已完成' } | |
| 51 | + { current: '2', text: '已完成' }, | |
| 52 | 52 | // {current:"3",text:'已评价'}, |
| 53 | 53 | // {current:"4",text:'退款'}, |
| 54 | 54 | ], |
| 55 | 55 | // 当前所在item 默认10-->全部 |
| 56 | - current: '10' | |
| 56 | + current: '10', | |
| 57 | 57 | } |
| 58 | 58 | }, |
| 59 | 59 | |
| 60 | 60 | onLoad: function(option) { |
| 61 | 61 | // 获取订单列表 |
| 62 | 62 | store.dispatch('myOrder/getList', { |
| 63 | - uid: '1', | |
| 64 | - way: '' | |
| 63 | + way: '', | |
| 65 | 64 | }) |
| 66 | 65 | // 从user过来传的status,给current,以显示对应item |
| 67 | 66 | this.current = option.status |
| ... | ... | @@ -70,7 +69,7 @@ export default { |
| 70 | 69 | orderList() { |
| 71 | 70 | // console.log('orderList', this.$store.state.myOrder.orderList); |
| 72 | 71 | return this.$store.state.myOrder.orderList |
| 73 | - } | |
| 72 | + }, | |
| 74 | 73 | }, |
| 75 | 74 | methods: { |
| 76 | 75 | // tab点击事件 |
| ... | ... | @@ -78,9 +77,9 @@ export default { |
| 78 | 77 | if (this.current !== e) { |
| 79 | 78 | this.current = e |
| 80 | 79 | } |
| 81 | - } | |
| 80 | + }, | |
| 82 | 81 | |
| 83 | - } | |
| 82 | + }, | |
| 84 | 83 | } |
| 85 | 84 | </script> |
| 86 | 85 | ... | ... |
src/pages/purchaseLenses/purchaseLenses.vue
| ... | ... | @@ -36,139 +36,139 @@ |
| 36 | 36 | <view class="opCollapse"> |
| 37 | 37 | <view class="body"> |
| 38 | 38 | <template v-if="opIsOpen"> |
| 39 | - <view class="goods-form"> | |
| 40 | - <view class="p1"> | |
| 41 | - <image class="image2" src="../../static/img/myOpticsData/dataWrite.png" mode="aspectFit"></image> | |
| 42 | - 填写验光数据 | |
| 43 | - </view> | |
| 44 | - <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text> | |
| 45 | - <view class="picker"> | |
| 46 | - <view class="picker-choice"> | |
| 47 | - <view class="choice-left"> | |
| 48 | - <text class="pd">验光单取名:</text> | |
| 49 | - </view> | |
| 50 | - <input type="text" @blur="handleInput" class="input" | |
| 51 | - placeholder="请输入名称" maxlength="20" :value="name" /> | |
| 52 | - </view> | |
| 53 | - </view> | |
| 54 | - <view class="picker" > | |
| 55 | - <view class="picker-choice"> | |
| 56 | - <view class="choice-left"> | |
| 57 | - <text class="p11">{{pickerInfoList[0].nameC}}</text> | |
| 58 | - <text class="p12">{{pickerInfoList[0].nameE}}</text> | |
| 59 | - </view> | |
| 60 | - <text class="p13">左 (OD)</text> | |
| 61 | - <!-- <text class="p14">{{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}</text> --> | |
| 62 | - <picker @change="bindPickerChange01" :value="pickerInfoList[0].nameIndex1" :range="pickerInfoList[0].nameArray1"> | |
| 63 | - <view class="p14"> | |
| 64 | - {{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}} | |
| 65 | - <image src="../../static/detail-tabicon.png" ></image> | |
| 66 | - </view> | |
| 67 | - <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 68 | - </picker> | |
| 69 | - <text class="p13">右 (OS)</text> | |
| 70 | - <!-- <text class="p14">{{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}</text> --> | |
| 71 | - <picker @change="bindPickerChange02" :value="pickerInfoList[0].nameIndex2" :range="pickerInfoList[0].nameArray2"> | |
| 72 | - <view class="p14"> | |
| 73 | - {{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}} | |
| 74 | - <image src="../../static/detail-tabicon.png" ></image> | |
| 75 | - </view> | |
| 76 | - <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 77 | - </picker> | |
| 78 | - </view> | |
| 79 | - </view> | |
| 80 | - <view class="picker" > | |
| 81 | - <view class="picker-choice"> | |
| 82 | - <view class="choice-left"> | |
| 83 | - <text class="p11">{{pickerInfoList[1].nameC}}</text> | |
| 84 | - <text class="p12">{{pickerInfoList[1].nameE}}</text> | |
| 85 | - </view> | |
| 86 | - <text class="p13">左 (OD)</text> | |
| 87 | - <!-- <text class="p14">{{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}</text> --> | |
| 88 | - <picker @change="bindPickerChange11" :value="pickerInfoList[1].nameIndex1" :range="pickerInfoList[1].nameArray1"> | |
| 89 | - <view class="p14"> | |
| 90 | - {{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}} | |
| 91 | - <image src="../../static/detail-tabicon.png" ></image> | |
| 92 | - </view> | |
| 93 | - <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 94 | - </picker> | |
| 95 | - <text class="p13">右 (OS)</text> | |
| 96 | - <!-- <text class="p14">{{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}</text> --> | |
| 97 | - <picker @change="bindPickerChange12" :value="pickerInfoList[1].nameIndex2" :range="pickerInfoList[1].nameArray2"> | |
| 98 | - <view class="p14"> | |
| 99 | - {{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}} | |
| 100 | - <image src="../../static/detail-tabicon.png" ></image> | |
| 101 | - </view> | |
| 102 | - <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 103 | - </picker> | |
| 104 | - </view> | |
| 105 | - </view> | |
| 106 | - <view class="picker" > | |
| 107 | - <view class="picker-choice"> | |
| 108 | - <view class="choice-left"> | |
| 109 | - <text class="p11">{{pickerInfoList[2].nameC}}</text> | |
| 110 | - <text class="p12">{{pickerInfoList[2].nameE}}</text> | |
| 111 | - </view> | |
| 112 | - <text class="p13">左 (OD)</text> | |
| 113 | - <picker @change="bindPickerChange21" :value="pickerInfoList[2].nameIndex1" :range="pickerInfoList[2].nameArray1"> | |
| 114 | - <view class="p14"> | |
| 115 | - {{pickerInfoList[2].nameArray1[pickerInfoList[2].nameIndex1]}} | |
| 116 | - <image src="../../static/detail-tabicon.png" ></image> | |
| 117 | - </view> | |
| 118 | - </picker> | |
| 119 | - <text class="p13">右 (OS)</text> | |
| 120 | - <!-- <text class="p14">{{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}</text> --> | |
| 121 | - <picker @change="bindPickerChange22" :value="pickerInfoList[2].nameIndex2" :range="pickerInfoList[2].nameArray2"> | |
| 122 | - <view class="p14"> | |
| 123 | - {{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}} | |
| 124 | - <image src="../../static/detail-tabicon.png" ></image> | |
| 125 | - </view> | |
| 126 | - <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 127 | - </picker> | |
| 128 | - </view> | |
| 129 | - </view> | |
| 130 | - <view class="picker"> | |
| 131 | - <view class="picker-choice"> | |
| 132 | - <view class="choice-left"> | |
| 133 | - <text class="pd">瞳距:</text> | |
| 134 | - </view> | |
| 135 | - <input type="digit" @change="handleInputPd" class="input" | |
| 136 | - placeholder="请输入瞳距,单位cm" maxlength="20" :value="pd" /> | |
| 137 | - </view> | |
| 138 | - </view> | |
| 139 | - <view class="picker" > | |
| 140 | - <view class="picker-choice"> | |
| 141 | - <view class="choice-left"> | |
| 142 | - <text class="p11">{{pickerInfoList[3].nameC}}</text> | |
| 143 | - </view> | |
| 144 | - <text class="p13-date">年 (Y)</text> | |
| 145 | - <picker @change="bindPickerChange41" :value="pickerInfoList[3].nameIndex1" :range="pickerInfoList[3].nameArray1"> | |
| 146 | - <view class="p14" style="width: 30px;"> | |
| 147 | - {{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}} | |
| 148 | - <image src="../../static/detail-tabicon.png" ></image> | |
| 149 | - </view> | |
| 150 | - </picker> | |
| 151 | - <text class="p13-date">月 (M)</text> | |
| 152 | - <picker @change="bindPickerChange42" :value="pickerInfoList[3].nameIndex2" :range="pickerInfoList[3].nameArray2"> | |
| 153 | - <view class="p14" style="width: 30px;"> | |
| 154 | - {{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}} | |
| 155 | - <image src="../../static/detail-tabicon.png" ></image> | |
| 156 | - </view> | |
| 157 | - </picker> | |
| 158 | - <text class="p13-date">日 (D)</text> | |
| 159 | - <picker @change="bindPickerChange43" :value="pickerInfoList[3].nameIndex3" :range="pickerInfoList[3].nameArray3"> | |
| 160 | - <view class="p14" style="width: 30px;"> | |
| 161 | - {{pickerInfoList[3].nameArray3[pickerInfoList[3].nameIndex3]}} | |
| 162 | - <image src="../../static/detail-tabicon.png" ></image> | |
| 163 | - </view> | |
| 164 | - </picker> | |
| 165 | - </view> | |
| 166 | - </view> | |
| 167 | - <view class="confirm"> | |
| 168 | - <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image> | |
| 169 | - <text>确认以上输入信息来源于我的验光数据!</text> | |
| 170 | - </view> | |
| 171 | - </view> | |
| 39 | + <view class="goods-form"> | |
| 40 | + <view class="p1"> | |
| 41 | + <image class="image2" src="../../static/img/myOpticsData/dataWrite.png" mode="aspectFit"></image> | |
| 42 | + 填写验光数据 | |
| 43 | + </view> | |
| 44 | + <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text> | |
| 45 | + <view class="picker"> | |
| 46 | + <view class="picker-choice"> | |
| 47 | + <view class="choice-left"> | |
| 48 | + <text class="pd">验光单取名:</text> | |
| 49 | + </view> | |
| 50 | + <input type="text" @blur="handleInput" class="input" | |
| 51 | + placeholder="请输入名称" maxlength="20" :value="name" /> | |
| 52 | + </view> | |
| 53 | + </view> | |
| 54 | + <view class="picker" > | |
| 55 | + <view class="picker-choice"> | |
| 56 | + <view class="choice-left"> | |
| 57 | + <text class="p11">{{pickerInfoList[0].nameC}}</text> | |
| 58 | + <text class="p12">{{pickerInfoList[0].nameE}}</text> | |
| 59 | + </view> | |
| 60 | + <text class="p13">左 (OD)</text> | |
| 61 | + <!-- <text class="p14">{{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}</text> --> | |
| 62 | + <picker @change="bindPickerChange01" :value="pickerInfoList[0].nameIndex1" :range="pickerInfoList[0].nameArray1"> | |
| 63 | + <view class="p14"> | |
| 64 | + {{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}} | |
| 65 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 66 | + </view> | |
| 67 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 68 | + </picker> | |
| 69 | + <text class="p13">右 (OS)</text> | |
| 70 | + <!-- <text class="p14">{{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}</text> --> | |
| 71 | + <picker @change="bindPickerChange02" :value="pickerInfoList[0].nameIndex2" :range="pickerInfoList[0].nameArray2"> | |
| 72 | + <view class="p14"> | |
| 73 | + {{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}} | |
| 74 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 75 | + </view> | |
| 76 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 77 | + </picker> | |
| 78 | + </view> | |
| 79 | + </view> | |
| 80 | + <view class="picker" > | |
| 81 | + <view class="picker-choice"> | |
| 82 | + <view class="choice-left"> | |
| 83 | + <text class="p11">{{pickerInfoList[1].nameC}}</text> | |
| 84 | + <text class="p12">{{pickerInfoList[1].nameE}}</text> | |
| 85 | + </view> | |
| 86 | + <text class="p13">左 (OD)</text> | |
| 87 | + <!-- <text class="p14">{{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}</text> --> | |
| 88 | + <picker @change="bindPickerChange11" :value="pickerInfoList[1].nameIndex1" :range="pickerInfoList[1].nameArray1"> | |
| 89 | + <view class="p14"> | |
| 90 | + {{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}} | |
| 91 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 92 | + </view> | |
| 93 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 94 | + </picker> | |
| 95 | + <text class="p13">右 (OS)</text> | |
| 96 | + <!-- <text class="p14">{{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}</text> --> | |
| 97 | + <picker @change="bindPickerChange12" :value="pickerInfoList[1].nameIndex2" :range="pickerInfoList[1].nameArray2"> | |
| 98 | + <view class="p14"> | |
| 99 | + {{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}} | |
| 100 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 101 | + </view> | |
| 102 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 103 | + </picker> | |
| 104 | + </view> | |
| 105 | + </view> | |
| 106 | + <view class="picker" > | |
| 107 | + <view class="picker-choice"> | |
| 108 | + <view class="choice-left"> | |
| 109 | + <text class="p11">{{pickerInfoList[2].nameC}}</text> | |
| 110 | + <text class="p12">{{pickerInfoList[2].nameE}}</text> | |
| 111 | + </view> | |
| 112 | + <text class="p13">左 (OD)</text> | |
| 113 | + <picker @change="bindPickerChange21" :value="pickerInfoList[2].nameIndex1" :range="pickerInfoList[2].nameArray1"> | |
| 114 | + <view class="p14"> | |
| 115 | + {{pickerInfoList[2].nameArray1[pickerInfoList[2].nameIndex1]}} | |
| 116 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 117 | + </view> | |
| 118 | + </picker> | |
| 119 | + <text class="p13">右 (OS)</text> | |
| 120 | + <!-- <text class="p14">{{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}</text> --> | |
| 121 | + <picker @change="bindPickerChange22" :value="pickerInfoList[2].nameIndex2" :range="pickerInfoList[2].nameArray2"> | |
| 122 | + <view class="p14"> | |
| 123 | + {{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}} | |
| 124 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 125 | + </view> | |
| 126 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 127 | + </picker> | |
| 128 | + </view> | |
| 129 | + </view> | |
| 130 | + <view class="picker"> | |
| 131 | + <view class="picker-choice"> | |
| 132 | + <view class="choice-left"> | |
| 133 | + <text class="pd">瞳距:</text> | |
| 134 | + </view> | |
| 135 | + <input type="digit" @change="handleInputPd" class="input" | |
| 136 | + placeholder="请输入瞳距,单位cm" maxlength="20" :value="pd" /> | |
| 137 | + </view> | |
| 138 | + </view> | |
| 139 | + <view class="picker" > | |
| 140 | + <view class="picker-choice"> | |
| 141 | + <view class="choice-left"> | |
| 142 | + <text class="p11">{{pickerInfoList[3].nameC}}</text> | |
| 143 | + </view> | |
| 144 | + <text class="p13-date">年 (Y)</text> | |
| 145 | + <picker @change="bindPickerChange41" :value="pickerInfoList[3].nameIndex1" :range="pickerInfoList[3].nameArray1"> | |
| 146 | + <view class="p14" style="width: 30px;"> | |
| 147 | + {{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}} | |
| 148 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 149 | + </view> | |
| 150 | + </picker> | |
| 151 | + <text class="p13-date">月 (M)</text> | |
| 152 | + <picker @change="bindPickerChange42" :value="pickerInfoList[3].nameIndex2" :range="pickerInfoList[3].nameArray2"> | |
| 153 | + <view class="p14" style="width: 30px;"> | |
| 154 | + {{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}} | |
| 155 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 156 | + </view> | |
| 157 | + </picker> | |
| 158 | + <text class="p13-date">日 (D)</text> | |
| 159 | + <picker @change="bindPickerChange43" :value="pickerInfoList[3].nameIndex3" :range="pickerInfoList[3].nameArray3"> | |
| 160 | + <view class="p14" style="width: 30px;"> | |
| 161 | + {{pickerInfoList[3].nameArray3[pickerInfoList[3].nameIndex3]}} | |
| 162 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 163 | + </view> | |
| 164 | + </picker> | |
| 165 | + </view> | |
| 166 | + </view> | |
| 167 | + <view class="confirm"> | |
| 168 | + <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image> | |
| 169 | + <text>确认以上输入信息来源于我的验光数据!</text> | |
| 170 | + </view> | |
| 171 | + </view> | |
| 172 | 172 | </template> |
| 173 | 173 | <template v-else> |
| 174 | 174 | <view |
| ... | ... | @@ -202,7 +202,7 @@ |
| 202 | 202 | v-for="(item,index) in attrList" |
| 203 | 203 | :key="index" |
| 204 | 204 | > |
| 205 | - <UniCollapse @change="change(index)"> | |
| 205 | + <UniCollapse @change="changeShow(index)"> | |
| 206 | 206 | <UniCollapseItem |
| 207 | 207 | :open="show[index]" |
| 208 | 208 | :title="item.meta_name" |
| ... | ... | @@ -324,7 +324,7 @@ import store from '@/store' |
| 324 | 324 | export default { |
| 325 | 325 | components: { |
| 326 | 326 | UniCollapse, |
| 327 | - UniCollapseItem | |
| 327 | + UniCollapseItem, | |
| 328 | 328 | }, |
| 329 | 329 | data() { |
| 330 | 330 | return { |
| ... | ... | @@ -344,11 +344,9 @@ export default { |
| 344 | 344 | show: [], |
| 345 | 345 | chooseRes1: { |
| 346 | 346 | sku_name: 'Miss 黑二代【减龄自然】', |
| 347 | - sk_id: '128' | |
| 348 | - }, | |
| 349 | - checkedData: { | |
| 350 | - | |
| 347 | + sk_id: '128', | |
| 351 | 348 | }, |
| 349 | + checkedData: {}, | |
| 352 | 350 | chooseRes2: '14.0', |
| 353 | 351 | chooseRes3: 0, |
| 354 | 352 | chooseItem1: [ |
| ... | ... | @@ -366,43 +364,43 @@ export default { |
| 366 | 364 | { style: 'background-image: radial-gradient(50% 148%, #FFFFFF 50%, #324A05 100%);', describ: 'Miss 黑4代【防紫外线】' }, |
| 367 | 365 | { style: 'background-image: radial-gradient(50% 143%, #AEA8A8 45%, #624B3F 100%);', describ: 'Miss 黑5代【防紫外线】' }, |
| 368 | 366 | { style: 'opacity: 0.7;background-image: radial-gradient(50% 150%, #F0EEE7 50%, #6F0838 100%);', describ: 'Miss 黑6代【防紫外线】' }, |
| 369 | - { style: 'background-image: radial-gradient(50% 143%, #AEA8A8 45%, #370B4E 100%);', describ: 'Miss 黑7代【防紫外线】' } | |
| 367 | + { style: 'background-image: radial-gradient(50% 143%, #AEA8A8 45%, #370B4E 100%);', describ: 'Miss 黑7代【防紫外线】' }, | |
| 370 | 368 | ], |
| 371 | 369 | chooseItem2: [ |
| 372 | 370 | { num: '14.0' }, |
| 373 | 371 | { num: '14.2' }, |
| 374 | 372 | { num: '14.4' }, |
| 375 | - { num: '14.5' } | |
| 373 | + { num: '14.5' }, | |
| 376 | 374 | ], |
| 377 | 375 | chooseItem3: [0, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 470, 500, 525, 550, 575, 600, 1000], |
| 378 | 376 | // 度数相关数据 |
| 379 | - pickerInfoList:[ | |
| 380 | - {nameC:"度数",nameE:"(SPH)",nameArray1:[''],nameIndex1:0,nameArray2:[''],nameIndex2:0,key:0}, | |
| 381 | - {nameC:"散光",nameE:"(CYL)",nameArray1:[''],nameIndex1:0,nameArray2:[''],nameIndex2:0,key:1}, | |
| 382 | - {nameC:"散光轴位",nameE:"(AXI)",nameArray1:[''],nameIndex1:0,nameArray2:[''],nameIndex2:0,key:2}, | |
| 383 | - {nameC:"验光日期",nameE:'',nameArray1:[''],nameIndex1:0,nameArray2:['',1,2,3,4,5,6,7,8,9,10,11,12],nameIndex2:0,nameArray3:[''],nameIndex3:0} | |
| 384 | - ], | |
| 385 | - confirm: false, // 用户是否确认 | |
| 386 | - tabicon:['/static/detail-button.png','/static/detail-button-unselected.png'], | |
| 387 | - name: '夏小花', | |
| 388 | - oldname:'',// 用于判读用户是否改变名字 | |
| 389 | - pickerInfoChioce:{ | |
| 390 | - "leftSph": '', | |
| 391 | - "rightSph": '', | |
| 392 | - "leftCyl": '', | |
| 393 | - "rightCyl": '', | |
| 394 | - "leftAxi": '', | |
| 395 | - "rightAxi": '', | |
| 396 | - "time":{ | |
| 397 | - "year":0, | |
| 398 | - "month": 0, | |
| 399 | - "day":0 , | |
| 400 | - } | |
| 401 | - }, | |
| 402 | - pd: '',// 瞳距 | |
| 403 | - oldpd: '',// 用于判断用户是否改变瞳距 | |
| 404 | - kinds:1, // kinds=1,提交为新增验光,2为修改 | |
| 405 | - mp_id: Number | |
| 377 | + pickerInfoList: [ | |
| 378 | + { nameC: '度数', nameE: '(SPH)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 0 }, | |
| 379 | + { nameC: '散光', nameE: '(CYL)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 1 }, | |
| 380 | + { nameC: '散光轴位', nameE: '(AXI)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 2 }, | |
| 381 | + { nameC: '验光日期', nameE: '', nameArray1: [''], nameIndex1: 0, nameArray2: ['', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], nameIndex2: 0, nameArray3: [''], nameIndex3: 0 }, | |
| 382 | + ], | |
| 383 | + confirm: false, // 用户是否确认 | |
| 384 | + tabicon: ['/static/detail-button.png', '/static/detail-button-unselected.png'], | |
| 385 | + name: '夏小花', | |
| 386 | + oldname: '', // 用于判读用户是否改变名字 | |
| 387 | + pickerInfoChioce: { | |
| 388 | + leftSph: '', | |
| 389 | + rightSph: '', | |
| 390 | + leftCyl: '', | |
| 391 | + rightCyl: '', | |
| 392 | + leftAxi: '', | |
| 393 | + rightAxi: '', | |
| 394 | + time: { | |
| 395 | + year: 0, | |
| 396 | + month: 0, | |
| 397 | + day: 0, | |
| 398 | + }, | |
| 399 | + }, | |
| 400 | + pd: '', // 瞳距 | |
| 401 | + oldpd: '', // 用于判断用户是否改变瞳距 | |
| 402 | + kinds: 1, // kinds=1,提交为新增验光,2为修改 | |
| 403 | + mp_id: Number, | |
| 406 | 404 | } |
| 407 | 405 | }, |
| 408 | 406 | computed: { |
| ... | ... | @@ -414,12 +412,12 @@ export default { |
| 414 | 412 | }, |
| 415 | 413 | mpList() { |
| 416 | 414 | return this.$store.state.myLoveList.loveList |
| 417 | - } | |
| 415 | + }, | |
| 418 | 416 | }, |
| 419 | 417 | onLoad({ pid }) { |
| 420 | 418 | this.pid = pid |
| 421 | 419 | store.dispatch('read/fetch', { |
| 422 | - pid | |
| 420 | + pid, | |
| 423 | 421 | }).then(() => { |
| 424 | 422 | const current = [] |
| 425 | 423 | const show = [] |
| ... | ... | @@ -431,149 +429,146 @@ export default { |
| 431 | 429 | this.show = show |
| 432 | 430 | }) |
| 433 | 431 | store.dispatch('myLoveList/getLoveList') |
| 434 | - | |
| 435 | - // 初始化SPL、CYL、AXI的值 | |
| 436 | - for (let j = 0; j < 3; j++) { | |
| 437 | - for(let i=-12;i<6;i++){ | |
| 438 | - this.pickerInfoList[j].nameArray1.push(i) | |
| 439 | - this.pickerInfoList[j].nameArray1.push(i+0.5) | |
| 440 | - this.pickerInfoList[j].nameArray2.push(i) | |
| 441 | - this.pickerInfoList[j].nameArray2.push(i+0.5) | |
| 442 | - if(i>=-6){ | |
| 443 | - this.pickerInfoList[j].nameArray1.push(i+0.25) | |
| 444 | - this.pickerInfoList[j].nameArray1.push(i+0.75) | |
| 445 | - this.pickerInfoList[j].nameArray2.push(i+0.25) | |
| 446 | - this.pickerInfoList[j].nameArray2.push(i+0.75) | |
| 447 | - } | |
| 448 | - if(i==5){ | |
| 449 | - this.pickerInfoList[j].nameArray1.push(i+1) | |
| 450 | - this.pickerInfoList[j].nameArray2.push(i+1) | |
| 451 | - } | |
| 452 | - } | |
| 453 | - } | |
| 454 | - // 初始化日期值 | |
| 455 | - for (let i = 1; i < 32; i++){ | |
| 456 | - this.pickerInfoList[3].nameArray3.push(i) | |
| 457 | - } | |
| 458 | - // 初始化年份前后五年 | |
| 459 | - let myDate = new Date(); | |
| 460 | - let nowYear = myDate.getFullYear(); | |
| 461 | - for(let i=0;i<5;i++){ | |
| 462 | - this.pickerInfoList[3].nameArray1.push(nowYear-i) | |
| 463 | - } | |
| 432 | + | |
| 433 | + // 初始化SPL、CYL、AXI的值 | |
| 434 | + for (let j = 0; j < 3; j++) { | |
| 435 | + for (let i = -12; i < 6; i++) { | |
| 436 | + this.pickerInfoList[j].nameArray1.push(i) | |
| 437 | + this.pickerInfoList[j].nameArray1.push(i + 0.5) | |
| 438 | + this.pickerInfoList[j].nameArray2.push(i) | |
| 439 | + this.pickerInfoList[j].nameArray2.push(i + 0.5) | |
| 440 | + if (i >= -6) { | |
| 441 | + this.pickerInfoList[j].nameArray1.push(i + 0.25) | |
| 442 | + this.pickerInfoList[j].nameArray1.push(i + 0.75) | |
| 443 | + this.pickerInfoList[j].nameArray2.push(i + 0.25) | |
| 444 | + this.pickerInfoList[j].nameArray2.push(i + 0.75) | |
| 445 | + } | |
| 446 | + if (i === 5) { | |
| 447 | + this.pickerInfoList[j].nameArray1.push(i + 1) | |
| 448 | + this.pickerInfoList[j].nameArray2.push(i + 1) | |
| 449 | + } | |
| 450 | + } | |
| 451 | + } | |
| 452 | + // 初始化日期值 | |
| 453 | + for (let i = 1; i < 32; i++) { | |
| 454 | + this.pickerInfoList[3].nameArray3.push(i) | |
| 455 | + } | |
| 456 | + // 初始化年份前后五年 | |
| 457 | + const myDate = new Date() | |
| 458 | + const nowYear = myDate.getFullYear() | |
| 459 | + for (let i = 0; i < 5; i++) { | |
| 460 | + this.pickerInfoList[3].nameArray1.push(nowYear - i) | |
| 461 | + } | |
| 464 | 462 | }, |
| 465 | 463 | methods: { |
| 466 | - // picker相关功能 | |
| 467 | - handleInput(e){ | |
| 468 | - this.name=e.target.value | |
| 469 | - this.isDataName = false | |
| 470 | - console.log('e---->', e) | |
| 471 | - const mpList = this.mpList | |
| 472 | - console.log('mpList===>',mpList) | |
| 473 | - for (let index = 0; index < mpList.length; index++) { | |
| 474 | - if (e.detail.value === mpList[index].name) { | |
| 475 | - this.isDataName = true | |
| 476 | - uni.showModal({ | |
| 477 | - title: '提示', | |
| 478 | - content: `是否填充已有的"${e.detail.value}"的数据`, | |
| 479 | - success: (res) => { | |
| 480 | - if (res.confirm) { | |
| 481 | - this.kinds=2 | |
| 482 | - console.log('args===>',index) | |
| 483 | - // const mpList=Object.assign({},this.$store.state.mympList.mpList) | |
| 484 | - console.log('mpList===>',mpList) | |
| 485 | - this.name=mpList[index].name | |
| 486 | - this.pd=mpList[index].pd | |
| 487 | - this.mp_id=mpList[index].mp_id | |
| 488 | - this.oldname=mpList[index].name | |
| 489 | - this.oldpd=mpList[index].pd | |
| 490 | - // 将kinds =2时的值传到该页面 | |
| 491 | - this.pickerInfoList[0].nameArray1.unshift(mpList[index].leftSph) | |
| 492 | - this.pickerInfoList[0].nameArray2.unshift(mpList[index].rightSph) | |
| 493 | - this.pickerInfoList[1].nameArray1.unshift(mpList[index].leftCyl) | |
| 494 | - this.pickerInfoList[1].nameArray2.unshift(mpList[index].rightCyl) | |
| 495 | - this.pickerInfoList[2].nameArray1.unshift(mpList[index].leftAxi) | |
| 496 | - this.pickerInfoList[2].nameArray2.unshift(mpList[index].rightAxi) | |
| 497 | - | |
| 498 | - this.pickerInfoList[3].nameArray1.unshift(mpList[index].in_time.toString().slice(0,4)) | |
| 499 | - if(mpList[index].in_time.toString().slice(5,6)==0){ | |
| 500 | - this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(6,7)) | |
| 501 | - } else{ | |
| 502 | - this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(5,7)) | |
| 503 | - } | |
| 504 | - if(mpList[index].in_time.toString().slice(8,9)==0){ | |
| 505 | - this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(9,10)) | |
| 506 | - } else{ | |
| 507 | - this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(8,10)) | |
| 508 | - } | |
| 509 | - // this.checkedData = mpList[index] | |
| 510 | - // console.log('checkedData', this.checkedData) | |
| 511 | - } else if(res.cancel){ | |
| 512 | - this.kinds=2 | |
| 513 | - } | |
| 514 | - } | |
| 515 | - }) | |
| 516 | - } | |
| 517 | - } | |
| 518 | - }, | |
| 519 | - handleInputPd(e){ | |
| 520 | - // 只能输入正浮点数或正数 | |
| 521 | - if(/^\d+(\.\d+)?$/.test(e.target.value)){ | |
| 522 | - this.pd=e.target.value | |
| 523 | - } else { | |
| 524 | - uni.showToast({ | |
| 525 | - title:"请输入有效数据;示例:89", | |
| 526 | - icon: "none", | |
| 527 | - duration: 2000, | |
| 528 | - }) | |
| 529 | - this.pd = '' | |
| 530 | - } | |
| 531 | - | |
| 532 | - }, | |
| 464 | + // picker相关功能 | |
| 465 | + handleInput(e) { | |
| 466 | + this.name = e.target.value | |
| 467 | + this.isDataName = false | |
| 468 | + console.log('e---->', e) | |
| 469 | + const mpList = this.mpList | |
| 470 | + console.log('mpList===>', mpList) | |
| 471 | + for (let index = 0; index < mpList.length; index++) { | |
| 472 | + if (e.detail.value === mpList[index].name) { | |
| 473 | + this.isDataName = true | |
| 474 | + uni.showModal({ | |
| 475 | + title: '提示', | |
| 476 | + content: `是否填充已有的"${e.detail.value}"的数据`, | |
| 477 | + success: (res) => { | |
| 478 | + if (res.confirm) { | |
| 479 | + this.kinds = 2 | |
| 480 | + console.log('args===>', index) | |
| 481 | + // const mpList=Object.assign({},this.$store.state.mympList.mpList) | |
| 482 | + console.log('mpList===>', mpList) | |
| 483 | + this.name = mpList[index].name | |
| 484 | + this.pd = mpList[index].pd | |
| 485 | + this.mp_id = mpList[index].mp_id | |
| 486 | + this.oldname = mpList[index].name | |
| 487 | + this.oldpd = mpList[index].pd | |
| 488 | + // 将kinds =2时的值传到该页面 | |
| 489 | + this.pickerInfoList[0].nameArray1.unshift(mpList[index].leftSph) | |
| 490 | + this.pickerInfoList[0].nameArray2.unshift(mpList[index].rightSph) | |
| 491 | + this.pickerInfoList[1].nameArray1.unshift(mpList[index].leftCyl) | |
| 492 | + this.pickerInfoList[1].nameArray2.unshift(mpList[index].rightCyl) | |
| 493 | + this.pickerInfoList[2].nameArray1.unshift(mpList[index].leftAxi) | |
| 494 | + this.pickerInfoList[2].nameArray2.unshift(mpList[index].rightAxi) | |
| 495 | + this.pickerInfoList[3].nameArray1.unshift(mpList[index].in_time.toString().slice(0, 4)) | |
| 496 | + if (mpList[index].in_time.toString().slice(5, 6) === 0) { | |
| 497 | + this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(6, 7)) | |
| 498 | + } else { | |
| 499 | + this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(5, 7)) | |
| 500 | + } | |
| 501 | + if (mpList[index].in_time.toString().slice(8, 9) === 0) { | |
| 502 | + this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(9, 10)) | |
| 503 | + } else { | |
| 504 | + this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(8, 10)) | |
| 505 | + } | |
| 506 | + // this.checkedData = mpList[index] | |
| 507 | + // console.log('checkedData', this.checkedData) | |
| 508 | + } else if (res.cancel) { | |
| 509 | + this.kinds = 2 | |
| 510 | + } | |
| 511 | + }, | |
| 512 | + }) | |
| 513 | + } | |
| 514 | + } | |
| 515 | + }, | |
| 516 | + handleInputPd(e) { | |
| 517 | + // 只能输入正浮点数或正数 | |
| 518 | + if (/^\d+(\.\d+)?$/.test(e.target.value)) { | |
| 519 | + this.pd = e.target.value | |
| 520 | + } else { | |
| 521 | + uni.showToast({ | |
| 522 | + title: '请输入有效数据;示例:89', | |
| 523 | + icon: 'none', | |
| 524 | + duration: 2000, | |
| 525 | + }) | |
| 526 | + this.pd = '' | |
| 527 | + } | |
| 528 | + }, | |
| 533 | 529 | changeConfirm() { |
| 534 | - this.confirm = !this.confirm | |
| 530 | + this.confirm = !this.confirm | |
| 531 | + }, | |
| 532 | + bindPickerChange01: function(e) { | |
| 533 | + this.pickerInfoList[0].nameIndex1 = e.target.value | |
| 534 | + this.pickerInfoChioce.leftSph = this.pickerInfoList[0].nameArray1[e.target.value] | |
| 535 | + }, | |
| 536 | + bindPickerChange02: function(e) { | |
| 537 | + this.pickerInfoList[0].nameIndex2 = e.target.value | |
| 538 | + this.pickerInfoChioce.rightSph = this.pickerInfoList[0].nameArray2[e.target.value] | |
| 539 | + }, | |
| 540 | + | |
| 541 | + bindPickerChange11: function(e) { | |
| 542 | + this.pickerInfoList[1].nameIndex1 = e.target.value | |
| 543 | + this.pickerInfoChioce.leftCyl = this.pickerInfoList[1].nameArray1[e.target.value] | |
| 544 | + }, | |
| 545 | + bindPickerChange12: function(e) { | |
| 546 | + this.pickerInfoList[1].nameIndex2 = e.target.value | |
| 547 | + this.pickerInfoChioce.rightCyl = this.pickerInfoList[1].nameArray2[e.target.value] | |
| 548 | + }, | |
| 549 | + | |
| 550 | + bindPickerChange21: function(e) { | |
| 551 | + this.pickerInfoList[2].nameIndex1 = e.target.value | |
| 552 | + this.pickerInfoChioce.leftAxi = this.pickerInfoList[2].nameArray1[e.target.value] | |
| 553 | + }, | |
| 554 | + bindPickerChange22: function(e) { | |
| 555 | + this.pickerInfoList[2].nameIndex2 = e.target.value | |
| 556 | + this.pickerInfoChioce.rightAxi = this.pickerInfoList[2].nameArray2[e.target.value] | |
| 557 | + }, | |
| 558 | + | |
| 559 | + bindPickerChange41: function(e) { | |
| 560 | + this.pickerInfoList[3].nameIndex1 = e.target.value | |
| 561 | + this.pickerInfoChioce.time.year = this.pickerInfoList[3].nameArray1[e.target.value] | |
| 535 | 562 | }, |
| 536 | - bindPickerChange01: function(e) { | |
| 537 | - this.pickerInfoList[0].nameIndex1 = e.target.value | |
| 538 | - this.pickerInfoChioce.leftSph=this.pickerInfoList[0].nameArray1[e.target.value] | |
| 539 | - }, | |
| 540 | - bindPickerChange02: function(e) { | |
| 541 | - this.pickerInfoList[0].nameIndex2 = e.target.value | |
| 542 | - this.pickerInfoChioce.rightSph=this.pickerInfoList[0].nameArray2[e.target.value] | |
| 543 | - }, | |
| 544 | - | |
| 545 | - bindPickerChange11: function(e) { | |
| 546 | - this.pickerInfoList[1].nameIndex1 = e.target.value | |
| 547 | - this.pickerInfoChioce.leftCyl=this.pickerInfoList[1].nameArray1[e.target.value] | |
| 548 | - }, | |
| 549 | - bindPickerChange12: function(e) { | |
| 550 | - this.pickerInfoList[1].nameIndex2 = e.target.value | |
| 551 | - this.pickerInfoChioce.rightCyl=this.pickerInfoList[1].nameArray2[e.target.value] | |
| 552 | - }, | |
| 553 | - | |
| 554 | - bindPickerChange21: function(e) { | |
| 555 | - this.pickerInfoList[2].nameIndex1 = e.target.value | |
| 556 | - this.pickerInfoChioce.leftAxi=this.pickerInfoList[2].nameArray1[e.target.value] | |
| 557 | - }, | |
| 558 | - bindPickerChange22: function(e) { | |
| 559 | - this.pickerInfoList[2].nameIndex2 = e.target.value | |
| 560 | - this.pickerInfoChioce.rightAxi=this.pickerInfoList[2].nameArray2[e.target.value] | |
| 561 | - }, | |
| 562 | - | |
| 563 | - bindPickerChange41: function(e) { | |
| 564 | - this.pickerInfoList[3].nameIndex1 = e.target.value | |
| 565 | - this.pickerInfoChioce.time.year=this.pickerInfoList[3].nameArray1[e.target.value] | |
| 566 | - }, | |
| 567 | - bindPickerChange42: function(e) { | |
| 568 | - this.pickerInfoList[3].nameIndex2 = e.target.value | |
| 569 | - this.pickerInfoChioce.time.month=this.pickerInfoList[3].nameArray2[e.target.value] | |
| 570 | - }, | |
| 571 | - bindPickerChange43: function(e) { | |
| 572 | - this.pickerInfoList[3].nameIndex3 = e.target.value | |
| 573 | - this.pickerInfoChioce.time.day=this.pickerInfoList[3].nameArray3[e.target.value] | |
| 574 | - }, | |
| 575 | - | |
| 576 | - change(num) { | |
| 563 | + bindPickerChange42: function(e) { | |
| 564 | + this.pickerInfoList[3].nameIndex2 = e.target.value | |
| 565 | + this.pickerInfoChioce.time.month = this.pickerInfoList[3].nameArray2[e.target.value] | |
| 566 | + }, | |
| 567 | + bindPickerChange43: function(e) { | |
| 568 | + this.pickerInfoList[3].nameIndex3 = e.target.value | |
| 569 | + this.pickerInfoChioce.time.day = this.pickerInfoList[3].nameArray3[e.target.value] | |
| 570 | + }, | |
| 571 | + changeShow(num) { | |
| 577 | 572 | this.show[num] = !this.show[num] |
| 578 | 573 | this.$forceUpdate() |
| 579 | 574 | }, |
| ... | ... | @@ -583,24 +578,24 @@ export default { |
| 583 | 578 | } |
| 584 | 579 | this.$forceUpdate() |
| 585 | 580 | }, |
| 586 | - onClickItem1(index) { | |
| 587 | - if (this.current1 !== index) { | |
| 588 | - this.current1 = index | |
| 589 | - this.chooseRes1 = this.chooseItem1[index].describ | |
| 590 | - } | |
| 591 | - }, | |
| 592 | - onClickItem2(index) { | |
| 593 | - if (this.current2 !== index) { | |
| 594 | - this.current2 = index | |
| 595 | - this.chooseRes2 = this.chooseItem2[index].num | |
| 596 | - } | |
| 597 | - }, | |
| 598 | - onClickItem3(index) { | |
| 599 | - if (this.current3 !== index) { | |
| 600 | - this.current3 = index | |
| 601 | - this.chooseRes3 = this.chooseItem3[index] | |
| 602 | - } | |
| 603 | - }, | |
| 581 | + // onClickItem1(index) { | |
| 582 | + // if (this.current1 !== index) { | |
| 583 | + // this.current1 = index | |
| 584 | + // this.chooseRes1 = this.chooseItem1[index].describ | |
| 585 | + // } | |
| 586 | + // }, | |
| 587 | + // onClickItem2(index) { | |
| 588 | + // if (this.current2 !== index) { | |
| 589 | + // this.current2 = index | |
| 590 | + // this.chooseRes2 = this.chooseItem2[index].num | |
| 591 | + // } | |
| 592 | + // }, | |
| 593 | + // onClickItem3(index) { | |
| 594 | + // if (this.current3 !== index) { | |
| 595 | + // this.current3 = index | |
| 596 | + // this.chooseRes3 = this.chooseItem3[index] | |
| 597 | + // } | |
| 598 | + // }, | |
| 604 | 599 | counter(isadd) { |
| 605 | 600 | if (isadd) { |
| 606 | 601 | this.count >= this.maxCount ? this.addDisabled = true : this.count++ |
| ... | ... | @@ -609,179 +604,174 @@ export default { |
| 609 | 604 | } |
| 610 | 605 | }, |
| 611 | 606 | toComfirmOrder() { |
| 612 | - // 先处理验光部分的逻辑,如果ok在跳转 | |
| 613 | - let flag=0; | |
| 614 | - if(this.name==''){ | |
| 615 | - uni.showToast({ | |
| 616 | - title:"请输入验光单取名", | |
| 617 | - icon: "none", | |
| 618 | - duration: 2000, | |
| 619 | - }) | |
| 620 | - }else{ | |
| 621 | - | |
| 622 | - if(this.pd==''){ | |
| 623 | - uni.showToast({ | |
| 624 | - title:"请输入瞳距", | |
| 625 | - icon: "none", | |
| 626 | - duration: 2000, | |
| 627 | - }) | |
| 628 | - }else{ | |
| 629 | - | |
| 630 | - if(this.kinds==1){ | |
| 631 | - // 添加用户验光单 | |
| 632 | - console.log('kinds====>',this.pickerInfoChioce.leftSph) | |
| 633 | - console.log('kinds====>',this.pickerInfoChioce.leftSph==Number) | |
| 634 | - console.log('kinds====>',this.pickerInfoChioce.rightSph==Number) | |
| 635 | - if(this.pickerInfoChioce.rightSph==''||this.pickerInfoChioce.leftSph==''|| | |
| 636 | - this.pickerInfoChioce.leftCyl==''||this.pickerInfoChioce.rightCyl==''|| | |
| 637 | - this.pickerInfoChioce.leftAxi==''||this.pickerInfoChioce.rightAxi=='' | |
| 638 | - ){ | |
| 639 | - uni.showToast({ | |
| 640 | - title:"请输入您的验光数据", | |
| 641 | - icon: "none", | |
| 642 | - duration: 2000, | |
| 643 | - }) | |
| 644 | - }else{ | |
| 645 | - if(this.confirm){ | |
| 646 | - store.dispatch('myLoveList/addMylove', { | |
| 647 | - uid: this.$store.state.user.userInfo.uid, | |
| 648 | - openid: this.$store.state.user.userInfo.openid, | |
| 649 | - // mp_name: this.$store.state.user.userInfo.mp_name, | |
| 650 | - leftSph: this.pickerInfoChioce.leftSph, | |
| 651 | - rightSph: this.pickerInfoChioce.rightSph, | |
| 652 | - leftCyl: this.pickerInfoChioce.leftCyl, | |
| 653 | - rightCyl: this.pickerInfoChioce.rightCyl, | |
| 654 | - leftAxi: this.pickerInfoChioce.leftAxi, | |
| 655 | - rightAxi: this.pickerInfoChioce.rightAxi, | |
| 656 | - pd: this.pd,// 瞳距 | |
| 657 | - mp_name:this.name, | |
| 658 | - // time: this.pickerInfoChioce.time, | |
| 659 | - // img_url2: "http://localhost:8087/images/shop_1/1/", | |
| 660 | - }); | |
| 661 | - flag=1 | |
| 662 | - } else{ | |
| 663 | - uni.showToast({ | |
| 664 | - title:"请确认您的验光数据", | |
| 665 | - icon: "none", | |
| 666 | - duration: 3000, | |
| 667 | - }) | |
| 668 | - } | |
| 669 | - } | |
| 670 | - } | |
| 671 | - if(this.kinds==2){ | |
| 672 | - // console.log('kinds====>',this.kinds) | |
| 673 | - // console.log('pickerindex=====>',this.pickerInfoList[0].nameIndex1) | |
| 674 | - // console.log('this.pickerInfoChioce====>',type(this.pickerInfoChioce)) | |
| 675 | - if(this.confirm){ | |
| 676 | - const leftList = ["leftSph","leftCyl","leftAxi"]; | |
| 677 | - const rightList = ["rightSph", "rightCyl", "rightAxi"]; | |
| 678 | - // let flag=0; | |
| 679 | - if(this.name!=this.oldname){ | |
| 680 | - store.dispatch('myLoveList/updateMylove', { | |
| 681 | - uid: this.$store.state.user.userInfo.uid, | |
| 682 | - openid: this.$store.state.user.userInfo.openid, | |
| 683 | - mp_id: this.mp_id, | |
| 684 | - keyname: 'name', | |
| 685 | - keyvalue: this.name, | |
| 686 | - }); | |
| 687 | - flag=1 | |
| 688 | - } | |
| 689 | - if(this.pd!=this.oldpd){ | |
| 690 | - store.dispatch('myLoveList/updateMylove', { | |
| 691 | - uid: this.$store.state.user.userInfo.uid, | |
| 692 | - openid: this.$store.state.user.userInfo.openid, | |
| 693 | - mp_id: this.mp_id, | |
| 694 | - keyname: 'pd', | |
| 695 | - keyvalue: this.pd, | |
| 696 | - }); | |
| 697 | - flag=1 | |
| 698 | - } | |
| 699 | - // 先验证是否输入有无空 | |
| 700 | - let q= true; | |
| 701 | - for(let k=0; k<3;k++){ | |
| 702 | - q=q&&(this.pickerInfoList[k].nameArray1[this.pickerInfoList[k].nameIndex1]!=''&& | |
| 703 | - this.pickerInfoList[k].nameArray2[this.pickerInfoList[k].nameIndex2]!='') | |
| 704 | - } | |
| 705 | - if(q){ | |
| 706 | - | |
| 707 | - for (let j=0; j<3; j++) { | |
| 708 | - if(this.pickerInfoList[j].nameIndex1!=0){ | |
| 709 | - store.dispatch('myLoveList/updateMylove', { | |
| 710 | - uid: this.$store.state.user.userInfo.uid, | |
| 711 | - openid: this.$store.state.user.userInfo.openid, | |
| 712 | - mp_id: this.mp_id, | |
| 713 | - keyname: leftList[j], | |
| 714 | - keyvalue: this.pickerInfoList[j].nameArray1[this.pickerInfoList[j].nameIndex1], | |
| 715 | - }); | |
| 716 | - } | |
| 717 | - if(this.pickerInfoList[j].nameIndex2!=0){ | |
| 718 | - store.dispatch('myLoveList/updateMylove', { | |
| 719 | - uid: this.$store.state.user.userInfo.uid, | |
| 720 | - openid: this.$store.state.user.userInfo.openid, | |
| 721 | - mp_id: this.mp_id, | |
| 722 | - keyname: rightList[j], | |
| 723 | - keyvalue: this.pickerInfoList[j].nameArray2[this.pickerInfoList[j].nameIndex2] | |
| 724 | - }); | |
| 725 | - } | |
| 726 | - flag=1; | |
| 727 | - } | |
| 728 | - }else{ | |
| 729 | - flag=0; | |
| 730 | - uni.showToast({ | |
| 731 | - title:"请输入您的验光数据", | |
| 732 | - icon: "none", | |
| 733 | - duration: 2000, | |
| 734 | - }) | |
| 735 | - | |
| 736 | - } | |
| 737 | - if(flag!=0){ | |
| 738 | - store.dispatch('myLoveList/getLoveList', { | |
| 739 | - uid: this.$store.state.user.userInfo.uid, | |
| 740 | - }); | |
| 741 | - } | |
| 742 | - | |
| 743 | - } else{ | |
| 744 | - uni.showToast({ | |
| 745 | - title:"请确认您的验光数据", | |
| 746 | - icon: "none", | |
| 747 | - duration: 3000, | |
| 748 | - }) | |
| 749 | - } | |
| 750 | - } | |
| 751 | - } | |
| 752 | - | |
| 753 | - } | |
| 754 | - if(flag!=0){ | |
| 755 | - // 如果数据验证无误,那么更新验光单的数据 | |
| 756 | - store.dispatch('myLoveList/getLoveList', { | |
| 757 | - uid: this.$store.state.user.userInfo.uid, | |
| 758 | - }); | |
| 759 | - let i = 0 | |
| 760 | - // 判断出是哪一个sku被选中 | |
| 761 | - for (let index = 0; index < this.current.length; index++) { | |
| 762 | - console.log('index', index, i, index !== this.current.length - 1) | |
| 763 | - if (index !== this.current.length - 1) { | |
| 764 | - console.log('----', this.current[index], this.attrList[1].attr.length, this.attrList) | |
| 765 | - i = this.current[index] * this.attrList[1].attr.length | |
| 766 | - } else { | |
| 767 | - i += this.current[index] | |
| 768 | - } | |
| 769 | - console.log('i', i) | |
| 770 | - } | |
| 771 | - console.log('i------>', i) | |
| 772 | - // 判断是否其输入的人员数据是否已存在 | |
| 773 | - store.dispatch('order/saveParams', { | |
| 774 | - sk_id_arr: this.skuList[i], | |
| 775 | - current: this.current | |
| 776 | - }) | |
| 777 | - | |
| 778 | - uni.navigateTo({ | |
| 779 | - url: `../confirmOrder/confirmOrder?pid=${this.pid}` | |
| 780 | - }) | |
| 781 | - } | |
| 782 | - | |
| 783 | - } | |
| 784 | - } | |
| 607 | + // 先处理验光部分的逻辑,如果ok在跳转 | |
| 608 | + let flag = 0 | |
| 609 | + if (this.name === '') { | |
| 610 | + uni.showToast({ | |
| 611 | + title: '请输入验光单取名', | |
| 612 | + icon: 'none', | |
| 613 | + duration: 2000, | |
| 614 | + }) | |
| 615 | + } else { | |
| 616 | + if (this.pd === '') { | |
| 617 | + uni.showToast({ | |
| 618 | + title: '请输入瞳距', | |
| 619 | + icon: 'none', | |
| 620 | + duration: 2000, | |
| 621 | + }) | |
| 622 | + } else { | |
| 623 | + if (this.kinds === 1) { | |
| 624 | + // 添加用户验光单 | |
| 625 | + console.log('kinds====>', this.pickerInfoChioce.leftSph) | |
| 626 | + console.log('kinds====>', this.pickerInfoChioce.leftSph === Number) | |
| 627 | + console.log('kinds====>', this.pickerInfoChioce.rightSph === Number) | |
| 628 | + if (this.pickerInfoChioce.rightSph === '' || this.pickerInfoChioce.leftSph === '' || | |
| 629 | + this.pickerInfoChioce.leftCyl === '' || this.pickerInfoChioce.rightCyl === '' || | |
| 630 | + this.pickerInfoChioce.leftAxi === '' || this.pickerInfoChioce.rightAxi === '' | |
| 631 | + ) { | |
| 632 | + uni.showToast({ | |
| 633 | + title: '请输入您的验光数据', | |
| 634 | + icon: 'none', | |
| 635 | + duration: 2000, | |
| 636 | + }) | |
| 637 | + } else { | |
| 638 | + if (this.confirm) { | |
| 639 | + store.dispatch('myLoveList/addMylove', { | |
| 640 | + uid: this.$store.state.user.userInfo.uid, | |
| 641 | + openid: this.$store.state.user.userInfo.openid, | |
| 642 | + // mp_name: this.$store.state.user.userInfo.mp_name, | |
| 643 | + leftSph: this.pickerInfoChioce.leftSph, | |
| 644 | + rightSph: this.pickerInfoChioce.rightSph, | |
| 645 | + leftCyl: this.pickerInfoChioce.leftCyl, | |
| 646 | + rightCyl: this.pickerInfoChioce.rightCyl, | |
| 647 | + leftAxi: this.pickerInfoChioce.leftAxi, | |
| 648 | + rightAxi: this.pickerInfoChioce.rightAxi, | |
| 649 | + pd: this.pd, // 瞳距 | |
| 650 | + mp_name: this.name, | |
| 651 | + // time: this.pickerInfoChioce.time, | |
| 652 | + // img_url2: "http://localhost:8087/images/shop_1/1/", | |
| 653 | + }).then(({ mp_id: mpId }) => { | |
| 654 | + this.mp_id = mpId | |
| 655 | + }) | |
| 656 | + flag = 1 | |
| 657 | + } else { | |
| 658 | + uni.showToast({ | |
| 659 | + title: '请确认您的验光数据', | |
| 660 | + icon: 'none', | |
| 661 | + duration: 3000, | |
| 662 | + }) | |
| 663 | + } | |
| 664 | + } | |
| 665 | + } | |
| 666 | + if (this.kinds === 2) { | |
| 667 | + // console.log('kinds====>',this.kinds) | |
| 668 | + // console.log('pickerindex=====>',this.pickerInfoList[0].nameIndex1) | |
| 669 | + // console.log('this.pickerInfoChioce====>',type(this.pickerInfoChioce)) | |
| 670 | + if (this.confirm) { | |
| 671 | + const leftList = ['leftSph', 'leftCyl', 'leftAxi'] | |
| 672 | + const rightList = ['rightSph', 'rightCyl', 'rightAxi'] | |
| 673 | + // let flag=0; | |
| 674 | + if (this.name !== this.oldname) { | |
| 675 | + store.dispatch('myLoveList/updateMylove', { | |
| 676 | + uid: this.$store.state.user.userInfo.uid, | |
| 677 | + openid: this.$store.state.user.userInfo.openid, | |
| 678 | + mp_id: this.mp_id, | |
| 679 | + keyname: 'name', | |
| 680 | + keyvalue: this.name, | |
| 681 | + }) | |
| 682 | + flag = 1 | |
| 683 | + } | |
| 684 | + if (this.pd !== this.oldpd) { | |
| 685 | + store.dispatch('myLoveList/updateMylove', { | |
| 686 | + uid: this.$store.state.user.userInfo.uid, | |
| 687 | + openid: this.$store.state.user.userInfo.openid, | |
| 688 | + mp_id: this.mp_id, | |
| 689 | + keyname: 'pd', | |
| 690 | + keyvalue: this.pd, | |
| 691 | + }) | |
| 692 | + flag = 1 | |
| 693 | + } | |
| 694 | + // 先验证是否输入有无空 | |
| 695 | + let q = true | |
| 696 | + for (let k = 0; k < 3; k++) { | |
| 697 | + q = q && (this.pickerInfoList[k].nameArray1[this.pickerInfoList[k].nameIndex1] !== '' && | |
| 698 | + this.pickerInfoList[k].nameArray2[this.pickerInfoList[k].nameIndex2] !== '') | |
| 699 | + } | |
| 700 | + if (q) { | |
| 701 | + for (let j = 0; j < 3; j++) { | |
| 702 | + if (this.pickerInfoList[j].nameIndex1 !== 0) { | |
| 703 | + store.dispatch('myLoveList/updateMylove', { | |
| 704 | + uid: this.$store.state.user.userInfo.uid, | |
| 705 | + openid: this.$store.state.user.userInfo.openid, | |
| 706 | + mp_id: this.mp_id, | |
| 707 | + keyname: leftList[j], | |
| 708 | + keyvalue: this.pickerInfoList[j].nameArray1[this.pickerInfoList[j].nameIndex1], | |
| 709 | + }) | |
| 710 | + } | |
| 711 | + if (this.pickerInfoList[j].nameIndex2 !== 0) { | |
| 712 | + store.dispatch('myLoveList/updateMylove', { | |
| 713 | + uid: this.$store.state.user.userInfo.uid, | |
| 714 | + openid: this.$store.state.user.userInfo.openid, | |
| 715 | + mp_id: this.mp_id, | |
| 716 | + keyname: rightList[j], | |
| 717 | + keyvalue: this.pickerInfoList[j].nameArray2[this.pickerInfoList[j].nameIndex2], | |
| 718 | + }) | |
| 719 | + } | |
| 720 | + flag = 1 | |
| 721 | + } | |
| 722 | + } else { | |
| 723 | + flag = 0 | |
| 724 | + uni.showToast({ | |
| 725 | + title: '请输入您的验光数据', | |
| 726 | + icon: 'none', | |
| 727 | + duration: 2000, | |
| 728 | + }) | |
| 729 | + } | |
| 730 | + if (flag !== 0) { | |
| 731 | + store.dispatch('myLoveList/getLoveList', { | |
| 732 | + uid: this.$store.state.user.userInfo.uid, | |
| 733 | + }) | |
| 734 | + } | |
| 735 | + } else { | |
| 736 | + uni.showToast({ | |
| 737 | + title: '请确认您的验光数据', | |
| 738 | + icon: 'none', | |
| 739 | + duration: 3000, | |
| 740 | + }) | |
| 741 | + } | |
| 742 | + } | |
| 743 | + } | |
| 744 | + } | |
| 745 | + if (flag !== 0) { | |
| 746 | + // 如果数据验证无误,那么更新验光单的数据 | |
| 747 | + store.dispatch('myLoveList/getLoveList', { | |
| 748 | + uid: this.$store.state.user.userInfo.uid, | |
| 749 | + }) | |
| 750 | + let i = 0 | |
| 751 | + // 判断出是哪一个sku被选中 | |
| 752 | + for (let index = 0; index < this.current.length; index++) { | |
| 753 | + console.log('index', index, i, index !== this.current.length - 1) | |
| 754 | + if (index !== this.current.length - 1) { | |
| 755 | + // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应 | |
| 756 | + i = this.current[index] * this.attrList[1].attr.length | |
| 757 | + } else { | |
| 758 | + i += this.current[index] | |
| 759 | + } | |
| 760 | + } | |
| 761 | + // 判断是否其输入的人员数据是否已存在 | |
| 762 | + store.dispatch('order/saveParams', { | |
| 763 | + sk_id_arr: this.skuList[i], | |
| 764 | + current: this.current, | |
| 765 | + mp_id: this.mp_id, | |
| 766 | + attrList: this.attrList, | |
| 767 | + }) | |
| 768 | + // 跳转到确认订单页面 | |
| 769 | + uni.navigateTo({ | |
| 770 | + url: `../confirmOrder/confirmOrder?pid=${this.pid}`, | |
| 771 | + }) | |
| 772 | + } | |
| 773 | + }, | |
| 774 | + }, | |
| 785 | 775 | } |
| 786 | 776 | </script> |
| 787 | 777 | |
| ... | ... | @@ -927,7 +917,7 @@ export default { |
| 927 | 917 | } |
| 928 | 918 | } |
| 929 | 919 | } |
| 930 | - | |
| 920 | + | |
| 931 | 921 | // .goods-form { |
| 932 | 922 | // display: flex; |
| 933 | 923 | // flex-direction: column; |
| ... | ... | @@ -1020,130 +1010,128 @@ export default { |
| 1020 | 1010 | // } |
| 1021 | 1011 | // } |
| 1022 | 1012 | // } |
| 1023 | - .goods-form { | |
| 1024 | - display: flex; | |
| 1025 | - flex-direction: column; | |
| 1026 | - align-items: center; | |
| 1027 | - justify-content: center; | |
| 1028 | - background-color: #fff; | |
| 1029 | - width: 100%; | |
| 1030 | - padding: 40rpx 0; | |
| 1031 | - .p1 { | |
| 1032 | - font-size: 16px; | |
| 1033 | - color: #333333; | |
| 1034 | - letter-spacing: -0.3px; | |
| 1035 | - text-align: justify; | |
| 1036 | - line-height: 24px; | |
| 1037 | - margin: 4px 0; | |
| 1038 | - | |
| 1039 | - } | |
| 1040 | - .p2 { | |
| 1041 | - font-size: 12px; | |
| 1042 | - color: #999999; | |
| 1043 | - letter-spacing: -0.23px; | |
| 1044 | - margin-bottom: 32rpx; | |
| 1045 | - } | |
| 1046 | - .image2{ | |
| 1047 | - width: 42rpx; | |
| 1048 | - height: 34rpx; | |
| 1049 | - margin-right: 12rpx; | |
| 1050 | - } | |
| 1051 | - .confirm { | |
| 1052 | - display: flex; | |
| 1053 | - align-items: center; | |
| 1054 | - font-size: 12px; | |
| 1055 | - color: #666666; | |
| 1056 | - letter-spacing: -0.23px; | |
| 1057 | - width: 684rpx; | |
| 1058 | - .image1{ | |
| 1059 | - margin-right:25rpx; | |
| 1060 | - width: 42rpx; | |
| 1061 | - height: 38rpx; | |
| 1062 | - } | |
| 1063 | - } | |
| 1064 | - .picker{ | |
| 1065 | - display: flex; | |
| 1066 | - flex-direction: column; | |
| 1067 | - justify-content: center; | |
| 1068 | - align-items: center; | |
| 1069 | - width: 100%; | |
| 1070 | - | |
| 1071 | - .picker-choice{ | |
| 1072 | - display: flex; | |
| 1073 | - width: 684rpx; | |
| 1074 | - align-items: center; | |
| 1075 | - margin-bottom: 40rpx; | |
| 1076 | - .input{ | |
| 1077 | - border-bottom: 1px solid #CFCFCF; | |
| 1078 | - height: 40rpx; | |
| 1079 | - } | |
| 1080 | - .choice-left{ | |
| 1081 | - width: 210rpx; | |
| 1082 | - .pd{ | |
| 1083 | - font-size: 14px; | |
| 1084 | - color: #333333; | |
| 1085 | - letter-spacing: -0.26px; | |
| 1086 | - text-align: justify; | |
| 1087 | - line-height: 24px; | |
| 1088 | - margin-right: 44rpx; | |
| 1089 | - } | |
| 1090 | - .p11 { | |
| 1091 | - font-size: 14px; | |
| 1092 | - color: #333333; | |
| 1093 | - letter-spacing: -0.26px; | |
| 1094 | - text-align: justify; | |
| 1095 | - line-height: 24px; | |
| 1096 | - // margin-right: 10px; | |
| 1097 | - } | |
| 1098 | - .p12 { | |
| 1099 | - font-size: 10px; | |
| 1100 | - color: #3F3F3F; | |
| 1101 | - letter-spacing: -0.19px; | |
| 1102 | - text-align: justify; | |
| 1103 | - line-height: 24px; | |
| 1104 | - } | |
| 1105 | - | |
| 1106 | - | |
| 1107 | - } | |
| 1108 | - .p13 { | |
| 1109 | - font-size: 10px; | |
| 1110 | - color: #999999; | |
| 1111 | - letter-spacing: -0.19px; | |
| 1112 | - margin-right: 10px; | |
| 1113 | - } | |
| 1114 | - .p13-date { | |
| 1115 | - font-size: 10px; | |
| 1116 | - color: #999999; | |
| 1117 | - letter-spacing: -0.19px; | |
| 1118 | - margin-right: 5px; | |
| 1119 | - } | |
| 1120 | - picker{ | |
| 1121 | - width: 144rpx; | |
| 1122 | - height: 40rpx; | |
| 1123 | - display: flex; | |
| 1124 | - position: relative; | |
| 1125 | - .p14 { | |
| 1126 | - font-size: 14px; | |
| 1127 | - color: #666666; | |
| 1128 | - letter-spacing: -0.26px; | |
| 1129 | - text-align: center; | |
| 1130 | - width: 124rpx; | |
| 1131 | - border-bottom: 1px solid #CFCFCF; | |
| 1132 | - height: 38rpx; | |
| 1133 | - } | |
| 1134 | - image{ | |
| 1135 | - width: 20rpx; | |
| 1136 | - height: 20rpx; | |
| 1137 | - position: absolute; | |
| 1138 | - right: 20rpx; | |
| 1139 | - top: 8rpx; | |
| 1140 | - } | |
| 1141 | - } | |
| 1142 | - | |
| 1143 | - | |
| 1144 | - } | |
| 1145 | - } | |
| 1146 | - } | |
| 1013 | + .goods-form { | |
| 1014 | + display: flex; | |
| 1015 | + flex-direction: column; | |
| 1016 | + align-items: center; | |
| 1017 | + justify-content: center; | |
| 1018 | + background-color: #fff; | |
| 1019 | + width: 100%; | |
| 1020 | + padding: 40rpx 0; | |
| 1021 | + .p1 { | |
| 1022 | + font-size: 16px; | |
| 1023 | + color: #333333; | |
| 1024 | + letter-spacing: -0.3px; | |
| 1025 | + text-align: justify; | |
| 1026 | + line-height: 24px; | |
| 1027 | + margin: 4px 0; | |
| 1028 | + | |
| 1029 | + } | |
| 1030 | + .p2 { | |
| 1031 | + font-size: 12px; | |
| 1032 | + color: #999999; | |
| 1033 | + letter-spacing: -0.23px; | |
| 1034 | + margin-bottom: 32rpx; | |
| 1035 | + } | |
| 1036 | + .image2{ | |
| 1037 | + width: 42rpx; | |
| 1038 | + height: 34rpx; | |
| 1039 | + margin-right: 12rpx; | |
| 1040 | + } | |
| 1041 | + .confirm { | |
| 1042 | + display: flex; | |
| 1043 | + align-items: center; | |
| 1044 | + font-size: 12px; | |
| 1045 | + color: #666666; | |
| 1046 | + letter-spacing: -0.23px; | |
| 1047 | + width: 684rpx; | |
| 1048 | + .image1{ | |
| 1049 | + margin-right:25rpx; | |
| 1050 | + width: 42rpx; | |
| 1051 | + height: 38rpx; | |
| 1052 | + } | |
| 1053 | + } | |
| 1054 | + .picker{ | |
| 1055 | + display: flex; | |
| 1056 | + flex-direction: column; | |
| 1057 | + justify-content: center; | |
| 1058 | + align-items: center; | |
| 1059 | + width: 100%; | |
| 1060 | + | |
| 1061 | + .picker-choice{ | |
| 1062 | + display: flex; | |
| 1063 | + width: 684rpx; | |
| 1064 | + align-items: center; | |
| 1065 | + margin-bottom: 40rpx; | |
| 1066 | + .input{ | |
| 1067 | + border-bottom: 1px solid #CFCFCF; | |
| 1068 | + height: 40rpx; | |
| 1069 | + } | |
| 1070 | + .choice-left{ | |
| 1071 | + width: 210rpx; | |
| 1072 | + .pd{ | |
| 1073 | + font-size: 14px; | |
| 1074 | + color: #333333; | |
| 1075 | + letter-spacing: -0.26px; | |
| 1076 | + text-align: justify; | |
| 1077 | + line-height: 24px; | |
| 1078 | + margin-right: 44rpx; | |
| 1079 | + } | |
| 1080 | + .p11 { | |
| 1081 | + font-size: 14px; | |
| 1082 | + color: #333333; | |
| 1083 | + letter-spacing: -0.26px; | |
| 1084 | + text-align: justify; | |
| 1085 | + line-height: 24px; | |
| 1086 | + // margin-right: 10px; | |
| 1087 | + } | |
| 1088 | + .p12 { | |
| 1089 | + font-size: 10px; | |
| 1090 | + color: #3F3F3F; | |
| 1091 | + letter-spacing: -0.19px; | |
| 1092 | + text-align: justify; | |
| 1093 | + line-height: 24px; | |
| 1094 | + } | |
| 1095 | + | |
| 1096 | + } | |
| 1097 | + .p13 { | |
| 1098 | + font-size: 10px; | |
| 1099 | + color: #999999; | |
| 1100 | + letter-spacing: -0.19px; | |
| 1101 | + margin-right: 10px; | |
| 1102 | + } | |
| 1103 | + .p13-date { | |
| 1104 | + font-size: 10px; | |
| 1105 | + color: #999999; | |
| 1106 | + letter-spacing: -0.19px; | |
| 1107 | + margin-right: 5px; | |
| 1108 | + } | |
| 1109 | + picker{ | |
| 1110 | + width: 144rpx; | |
| 1111 | + height: 40rpx; | |
| 1112 | + display: flex; | |
| 1113 | + position: relative; | |
| 1114 | + .p14 { | |
| 1115 | + font-size: 14px; | |
| 1116 | + color: #666666; | |
| 1117 | + letter-spacing: -0.26px; | |
| 1118 | + text-align: center; | |
| 1119 | + width: 124rpx; | |
| 1120 | + border-bottom: 1px solid #CFCFCF; | |
| 1121 | + height: 38rpx; | |
| 1122 | + } | |
| 1123 | + image{ | |
| 1124 | + width: 20rpx; | |
| 1125 | + height: 20rpx; | |
| 1126 | + position: absolute; | |
| 1127 | + right: 20rpx; | |
| 1128 | + top: 8rpx; | |
| 1129 | + } | |
| 1130 | + } | |
| 1131 | + | |
| 1132 | + } | |
| 1133 | + } | |
| 1134 | + } | |
| 1147 | 1135 | } |
| 1148 | 1136 | } |
| 1149 | 1137 | .choose { | ... | ... |
src/store/modules/myLoveList.js
| ... | ... | @@ -4,11 +4,11 @@ import request from '../request' |
| 4 | 4 | const { |
| 5 | 5 | mylovelist, |
| 6 | 6 | myloveadd, |
| 7 | - myloveupdate | |
| 7 | + myloveupdate, | |
| 8 | 8 | } = urlAlias |
| 9 | 9 | |
| 10 | 10 | const state = { |
| 11 | - loveList: [] | |
| 11 | + loveList: [], | |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | const mutations = { |
| ... | ... | @@ -19,7 +19,7 @@ const mutations = { |
| 19 | 19 | UPDATE: (state, data) => { |
| 20 | 20 | // state.loveList.push(data) |
| 21 | 21 | // console.log('UPDATA=====>',data) |
| 22 | - } | |
| 22 | + }, | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | const actions = { |
| ... | ... | @@ -30,20 +30,21 @@ const actions = { |
| 30 | 30 | success: (res) => { |
| 31 | 31 | // console.log(res.data); |
| 32 | 32 | commit('INIT', res.data.data) |
| 33 | - } | |
| 33 | + }, | |
| 34 | 34 | }) |
| 35 | 35 | }, |
| 36 | 36 | addMylove({ commit }, param) { |
| 37 | 37 | console.log('myloveupdate-parm====>', param) |
| 38 | - request({ | |
| 38 | + return new Promise((resolve) => request({ | |
| 39 | 39 | url: myloveadd, |
| 40 | 40 | data: param, |
| 41 | 41 | success: (res) => { |
| 42 | 42 | console.log('addMylove-parm====>', param) |
| 43 | 43 | console.log(res.data) |
| 44 | + resolve(res.data) | |
| 44 | 45 | // commit("ADD", args); |
| 45 | - } | |
| 46 | - }) | |
| 46 | + }, | |
| 47 | + })) | |
| 47 | 48 | }, |
| 48 | 49 | updateMylove({ commit }, param) { |
| 49 | 50 | request({ |
| ... | ... | @@ -53,9 +54,9 @@ const actions = { |
| 53 | 54 | console.log('myloveupdate-parm====>', param) |
| 54 | 55 | console.log(res) |
| 55 | 56 | // commit("UPDATE", param); |
| 56 | - } | |
| 57 | + }, | |
| 57 | 58 | }) |
| 58 | - } | |
| 59 | + }, | |
| 59 | 60 | |
| 60 | 61 | } |
| 61 | 62 | |
| ... | ... | @@ -63,5 +64,5 @@ export default { |
| 63 | 64 | namespaced: true, |
| 64 | 65 | state, |
| 65 | 66 | mutations, |
| 66 | - actions | |
| 67 | + actions, | |
| 67 | 68 | } | ... | ... |
src/store/modules/order.js
| 1 | 1 | import urlAlias from '../url' |
| 2 | 2 | import request from '../request' |
| 3 | 3 | |
| 4 | -const { orderBuild } = urlAlias | |
| 4 | +const { orderBuild, buyNow, pay } = urlAlias | |
| 5 | 5 | |
| 6 | 6 | const state = { list: [], param: {} } |
| 7 | 7 | |
| ... | ... | @@ -11,34 +11,68 @@ const mutations = { |
| 11 | 11 | }, |
| 12 | 12 | SAVE: (state, param) => { |
| 13 | 13 | state.param = param |
| 14 | - } | |
| 14 | + }, | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | const actions = { |
| 18 | + // 立即购买->创建订单 | |
| 19 | + buyNow({ commit }, param) { | |
| 20 | + return new Promise((resolve) => request({ | |
| 21 | + url: buyNow, | |
| 22 | + data: param, | |
| 23 | + success: (res) => { | |
| 24 | + resolve(res) | |
| 25 | + }, | |
| 26 | + fail: () => { | |
| 27 | + uni.showModal({ | |
| 28 | + content: '创建订单失败', | |
| 29 | + showCancel: false, | |
| 30 | + }) | |
| 31 | + }, | |
| 32 | + })) | |
| 33 | + }, | |
| 34 | + // 购物车->创建订单 | |
| 18 | 35 | build({ commit }, param) { |
| 19 | 36 | return new Promise((resolve, reject) => request({ |
| 20 | 37 | url: orderBuild, |
| 21 | 38 | data: param, |
| 22 | 39 | success: (res) => { |
| 23 | - resolve() | |
| 40 | + resolve(res.data) | |
| 24 | 41 | }, |
| 25 | 42 | fail: () => { |
| 26 | 43 | uni.showModal({ |
| 27 | 44 | content: '订单生成失败', |
| 28 | - showCancel: false | |
| 45 | + showCancel: false, | |
| 29 | 46 | }) |
| 30 | - } | |
| 47 | + }, | |
| 31 | 48 | })) |
| 32 | 49 | }, |
| 50 | + // 支付 | |
| 51 | + pay({ commit }, param) { | |
| 52 | + return new Promise((resolve, reject) => request({ | |
| 53 | + url: pay, | |
| 54 | + data: param, | |
| 55 | + success: (res) => { | |
| 56 | + resolve(res.data) | |
| 57 | + }, | |
| 58 | + fail: () => { | |
| 59 | + uni.showModal({ | |
| 60 | + content: '订单生成失败', | |
| 61 | + showCancel: false, | |
| 62 | + }) | |
| 63 | + }, | |
| 64 | + })) | |
| 65 | + }, | |
| 66 | + // 储存创建订单参数 | |
| 33 | 67 | saveParams({ commit }, param) { |
| 34 | 68 | console.log('save', param) |
| 35 | 69 | commit('SAVE', param) |
| 36 | - } | |
| 70 | + }, | |
| 37 | 71 | } |
| 38 | 72 | |
| 39 | 73 | export default { |
| 40 | 74 | namespaced: true, |
| 41 | 75 | state, |
| 42 | 76 | mutations, |
| 43 | - actions | |
| 77 | + actions, | |
| 44 | 78 | } | ... | ... |
src/store/request.js
| ... | ... | @@ -5,7 +5,7 @@ export default async function request({ |
| 5 | 5 | method = 'post', |
| 6 | 6 | data = {}, |
| 7 | 7 | header = { |
| 8 | - 'Content-Type': 'application/x-www-form-urlencoded' | |
| 8 | + 'Content-Type': 'application/x-www-form-urlencoded', | |
| 9 | 9 | }, |
| 10 | 10 | timeout = 3000, |
| 11 | 11 | withCredentials = false, // 跨域请求时是否携带凭证(cookies) |
| ... | ... | @@ -16,14 +16,14 @@ export default async function request({ |
| 16 | 16 | }, |
| 17 | 17 | complete = (res) => { |
| 18 | 18 | console.log('complete status === > ', res) |
| 19 | - } | |
| 19 | + }, | |
| 20 | 20 | }) { |
| 21 | 21 | const uid = uni.getStorageSync('uid') |
| 22 | - const openid = uni.getStorageSync('uid') | |
| 22 | + const openid = uni.getStorageSync('openid') | |
| 23 | 23 | data = { |
| 24 | 24 | uid, |
| 25 | 25 | openid, |
| 26 | - ...data | |
| 26 | + ...data, | |
| 27 | 27 | } |
| 28 | 28 | uni |
| 29 | 29 | .request({ |
| ... | ... | @@ -35,6 +35,6 @@ export default async function request({ |
| 35 | 35 | withCredentials, |
| 36 | 36 | success, |
| 37 | 37 | fail, |
| 38 | - complete | |
| 38 | + complete, | |
| 39 | 39 | }) |
| 40 | 40 | } | ... | ... |
src/store/url.js
| ... | ... | @@ -18,7 +18,9 @@ const urlAlias = { |
| 18 | 18 | cancelOrder: '/app/order/wait/del', // 取消订单 |
| 19 | 19 | statusConfirm: '/app/order/statusConfirm', // 订单操作 |
| 20 | 20 | payLog: '/app/pay/log', // 调起支付 |
| 21 | - orderBuild: '/app/order/build', // 生成订单 | |
| 21 | + orderBuild: '/app/order/build', // 加购后生成订单 | |
| 22 | + buyNow: '/app/order/buynow', // 立即购买生成订单 | |
| 23 | + pay: '/app/pay/log', // 支付接口 | |
| 22 | 24 | |
| 23 | 25 | // 购物车 |
| 24 | 26 | cartList: '/app/cart/list', // 获取购物车列表 |
| ... | ... | @@ -43,7 +45,7 @@ const urlAlias = { |
| 43 | 45 | // 用户数据 |
| 44 | 46 | mylovelist: '/app/user/mylovelist', // 关心的人的数据 |
| 45 | 47 | myloveadd: '/app/user/myloveadd', // 添加关心的人 |
| 46 | - myloveupdate: '/app/user/myloveupdate' // 更新关心人的数据 | |
| 48 | + myloveupdate: '/app/user/myloveupdate', // 更新关心人的数据 | |
| 47 | 49 | } |
| 48 | 50 | |
| 49 | 51 | export default urlAlias | ... | ... |