Commit 4cafd66026209bfd525de81d44899bb5214ac711

Authored by 尹聃
Exists in master

Merge branch 'master' of 121.40.31.31:jp/gulu-vue

... ... @@ -27,7 +27,7 @@
27 27 {
28 28 "path": "pages/purchaseLenses/purchaseLenses",
29 29 "style": {
30   - "navigationBarTitleText": "产品选购"
  30 + "navigationBarTitleText": "参数选择"
31 31 }
32 32 },
33 33 {
... ...
src/pages/confirmOrder/confirmOrder.vue
... ... @@ -104,15 +104,15 @@
104 104 ></image>
105 105 <text>微信支付</text>
106 106 </view>
107   - <view class="randomSubstraction">最高随机立减¥99</view>
  107 + <!-- <view class="randomSubstraction">最高随机立减¥99</view> -->
108 108 </view>
109   - <image
  109 + <!-- <image
110 110 src="../../static/right.png"
111 111 mode="aspectFill"
112   - ></image>
  112 + ></image> -->
113 113 </view>
114 114 </view>
115   - <view class="item">
  115 + <!-- <view class="item">
116 116 <text>优惠券</text>
117 117 <view class="itemRight">
118 118 <view class="rightText">
... ... @@ -126,11 +126,11 @@
126 126 mode="aspectFill"
127 127 ></image>
128 128 </view>
129   - </view>
  129 + </view> -->
130 130 <view class="item">
131 131 <text>运费</text>
132 132 <view class="itemRight">
133   - <view class="freight">¥{{freight}}</view>
  133 + <view class="freight">免运费</view>
134 134 </view>
135 135 </view>
136 136 <view class="item">
... ... @@ -229,6 +229,12 @@ export default {
229 229 complete: () => {}
230 230 })
231 231 },
  232 + // 加入购物车
  233 + addCart() {
  234 + console.log('this', this.$store.state)
  235 + store.dispatch('cart/')
  236 + },
  237 + // 下单
232 238 orderBuild() {
233 239 console.log('this', this.$store.state)
234 240 // store.dispatch('order/build', {
... ... @@ -238,6 +244,7 @@ export default {
238 244 // totalPrice: 101
239 245 // })
240 246 }
  247 + // 支付
241 248 // pay() {
242 249 // const openId = uni.getStorageSync('openid')
243 250 // const fieldSet = {
... ...
src/pages/myOrderPaying/myOrderPaying.vue
... ... @@ -131,14 +131,12 @@ export default {
131 131 },
132 132 data () {
133 133 return {
134   - // orderInfo:{},
135 134 payId: '',
136 135 payTime: '',
137 136 status: '',
138 137 uid: '',
139 138 openid: '',
140 139 lefttime: 0
141   -
142 140 }
143 141 },
144 142 onLoad: function (option) {
... ... @@ -160,7 +158,7 @@ export default {
160 158 computed: {
161 159 // 获取订单详细信息
162 160 orderInfo () {
163   - console.log(this.$store.state.orderRead.orderInfo)
  161 + console.log('orderInfo', this.$store.state.orderRead.orderInfo)
164 162 return this.$store.state.orderRead.orderInfo || {}
165 163 },
166 164 orderInfoList () {
... ...
src/pages/purchaseLenses/purchaseLenses.vue
... ... @@ -49,6 +49,8 @@
49 49 </view>
50 50 <input
51 51 class="choice-name uni-input"
  52 + :value="dataName"
  53 + @blur="fillData"
52 54 placeholder="下系"
53 55 />
54 56 </view>
... ... @@ -371,7 +373,8 @@ export default {
371 373 count: 1,
372 374 pid: 0,
373 375 maxCount: 20,
374   - isShow: true,
  376 + dataName: '', // 验光数据人员名称
  377 + isDataName: false,
375 378 opIsOpen: true,
376 379 addDisabled: false,
377 380 desDisabled: false,
... ... @@ -384,6 +387,9 @@ export default {
384 387 sku_name: 'Miss 黑二代【减龄自然】',
385 388 sk_id: '128'
386 389 },
  390 + checkedData: {
  391 +
  392 + },
387 393 chooseRes2: '14.0',
388 394 chooseRes3: 0,
389 395 chooseItem1: [
... ... @@ -426,6 +432,9 @@ export default {
426 432 },
427 433 skuList() {
428 434 return this.$store.state.read.goodInfo.skuList
  435 + },
  436 + mpList() {
  437 + return this.$store.state.myLoveList.loveList
429 438 }
430 439 },
431 440 onLoad({ pid }) {
... ... @@ -442,8 +451,31 @@ export default {
442 451 this.current = current
443 452 this.show = show
444 453 })
  454 + store.dispatch('myLoveList/getLoveList')
445 455 },
446 456 methods: {
  457 + // 是否填充人员数据
  458 + fillData(e) {
  459 + this.isDataName = false
  460 + console.log('e---->', e)
  461 + const mpList = this.mpList
  462 +
  463 + for (let index = 0; index < mpList.length; index++) {
  464 + if (e.detail.value === mpList[index].name) {
  465 + this.isDataName = true
  466 + uni.showModal({
  467 + title: '提示',
  468 + content: `是否填充已有的${e.detail.value}的数据`,
  469 + success: ({ confirm }) => {
  470 + if (confirm) {
  471 + this.checkedData = mpList[index]
  472 + console.log('checkedData', this.checkedData)
  473 + }
  474 + }
  475 + })
  476 + }
  477 + }
  478 + },
447 479 change(num) {
448 480 this.show[num] = !this.show[num]
449 481 this.$forceUpdate()
... ... @@ -480,9 +512,25 @@ export default {
480 512 }
481 513 },
482 514 toComfirmOrder() {
  515 + let i = 0
  516 + // 判断出是哪一个sku被选中
  517 + for (let index = 0; index < this.current.length; index++) {
  518 + console.log('index', index, i, index !== this.current.length - 1)
  519 + if (index !== this.current.length - 1) {
  520 + console.log('----', this.current[index], this.attrList[1].attr.length, this.attrList)
  521 + i = this.current[index] * this.attrList[1].attr.length
  522 + } else {
  523 + i += this.current[index]
  524 + }
  525 + console.log('i', i)
  526 + }
  527 + console.log('i------>', i)
  528 + // 判断是否其输入的人员数据是否已存在
483 529 store.dispatch('order/saveParams', {
  530 + sk_id_arr: this.skuList[i],
484 531 current: this.current
485 532 })
  533 +
486 534 uni.navigateTo({
487 535 url: `../confirmOrder/confirmOrder?pid=${this.pid}`
488 536 })
... ...
src/store/modules/myLoveList.js
1   -import urlAlias from '../url';
2   -import request from '../request';
3   -
4   -const {
  1 +import urlAlias from '../url'
  2 +import request from '../request'
  3 +
  4 +const {
5 5 mylovelist,
6 6 myloveadd,
7   - myloveupdate
8   -} = urlAlias;
9   -
10   -const state = {
11   - loveList: [],
12   -};
13   -
14   -const mutations = {
15   - INIT: (state, data) => {
16   - state.loveList = data;
  7 + myloveupdate
  8 +} = urlAlias
  9 +
  10 +const state = {
  11 + loveList: []
  12 +}
  13 +
  14 +const mutations = {
  15 + INIT: (state, data) => {
  16 + state.loveList = data
17 17 },
18 18 // 更新关心人验光单
19   - UPDATE:(state, data) => {
20   - // state.loveList.push(data)
21   - // console.log('UPDATA=====>',data)
22   - }
23   -};
24   -
25   -const actions = {
26   - getLoveList({ commit }, param) {
27   - request({
28   - url: mylovelist,
29   - data: param,
30   - success: (res) => {
31   - // console.log(res.data);
32   - commit("INIT", res.data.data);
33   - },
34   - })
  19 + UPDATE: (state, data) => {
  20 + // state.loveList.push(data)
  21 + // console.log('UPDATA=====>',data)
  22 + }
  23 +}
  24 +
  25 +const actions = {
  26 + getLoveList({ commit }, param) {
  27 + request({
  28 + url: mylovelist,
  29 + data: param,
  30 + success: (res) => {
  31 + // console.log(res.data);
  32 + commit('INIT', res.data.data)
  33 + }
  34 + })
35 35 },
36 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   - },
  37 + console.log('myloveupdate-parm====>', param)
  38 + request({
  39 + url: myloveadd,
  40 + data: param,
  41 + success: (res) => {
  42 + console.log('addMylove-parm====>', param)
  43 + console.log(res.data)
  44 + // commit("ADD", args);
  45 + }
47 46 })
48 47 },
49 48 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   - },
  49 + request({
  50 + url: myloveupdate,
  51 + data: param,
  52 + success: (res) => {
  53 + console.log('myloveupdate-parm====>', param)
  54 + console.log(res)
  55 + // commit("UPDATE", param);
  56 + }
58 57 })
59   - },
60   -
61   -}
62   -
63   -export default {
64   - namespaced: true,
65   - state,
66   - mutations,
67   - actions,
68   -}
69 58 \ No newline at end of file
  59 + }
  60 +
  61 +}
  62 +
  63 +export default {
  64 + namespaced: true,
  65 + state,
  66 + mutations,
  67 + actions
  68 +}
... ...
src/store/modules/order.js
... ... @@ -3,7 +3,7 @@ import request from &#39;../request&#39;
3 3  
4 4 const { orderBuild } = urlAlias
5 5  
6   -const state = { list: [], param: [] }
  6 +const state = { list: [], param: {} }
7 7  
8 8 const mutations = {
9 9 LIST: (state, list) => {
... ...
src/store/request.js
1   -const DOMAIN = 'https://api.glass.xiuyetang.com';
  1 +const DOMAIN = 'https://api.glass.xiuyetang.com'
2 2  
3 3 export default async function request({
4   - url,
5   - method = "post",
6   - data = {},
7   - header = {
8   - "Content-Type": "application/x-www-form-urlencoded",
9   - },
10   - timeout = 3000,
11   - withCredentials = false, // 跨域请求时是否携带凭证(cookies)
12   - // sslVerify: true, // 验证 ssl 证书
13   - success,
14   - fail = (res) => {
15   - console.log("fail status === > ", res);
16   - },
17   - complete = (res) => {
18   - console.log("complete status === > ", res);
19   - },
  4 + url,
  5 + method = 'post',
  6 + data = {},
  7 + header = {
  8 + 'Content-Type': 'application/x-www-form-urlencoded'
  9 + },
  10 + timeout = 3000,
  11 + withCredentials = false, // 跨域请求时是否携带凭证(cookies)
  12 + // sslVerify: true, // 验证 ssl 证书
  13 + success,
  14 + fail = (res) => {
  15 + console.log('fail status === > ', res)
  16 + },
  17 + complete = (res) => {
  18 + console.log('complete status === > ', res)
  19 + }
20 20 }) {
21   - const uid = uni.getStorageSync('uid');
22   - data = {
23   - uid,
24   - ...data,
25   - };
26   - uni
27   - .request({
28   - url: DOMAIN + url,
29   - method,
30   - data,
31   - header,
32   - timeout,
33   - withCredentials,
34   - success,
35   - fail,
36   - complete,
37   - })
38   -}
39 21 \ No newline at end of file
  22 + const uid = uni.getStorageSync('uid')
  23 + const openid = uni.getStorageSync('uid')
  24 + data = {
  25 + uid,
  26 + openid,
  27 + ...data
  28 + }
  29 + uni
  30 + .request({
  31 + url: DOMAIN + url,
  32 + method,
  33 + data,
  34 + header,
  35 + timeout,
  36 + withCredentials,
  37 + success,
  38 + fail,
  39 + complete
  40 + })
  41 +}
... ...