Commit 72d769fb774836b40ff5c311f4223ce02c106c7b
1 parent
e2eaa8a22b
Exists in
master
myOrder
Showing
7 changed files
with
179 additions
and
78 deletions
Show diff stats
src/pages.json
1 | 1 | { |
2 | 2 | "pages": [ |
3 | + { | |
4 | + "path" : "pages/myOrder/myOrder", | |
5 | + "style" : { | |
6 | + "navigationBarTitleText": "我的订单"} | |
7 | + }, | |
3 | 8 | { |
4 | 9 | "path": "pages/cart/cart", |
5 | 10 | "style": { |
... | ... | @@ -36,11 +41,6 @@ |
36 | 41 | "navigationBarTitleText": "申请退款" |
37 | 42 | } |
38 | 43 | }, |
39 | - { | |
40 | - "path" : "pages/myOrder/myOrder", | |
41 | - "style" : { | |
42 | - "navigationBarTitleText": "我的订单"} | |
43 | - }, | |
44 | 44 | { |
45 | 45 | "path": "pages/addAddress/addAddress", |
46 | 46 | "style": { | ... | ... |
src/pages/index/index.vue
src/pages/myOrder/components/OrderCard.vue
... | ... | @@ -57,10 +57,10 @@ |
57 | 57 | <view class="btn-type1">再次购买</view> |
58 | 58 | </view> |
59 | 59 | </view> |
60 | - </view> | |
61 | -</template> | |
62 | - | |
63 | -<script> | |
60 | + </view> | |
61 | +</template> | |
62 | + | |
63 | +<script> | |
64 | 64 | export default { |
65 | 65 | props: { |
66 | 66 | /** |
... | ... | @@ -80,10 +80,14 @@ |
80 | 80 | */ |
81 | 81 | current:Number |
82 | 82 | |
83 | - }, | |
84 | - data() { | |
85 | - return { | |
86 | - }; | |
83 | + }, | |
84 | + onLoad() { | |
85 | + // console.log('dd'); | |
86 | + console.log('order', this.props.order); | |
87 | + }, | |
88 | + data() { | |
89 | + return { | |
90 | + }; | |
87 | 91 | }, |
88 | 92 | methods:{ |
89 | 93 | toRefundment(){ |
... | ... | @@ -94,11 +98,11 @@ |
94 | 98 | complete: () => {} |
95 | 99 | }); |
96 | 100 | } |
97 | - } | |
98 | - } | |
99 | -</script> | |
100 | - | |
101 | -<style lang="scss"> | |
101 | + } | |
102 | + } | |
103 | +</script> | |
104 | + | |
105 | +<style lang="scss"> | |
102 | 106 | .card{ |
103 | 107 | width: 670rpx; |
104 | 108 | height: 478rpx; |
... | ... | @@ -206,5 +210,5 @@ |
206 | 210 | margin-left: 20rpx; |
207 | 211 | } |
208 | 212 | } |
209 | - } | |
210 | -</style> | |
213 | + } | |
214 | +</style> | ... | ... |
src/pages/myOrder/myOrder.vue
... | ... | @@ -13,7 +13,10 @@ |
13 | 13 | </view> |
14 | 14 | </view> |
15 | 15 | <view class="orderList" > |
16 | - <view v-for="(order) in orderList" :key="order.orderId"> | |
16 | + <view | |
17 | + v-for="(order) in orderList" | |
18 | + :key="order.orderId" | |
19 | + > | |
17 | 20 | <OrderCard :order = "order" :current="current"></OrderCard> |
18 | 21 | </view> |
19 | 22 | </view> |
... | ... | @@ -21,10 +24,12 @@ |
21 | 24 | </view> |
22 | 25 | </template> |
23 | 26 | <script> |
24 | - import OrderCard from './components/OrderCard.vue' | |
27 | + import OrderCard from './components/OrderCard.vue'; | |
28 | + import store from '@/store'; | |
29 | + | |
25 | 30 | export default { |
26 | 31 | components:{ |
27 | - 'OrderCard':OrderCard | |
32 | + 'OrderCard': OrderCard | |
28 | 33 | }, |
29 | 34 | data() { |
30 | 35 | return { |
... | ... | @@ -37,20 +42,31 @@ |
37 | 42 | ], |
38 | 43 | current: 0, |
39 | 44 | //订单数据 |
40 | - orderList:[ | |
41 | - { orderId: 0, img: '/static/img/goods/p1.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:1 ,buyNum:1}, | |
42 | - { orderId: 2, img: '/static/img/goods/p3.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:1 ,buyNum:1}, | |
43 | - { orderId: 3, img: '/static/img/goods/p4.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:2 ,buyNum:1}, | |
44 | - { orderId: 4, img: '/static/img/goods/p5.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:3 ,buyNum:1}, | |
45 | - { orderId: 5, img: '/static/img/goods/p6.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:3 ,buyNum:1}, | |
46 | - { orderId: 6, img: '/static/img/goods/p7.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:4 ,buyNum:1}, | |
47 | - { orderId: 7, img: '/static/img/goods/p8.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:4 ,buyNum:1}, | |
48 | - { orderId: 8, img: '/static/img/goods/p9.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:5 ,buyNum:1}, | |
49 | - { orderId: 9, img: '/static/img/goods/p10.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:5 ,buyNum:1} | |
50 | - ], | |
51 | - | |
45 | + // orderList:[ | |
46 | + // { orderId: 0, img: '/static/img/goods/p1.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:1 ,buyNum:1}, | |
47 | + // { orderId: 2, img: '/static/img/goods/p3.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:1 ,buyNum:1}, | |
48 | + // { orderId: 3, img: '/static/img/goods/p4.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:2 ,buyNum:1}, | |
49 | + // { orderId: 4, img: '/static/img/goods/p5.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:3 ,buyNum:1}, | |
50 | + // { orderId: 5, img: '/static/img/goods/p6.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:3 ,buyNum:1}, | |
51 | + // { orderId: 6, img: '/static/img/goods/p7.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:4 ,buyNum:1}, | |
52 | + // { orderId: 7, img: '/static/img/goods/p8.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:4 ,buyNum:1}, | |
53 | + // { orderId: 8, img: '/static/img/goods/p9.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:5 ,buyNum:1}, | |
54 | + // { orderId: 9, img: '/static/img/goods/p10.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:5 ,buyNum:1} | |
55 | + // ], | |
52 | 56 | }; |
53 | 57 | }, |
58 | + onLoad: function() { | |
59 | + store.dispatch('myOrder/getList', { | |
60 | + uid: "1", | |
61 | + way: "0", | |
62 | + }); | |
63 | + }, | |
64 | + computed: { | |
65 | + orderList() { | |
66 | + console.log('orderList', this.$store.state.myOrder.orderlist); | |
67 | + return this.$store.state.myOrder.orderlist; | |
68 | + } | |
69 | + }, | |
54 | 70 | methods:{ |
55 | 71 | onClickItem(e) { |
56 | 72 | if (this.current !== e) { | ... | ... |
src/store/modules/myOrder.js
1 | +import urlAlias from '../url'; | |
2 | +import request from '../request'; | |
3 | + | |
4 | +const { | |
5 | + orderList | |
6 | +} = urlAlias; | |
7 | + | |
8 | +const data = { | |
9 | + data: [ | |
10 | + { | |
11 | + finished_time: null, | |
12 | + is_refound: "0", | |
13 | + mch_id: "1436019502", | |
14 | + money_of_dcw: "0", | |
15 | + money_of_partner: "0", | |
16 | + money_of_shop: "0", | |
17 | + orderJudge: false, | |
18 | + order_info: { | |
19 | + address:{ | |
20 | + cityName: "镇江市", | |
21 | + countyName: "丹阳市", | |
22 | + detailInfo: "延陵镇柳茹村卫生室附近秀野堂农业发展有限公司", | |
23 | + errMsg: "chooseAddress:ok", | |
24 | + nationalCode: "321181", | |
25 | + postalCode: "212300", | |
26 | + provinceName: "江苏省", | |
27 | + telNumber: "15896379277", | |
28 | + userName: "点餐汪客服", | |
29 | + }, | |
30 | + cartinfo:['11', '12'], | |
31 | + keyname: "1_1587129366", | |
32 | + lefttime: 179995, | |
33 | + list:[ | |
34 | + { | |
35 | + cart_id: "11", | |
36 | + imgUrl: "https://glass.xiuyetang.com//upload_jk/4/4_0_3FDA03.jpg", | |
37 | + img_index_url: null, | |
38 | + memo: "志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流,01-8701", | |
39 | + mp_id: "1", | |
40 | + nowPrice: 100, | |
41 | + num: "2", | |
42 | + oldPrice: "0", | |
43 | + p_discount: "1", | |
44 | + p_name: "01-8701志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流", | |
45 | + p_root_index: "1", | |
46 | + p_sale_price: "0", | |
47 | + peopleName: "me", | |
48 | + pics: '', | |
49 | + pid: "4", | |
50 | + sk_id: "38", | |
51 | + }, | |
52 | + ], | |
53 | + orderDesc: "总共包括有:01-8701志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流在内的1件商品", | |
54 | + total_fee: 100 | |
55 | + }, | |
56 | + partner_uid: "0", | |
57 | + pay_cate: "2020", | |
58 | + pay_id: "3", | |
59 | + pay_time: "2020-04-17 21:16:12", | |
60 | + pay_wood_desc: "在【非常戴镜】的微信付款凭证", | |
61 | + pay_wood_id: "fcdj-1-1_1587129366", | |
62 | + prepay_id: "wx172116124528226bf1a8adad1662456500", | |
63 | + re_check_staus: "0", | |
64 | + shopid: "0", | |
65 | + split_userid: "0", | |
66 | + status: "1", | |
67 | + total_fee: "100", | |
68 | + uid: "1", | |
69 | + } | |
70 | + ], | |
71 | + msg: "订单列表", | |
72 | + status: 0, | |
73 | +} | |
74 | + | |
1 | 75 | const state = { |
2 | - orderList: [], | |
76 | + orderList: [], | |
3 | 77 | }; |
4 | 78 | |
5 | 79 | const mutations = { |
6 | - getOrder: (state, data) => { | |
7 | - state.orderList = data; | |
8 | - }, | |
80 | + INIT: (state, data) => { | |
81 | + state.orderList = data; | |
82 | + }, | |
9 | 83 | }; |
10 | 84 | |
11 | 85 | const actions = { |
12 | - fetch({ commit }, param) { | |
13 | - uni | |
14 | - .request({ | |
15 | - url: "", | |
16 | - method: "post", | |
17 | - data: {}, | |
18 | - header: { | |
19 | - "Content-Type": "application/x-www-form-urlencoded", | |
20 | - }, | |
21 | - timeout: 3000, | |
22 | - withCredentials: false, | |
23 | - success: (res) => { | |
24 | - commit('getOrder', res.data.data) | |
25 | - }, | |
26 | - fail: (res) => { | |
27 | - console.log("fail status === > ", res); | |
28 | - }, | |
29 | - complete: (res) => { | |
30 | - console.log("complete status === > ", res); | |
31 | - } | |
32 | - }) | |
33 | - } | |
86 | + getList({ commit }, param) { | |
87 | + request({ | |
88 | + url: orderList, | |
89 | + data: param, | |
90 | + success: (res) => { | |
91 | + const resData = { | |
92 | + ...res, | |
93 | + data, | |
94 | + } | |
95 | + console.log('data.data', resData.data.data); | |
96 | + commit("INIT", resData.data.data); | |
97 | + }, | |
98 | + }) | |
99 | + } | |
34 | 100 | } |
35 | 101 | |
36 | 102 | export default { |
37 | - namespaced: true, | |
38 | - state, | |
39 | - mutations, | |
40 | - actions, | |
103 | + namespaced: true, | |
104 | + state, | |
105 | + mutations, | |
106 | + actions, | |
41 | 107 | } |
42 | 108 | \ No newline at end of file | ... | ... |
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 | 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 证书 | |
5 | 13 | success, |
6 | - fail, | |
7 | - complete, | |
14 | + fail = (res) => { | |
15 | + console.log("fail status === > ", res); | |
16 | + }, | |
17 | + complete = (res) => { | |
18 | + console.log("complete status === > ", res); | |
19 | + }, | |
8 | 20 | }) { |
9 | 21 | console.log("DOMAIN", DOMAIN, url); |
10 | 22 | uni |
11 | 23 | .request({ |
12 | 24 | url: DOMAIN + url, |
13 | - method: "post", | |
14 | - data: {}, | |
15 | - header: { | |
16 | - "Content-Type": "application/x-www-form-urlencoded", | |
17 | - }, | |
18 | - timeout: 3000, | |
19 | - withCredentials: false, | |
25 | + method, | |
26 | + data, | |
27 | + header, | |
28 | + timeout, | |
29 | + withCredentials, | |
20 | 30 | success, |
21 | 31 | fail, |
22 | 32 | complete, | ... | ... |