Commit e2ec4dcd2442006c655b7d033edca29fd21e4415
1 parent
be5ebbf9
Exists in
dev
微信h5支付功能
Showing
3 changed files
with
519 additions
and
470 deletions
Show diff stats
frontend/app-user/api/member.js
@@ -75,7 +75,7 @@ export function getwDdDetail(params) { | @@ -75,7 +75,7 @@ export function getwDdDetail(params) { | ||
75 | //创建订单 | 75 | //创建订单 |
76 | export function savewDd(data) { | 76 | export function savewDd(data) { |
77 | return request({ | 77 | return request({ |
78 | - url: '/user/order/save', | 78 | + url: '/user/order/payment/add', |
79 | method: 'post', | 79 | method: 'post', |
80 | data: data | 80 | data: data |
81 | }) | 81 | }) |
frontend/app-user/pages/home/orderSuccessful.vue
1 | <template> | 1 | <template> |
2 | - <view class="container"> | ||
3 | - <Navbar title="订气完成" canBack bgColor="#EA5504" leftIconColor="#fff" textColor="#fff"></Navbar> | ||
4 | - <view class="topCss"> | ||
5 | - <view class="flex"> | ||
6 | - <view class=""> | ||
7 | - <u-image src="@/static/images/home/success.png" width="50px" height="50px"></u-image> | ||
8 | - </view> | ||
9 | - <view class="flex flex-direction margin-left-sm justify-between"> | ||
10 | - <view class="text-xl text-white text-bold"> | ||
11 | - 下单成功! | ||
12 | - </view> | ||
13 | - <view class="text-white text-sm"> | ||
14 | - 感谢您的支持 | ||
15 | - </view> | ||
16 | - </view> | ||
17 | - </view> | ||
18 | - <view class="borderCss flex flex-direction"> | ||
19 | - <view class="billCss"> | ||
20 | - <view class="priceCss"> | ||
21 | - ¥{{ddInfo.fDdje}} | ||
22 | - </view> | ||
23 | - <view class="margin-lr-sm"> | ||
24 | - <u-line dashed></u-line> | ||
25 | - </view> | ||
26 | - <view class="flex margin-left-sm margin-top-lg align-center"> | ||
27 | - <view class="text-gray"> | ||
28 | - 订单编号: | ||
29 | - </view> | ||
30 | - <view class="margin-left-sm"> | ||
31 | - {{ ddInfo.fDddh || '-'}} | ||
32 | - </view> | ||
33 | - </view> | 2 | + <view class="container"> |
3 | + <Navbar title="订气完成" canBack bgColor="#EA5504" leftIconColor="#fff" textColor="#fff"></Navbar> | ||
4 | + <view class="topCss"> | ||
5 | + <view class="flex"> | ||
6 | + <view class=""> | ||
7 | + <u-image src="@/static/images/home/success.png" width="50px" height="50px"></u-image> | ||
8 | + </view> | ||
9 | + <view class="flex flex-direction margin-left-sm justify-between"> | ||
10 | + <view class="text-xl text-white text-bold"> | ||
11 | + 下单成功! | ||
12 | + </view> | ||
13 | + <view class="text-white text-sm"> | ||
14 | + 感谢您的支持 | ||
15 | + </view> | ||
16 | + </view> | ||
17 | + </view> | ||
18 | + <view class="borderCss flex flex-direction"> | ||
19 | + <view class="billCss"> | ||
20 | + <view class="priceCss"> | ||
21 | + ¥{{ ddInfo.fDdje }} | ||
22 | + </view> | ||
23 | + <view class="margin-lr-sm"> | ||
24 | + <u-line dashed></u-line> | ||
25 | + </view> | ||
26 | + <view class="flex margin-left-sm margin-top-lg align-center"> | ||
27 | + <view class="text-gray"> | ||
28 | + 订单编号: | ||
29 | + </view> | ||
30 | + <view class="margin-left-sm"> | ||
31 | + {{ ddInfo.fDddh || '-' }} | ||
32 | + </view> | ||
33 | + </view> | ||
34 | <view class="flex margin-left-sm margin-top-lg align-center"> | 34 | <view class="flex margin-left-sm margin-top-lg align-center"> |
35 | <view class="text-gray"> | 35 | <view class="text-gray"> |
36 | 下单时间: | 36 | 下单时间: |
37 | </view> | 37 | </view> |
38 | <view class="margin-left-sm"> | 38 | <view class="margin-left-sm"> |
39 | - {{ddInfo.fCjsj || '-'}} | 39 | + {{ ddInfo.fCjsj || '-' }} |
40 | </view> | 40 | </view> |
41 | </view> | 41 | </view> |
42 | <view class="flex margin-left-sm margin-top-lg align-center"> | 42 | <view class="flex margin-left-sm margin-top-lg align-center"> |
@@ -44,105 +44,109 @@ | @@ -44,105 +44,109 @@ | ||
44 | 订单总金额: | 44 | 订单总金额: |
45 | </view> | 45 | </view> |
46 | <view class="margin-left-sm"> | 46 | <view class="margin-left-sm"> |
47 | - ¥{{ddInfo.fDdje|| '-'}} | 47 | + ¥{{ ddInfo.fDdje || '-' }} |
48 | </view> | 48 | </view> |
49 | </view> | 49 | </view> |
50 | - </view> | ||
51 | - </view> | ||
52 | - | ||
53 | - </view> | ||
54 | - <view class="bomBtnCss flex justify-between"> | ||
55 | - <view class="" @click="goHome"> | ||
56 | - <u-button>返回首页</u-button> | ||
57 | - </view> | ||
58 | - <view class="" @click="goOrder"> | ||
59 | - <u-button color="#EA5504">查看订单</u-button> | ||
60 | - </view> | ||
61 | - </view> | ||
62 | - </view> | 50 | + </view> |
51 | + </view> | ||
52 | + </view> | ||
53 | + <view class="bomBtnCss flex justify-between"> | ||
54 | + <view class="" @click="goHome"> | ||
55 | + <u-button>返回首页</u-button> | ||
56 | + </view> | ||
57 | + <view class="" @click="goOrder"> | ||
58 | + <u-button color="#EA5504">查看订单</u-button> | ||
59 | + </view> | ||
60 | + </view> | ||
61 | + </view> | ||
63 | </template> | 62 | </template> |
64 | 63 | ||
65 | <script> | 64 | <script> |
66 | - export default { | ||
67 | - components: { | 65 | +export default { |
66 | + components: {}, | ||
67 | + data() { | ||
68 | + return { | ||
69 | + ddInfo: null | ||
70 | + }; | ||
71 | + }, | ||
72 | + mounted() { | ||
68 | 73 | ||
69 | - }, | ||
70 | - data() { | ||
71 | - return { | ||
72 | - ddInfo:null | ||
73 | - }; | ||
74 | - }, | ||
75 | - mounted() { | ||
76 | - | ||
77 | - }, | ||
78 | - onLoad(data) { | ||
79 | - console.log("data",data); | ||
80 | - if(data.datas){ | ||
81 | - this.ddInfo = JSON.parse(data.datas) | ||
82 | - } | ||
83 | - }, | ||
84 | - methods: { | ||
85 | - goHome(){ | ||
86 | - uni.switchTab({ | ||
87 | - url:"/pages/home/home" | ||
88 | - }) | ||
89 | - }, | ||
90 | - goOrder(){ | ||
91 | - uni.$emit("onload",true); | ||
92 | - uni.switchTab({ | ||
93 | - url:"/pages/order/order" | ||
94 | - }) | ||
95 | - } | ||
96 | - } | ||
97 | - } | 74 | + }, |
75 | + onLoad(data) { | ||
76 | + this.getDetailInfo(JSON.parse(data.datas).ddid); | ||
77 | + }, | ||
78 | + methods: { | ||
79 | + async getDetailInfo(id) { | ||
80 | + let result = await this.$api.orderApi.getOrderDetail(id); | ||
81 | + let {code, value} = result; | ||
82 | + if (code == 200) { | ||
83 | + this.ddInfo = value; | ||
84 | + console.log("ddInfo", this.ddInfo); | ||
85 | + } | ||
86 | + }, | ||
87 | + goHome() { | ||
88 | + uni.switchTab({ | ||
89 | + url: "/pages/home/home" | ||
90 | + }) | ||
91 | + }, | ||
92 | + goOrder() { | ||
93 | + uni.$emit("onload", true); | ||
94 | + uni.switchTab({ | ||
95 | + url: "/pages/order/order" | ||
96 | + }) | ||
97 | + } | ||
98 | + } | ||
99 | +} | ||
98 | </script> | 100 | </script> |
99 | 101 | ||
100 | <style lang="scss" scoped> | 102 | <style lang="scss" scoped> |
101 | - .topCss { | ||
102 | - background: #EA5504; | ||
103 | - height: 200px; | ||
104 | - display: flex; | ||
105 | - flex-direction: column; | ||
106 | - justify-content: center; | ||
107 | - align-items: center; | ||
108 | - } | 103 | +.topCss { |
104 | + background: #EA5504; | ||
105 | + height: 200px; | ||
106 | + display: flex; | ||
107 | + flex-direction: column; | ||
108 | + justify-content: center; | ||
109 | + align-items: center; | ||
110 | +} | ||
111 | + | ||
112 | +.borderCss { | ||
113 | + width: 90%; | ||
114 | + height: 10px; | ||
115 | + background: #8A3A0E; | ||
116 | + border-radius: 15px; | ||
117 | + margin: 40px 10px 0 10px; | ||
118 | + position: relative; | ||
119 | +} | ||
120 | + | ||
121 | +.billCss { | ||
122 | + width: 95%; | ||
123 | + position: absolute; | ||
124 | + background: #fff; | ||
125 | + left: 0; | ||
126 | + right: 0; | ||
127 | + margin: 0 auto; | ||
128 | + text-align: center; | ||
129 | + top: 5px; | ||
130 | + padding: 10px 10px 20px 10px; | ||
131 | + // height: 250px; | ||
132 | + box-shadow: 0px 0px 5px #FACFBA; | ||
109 | 133 | ||
110 | - .borderCss { | ||
111 | - width: 90%; | ||
112 | - height: 10px; | ||
113 | - background: #8A3A0E; | ||
114 | - border-radius: 15px; | ||
115 | - margin: 40px 10px 0 10px; | ||
116 | - position: relative; | ||
117 | - } | 134 | + .priceCss { |
135 | + font-size: 35px; | ||
136 | + margin: 10px 0; | ||
137 | + } | ||
138 | +} | ||
118 | 139 | ||
119 | - .billCss { | ||
120 | - width: 95%; | ||
121 | - position: absolute; | ||
122 | - background: #fff; | ||
123 | - left: 0; | ||
124 | - right: 0; | ||
125 | - margin: 0 auto; | ||
126 | - text-align: center; | ||
127 | - top: 5px; | ||
128 | - padding: 10px 10px 20px 10px; | ||
129 | - // height: 250px; | ||
130 | - box-shadow: 0px 0px 5px #FACFBA; | 140 | +.bomBtnCss { |
141 | + display: flex; | ||
142 | + justify-content: space-around; | ||
143 | + position: absolute; | ||
144 | + width: 100%; | ||
145 | + bottom: 20px; | ||
146 | +} | ||
131 | 147 | ||
132 | - .priceCss { | ||
133 | - font-size: 35px; | ||
134 | - margin: 10px 0; | ||
135 | - } | ||
136 | - } | ||
137 | - .bomBtnCss{ | ||
138 | - display: flex; | ||
139 | - justify-content: space-around; | ||
140 | - position: absolute; | ||
141 | - width: 100%; | ||
142 | - bottom: 20px; | ||
143 | - } | ||
144 | - /deep/ .bomBtnCss .u-button{ | ||
145 | - width: 135px; | ||
146 | - border-radius: 8px; | ||
147 | - } | 148 | +/deep/ .bomBtnCss .u-button { |
149 | + width: 135px; | ||
150 | + border-radius: 8px; | ||
151 | +} | ||
148 | </style> | 152 | </style> |
frontend/app-user/pages/home/placeOrder.vue
1 | <template> | 1 | <template> |
2 | - <view class="container"> | ||
3 | - <Navbar title="确认订单" canBack></Navbar> | ||
4 | - <!-- <u-navbar title="确认订单" autoBack :safeAreaInsetTop="true" placeholder fixed></u-navbar> --> | ||
5 | - <view class="orderCss"> | ||
6 | - <!-- <view class="orderTopBarCss"> | ||
7 | - <u-icon name="car" color="#fff" size="20"></u-icon> | ||
8 | - <view class="text-white"> | ||
9 | - 站内配送 | ||
10 | - </view> | ||
11 | - </view> --> | ||
12 | - <view class="addressBarCss" @click="selectAddress"> | ||
13 | - <view class="leftCss"> | ||
14 | - <u-icon name="map" size="25"></u-icon> | ||
15 | - </view> | ||
16 | - <view class="centerCss w50" v-if="hasAds"> | ||
17 | - <view class="margin-top"> | ||
18 | - 联系人:{{adsObj.name || ""}} | ||
19 | - </view> | ||
20 | - <view class="text-gray margin-top-sm text-sm w100 overflow-one-lines"> | ||
21 | - 详细地址:{{adsObj.address || ""}} | ||
22 | - </view> | ||
23 | - </view> | ||
24 | - <view class="centerCss" v-else> | ||
25 | - 请选择地址 | ||
26 | - </view> | ||
27 | - <view class="rightCss"> | ||
28 | - <u-icon name="arrow-right" size="20"></u-icon> | ||
29 | - </view> | ||
30 | - </view> | ||
31 | - <view class="shopCardCss"> | ||
32 | - <view class="flex align-center"> | ||
33 | - <u-icon name="/static/images/home/shopTitle.png" size="20"></u-icon> | ||
34 | - <view class="margin-left-xs"> | ||
35 | - {{gasDetail.fSsqymc || ""}} | ||
36 | - <!-- 利民液化气供应站 --> | ||
37 | - </view> | ||
38 | - </view> | ||
39 | - <view class="flex justify-between margin-top"> | ||
40 | - <view class=""> | ||
41 | - <u-image width="80px" height="80px" :src="gasDetail.image"></u-image> | ||
42 | - </view> | ||
43 | - <view class="flex flex-direction justify-between margin-left-sm"> | ||
44 | - <view class=""> | ||
45 | - {{gasDetail.fMc}} | ||
46 | - <!-- 15KG 液化石油气 --> | ||
47 | - </view> | ||
48 | - <view class="text-sm text-gray"> | ||
49 | - 描述:{{gasDetail.fMs || ""}} | ||
50 | - </view> | ||
51 | - <view class="themeColor text-lg text-bold"> | ||
52 | - ¥{{gasDetail.fJg}} | ||
53 | - </view> | ||
54 | - </view> | ||
55 | - <view class="flex align-end"> | ||
56 | - <u-number-box v-model="gasNumber" @change="gasNumberChange"></u-number-box> | ||
57 | - </view> | ||
58 | - </view> | ||
59 | - <view class="flex justify-between align-center margin-top"> | ||
60 | - <view class=""> | ||
61 | - 订单备注 | ||
62 | - </view> | ||
63 | - <view class="text-gray"> | ||
64 | - <u-input inputAlign="right" maxlength="30" v-model="orderBody.mjly" border="none" clearable | ||
65 | - placeholder="请填写您的备注信息"></u-input> | ||
66 | - </view> | ||
67 | - </view> | ||
68 | - </view> | 2 | + <view class="container"> |
3 | + <Navbar title="确认订单" canBack></Navbar> | ||
4 | + <!-- <u-navbar title="确认订单" autoBack :safeAreaInsetTop="true" placeholder fixed></u-navbar> --> | ||
5 | + <view class="orderCss"> | ||
6 | + <!-- <view class="orderTopBarCss"> | ||
7 | + <u-icon name="car" color="#fff" size="20"></u-icon> | ||
8 | + <view class="text-white"> | ||
9 | + 站内配送 | ||
10 | + </view> | ||
11 | + </view> --> | ||
12 | + <view class="addressBarCss" @click="selectAddress"> | ||
13 | + <view class="leftCss"> | ||
14 | + <u-icon name="map" size="25"></u-icon> | ||
15 | + </view> | ||
16 | + <view class="centerCss w50" v-if="hasAds"> | ||
17 | + <view class="margin-top"> | ||
18 | + 联系人:{{ adsObj.name || "" }} | ||
19 | + </view> | ||
20 | + <view class="text-gray margin-top-sm text-sm w100 overflow-one-lines"> | ||
21 | + 详细地址:{{ adsObj.address || "" }} | ||
22 | + </view> | ||
23 | + </view> | ||
24 | + <view class="centerCss" v-else> | ||
25 | + 请选择地址 | ||
26 | + </view> | ||
27 | + <view class="rightCss"> | ||
28 | + <u-icon name="arrow-right" size="20"></u-icon> | ||
29 | + </view> | ||
30 | + </view> | ||
31 | + <view class="shopCardCss"> | ||
32 | + <view class="flex align-center"> | ||
33 | + <u-icon name="/static/images/home/shopTitle.png" size="20"></u-icon> | ||
34 | + <view class="margin-left-xs"> | ||
35 | + {{ gasDetail.fSsqymc || "" }} | ||
36 | + <!-- 利民液化气供应站 --> | ||
37 | + </view> | ||
38 | + </view> | ||
39 | + <view class="flex justify-between margin-top"> | ||
40 | + <view class=""> | ||
41 | + <u-image width="80px" height="80px" :src="gasDetail.image"></u-image> | ||
42 | + </view> | ||
43 | + <view class="flex flex-direction justify-between margin-left-sm"> | ||
44 | + <view class=""> | ||
45 | + {{ gasDetail.fMc }} | ||
46 | + <!-- 15KG 液化石油气 --> | ||
47 | + </view> | ||
48 | + <view class="text-sm text-gray"> | ||
49 | + 描述:{{ gasDetail.fMs || "" }} | ||
50 | + </view> | ||
51 | + <view class="themeColor text-lg text-bold"> | ||
52 | + ¥{{ gasDetail.fJg }} | ||
53 | + </view> | ||
54 | + </view> | ||
55 | + <view class="flex align-end"> | ||
56 | + <u-number-box v-model="gasNumber" @change="gasNumberChange"></u-number-box> | ||
57 | + </view> | ||
58 | + </view> | ||
59 | + <view class="flex justify-between align-center margin-top"> | ||
60 | + <view class=""> | ||
61 | + 订单备注 | ||
62 | + </view> | ||
63 | + <view class="text-gray"> | ||
64 | + <u-input inputAlign="right" maxlength="30" v-model="orderBody.mjly" border="none" clearable | ||
65 | + placeholder="请填写您的备注信息"></u-input> | ||
66 | + </view> | ||
67 | + </view> | ||
68 | + </view> | ||
69 | 69 | ||
70 | - <view class="moneyCardCss"> | ||
71 | - <view class="flex justify-between"> | ||
72 | - <view class=""> | ||
73 | - 商品总金额 | ||
74 | - </view> | ||
75 | - <view class="themeColor"> | ||
76 | - ¥{{totalPrice}} | ||
77 | - </view> | ||
78 | - </view> | ||
79 | - <view class="flex justify-between margin-top"> | ||
80 | - <view class="text-gray"> | ||
81 | - 商品金额 | ||
82 | - </view> | ||
83 | - <view class=""> | ||
84 | - ¥{{gasDetail.fJg}} | ||
85 | - </view> | ||
86 | - </view> | ||
87 | - <!-- <view class="flex justify-between margin-top"> | ||
88 | - <view class="text-gray"> | ||
89 | - 气瓶押金 | ||
90 | - </view> | ||
91 | - <view class=""> | ||
92 | - ¥0.00 | ||
93 | - </view> | ||
94 | - </view> --> | ||
95 | - </view> | ||
96 | - <view class="bomBarCss"> | ||
97 | - <view class="themeColor themeFs"> | ||
98 | - ¥{{totalPrice}} | ||
99 | - </view> | ||
100 | - <view class="" @click="submitOrder"> | ||
101 | - <u-button color="#EA5504">提交订单</u-button> | ||
102 | - </view> | ||
103 | - </view> | ||
104 | - </view> | ||
105 | - </view> | 70 | + <view class="moneyCardCss"> |
71 | + <view class="flex justify-between"> | ||
72 | + <view class=""> | ||
73 | + 商品总金额 | ||
74 | + </view> | ||
75 | + <view class="themeColor"> | ||
76 | + ¥{{ totalPrice }} | ||
77 | + </view> | ||
78 | + </view> | ||
79 | + <view class="flex justify-between margin-top"> | ||
80 | + <view class="text-gray"> | ||
81 | + 商品金额 | ||
82 | + </view> | ||
83 | + <view class=""> | ||
84 | + ¥{{ gasDetail.fJg }} | ||
85 | + </view> | ||
86 | + </view> | ||
87 | + <!-- <view class="flex justify-between margin-top"> | ||
88 | + <view class="text-gray"> | ||
89 | + 气瓶押金 | ||
90 | + </view> | ||
91 | + <view class=""> | ||
92 | + ¥0.00 | ||
93 | + </view> | ||
94 | + </view> --> | ||
95 | + </view> | ||
96 | + <view class="bomBarCss"> | ||
97 | + <view class="themeColor themeFs"> | ||
98 | + ¥{{ totalPrice }} | ||
99 | + </view> | ||
100 | + <view class="" @click="submitOrder"> | ||
101 | + <u-button color="#EA5504">提交订单</u-button> | ||
102 | + </view> | ||
103 | + </view> | ||
104 | + </view> | ||
105 | + </view> | ||
106 | </template> | 106 | </template> |
107 | 107 | ||
108 | <script> | 108 | <script> |
109 | - import { | ||
110 | - mergeRecursive | ||
111 | - } from "@/utils/ruoyi"; | ||
112 | - import storage from '@/utils/storage' | ||
113 | - import { | ||
114 | - mapGetters | ||
115 | - } from 'vuex' | ||
116 | - export default { | ||
117 | - components: {}, | ||
118 | - props: { | 109 | +import { |
110 | + mergeRecursive | ||
111 | +} from "@/utils/ruoyi"; | ||
112 | +import storage from '@/utils/storage' | ||
113 | +import { | ||
114 | + mapGetters | ||
115 | +} from 'vuex' | ||
119 | 116 | ||
120 | - }, | ||
121 | - data() { | ||
122 | - return { | ||
123 | - orderBody: { | ||
124 | - // fBz: "", | ||
125 | - // fDdje: "", | ||
126 | - // fPsdz: "", | ||
127 | - // fQyid: "", | ||
128 | - // fCzid: "", | ||
129 | - ddly: "线上下单", | ||
130 | - zffs: "", | ||
131 | - psfs: "配送", | ||
132 | - mjly: "", | ||
133 | - hydzId: "", | ||
134 | - ddlx: "配送", | ||
135 | - sfhy: "是", | ||
136 | - xqList: [], | ||
137 | - }, | ||
138 | - adsObj: { | ||
139 | - name: "", | ||
140 | - address: "" | ||
141 | - }, | ||
142 | - qplist: { | ||
143 | - qplxId: "", | ||
144 | - sl: 1 | ||
145 | - }, | ||
146 | - totalPrice: 0, | ||
147 | - qpid: "", | ||
148 | - gasDetail: {}, | ||
149 | - gasNumber: 1, | ||
150 | - hasAds: false, | ||
151 | - adsId: "" | ||
152 | - } | ||
153 | - }, | ||
154 | - onLoad(data) { | ||
155 | - if (data.qpid) { | ||
156 | - this.qpid = data.qpid; | ||
157 | - this.qplist.qplxId = data.qpid; | ||
158 | - } | ||
159 | - if (data.adsId) { | ||
160 | - this.adsId = data.adsId; | ||
161 | - } | ||
162 | - }, | ||
163 | - async onShow() { | ||
164 | - await this.getGasDetail(); | ||
165 | - await this.getAdsDetail(); | ||
166 | - // this.$store.dispatch('GetDefaultAds').then(async (res) => { | ||
167 | - // console.log("是否默认地址",res); | ||
168 | - // if(res === 'Default'){ | ||
169 | - // } | ||
170 | - // }).catch(e => { | ||
171 | - // console.log("查询地址错误", e); | ||
172 | - // }); | ||
173 | - }, | ||
174 | - computed: { | ||
175 | - // ...mapGetters({ | ||
176 | - // adsId: 'adsId' | ||
177 | - // }) | ||
178 | - }, | ||
179 | - methods: { | ||
180 | - async getGasDetail() { | ||
181 | - let query = { | ||
182 | - id: this.qpid | ||
183 | - } | ||
184 | - const result = await this.$api.memberApi.getwQplxDetail(query); | ||
185 | - let { | ||
186 | - code, | ||
187 | - value | ||
188 | - } = result; | ||
189 | - if (code === 200) { | ||
190 | - this.gasDetail = value; | ||
191 | - // this.orderBody.fCzid = this.gasDetail.fSsczid; | ||
192 | - // this.orderBody.fQyid = this.gasDetail.fSsqyid; | ||
193 | - // this.orderBody.fDdje = this.gasDetail.fJg; | ||
194 | - this.totalPrice = this.gasDetail.fJg; | ||
195 | - let JsonParse = JSON.parse(this.gasDetail.fTp); | ||
196 | - this.gasDetail.image = await this.$getPhotoUrl(JsonParse[0].response.fileId); | ||
197 | - this.gasDetail = { | ||
198 | - ...this.gasDetail | ||
199 | - }; | ||
200 | - console.log('气瓶详情', JSON.parse(JSON.stringify(this.gasDetail))); | ||
201 | - } | ||
202 | - }, | ||
203 | - async getAdsDetail() { | ||
204 | - let that = this; | ||
205 | - let formData = { | ||
206 | - current: 1, | ||
207 | - size: 99 | ||
208 | - } | ||
209 | - const result = await this.$api.memberApi.getwHydzList(formData); | ||
210 | - let { | ||
211 | - code, | ||
212 | - value | ||
213 | - } = result; | ||
214 | - if (code === 200) { | ||
215 | - let data = value.records; | ||
216 | - const defaultAddress = data.find(item => item.fSfmrdz === 'y' || item.id === that.adsId); | ||
217 | - if (defaultAddress) { | ||
218 | - console.log("默认地址", defaultAddress); | ||
219 | - let area = defaultAddress.fLxrsf + defaultAddress.fLxrs + defaultAddress.fLxrq + defaultAddress | ||
220 | - .fLxrjd | ||
221 | - that.$set(that.orderBody, "hydzId", defaultAddress.id); | ||
222 | - that.$set(that.adsObj, "name", defaultAddress.fLxr); | ||
223 | - that.$set(that.adsObj, "address", area); | ||
224 | - // that.orderBody.hydzId = defaultAddress.id; | ||
225 | - // that.adsObj.name = defaultAddress.fLxr; | ||
226 | - // that.adsObj.address = area; | ||
227 | - that.hasAds = true; | ||
228 | - } else { | ||
229 | - that.orderBody.hydzId = ""; | ||
230 | - that.adsObj.name = ""; | ||
231 | - that.adsObj.address = ""; | ||
232 | - that.hasAds = false; | ||
233 | - } | ||
234 | - } | ||
235 | - }, | ||
236 | - gasNumberChange(e) { | ||
237 | - let number = e.value; | ||
238 | - let price = this.gasDetail.fJg; | ||
239 | - this.qplist.sl = number; | ||
240 | - this.totalPrice = this.$calcUtil.ride(price, number) | ||
241 | - }, | ||
242 | - selectAddress() { | ||
243 | - uni.navigateTo({ | ||
244 | - url: '/pages/mine/appList/addressManagement/addressManagement?qpid=' + this.qpid | ||
245 | - }) | ||
246 | - }, | ||
247 | - async submitOrder() { | ||
248 | - this.orderBody.xqList[0] = this.qplist; | ||
249 | - console.log("提交数据", this.orderBody); | ||
250 | - if (!this.orderBody.hydzId) { | ||
251 | - uni.$u.toast('未选择配送地址'); | ||
252 | - return false | ||
253 | - } | ||
254 | - this.$modal.confirm('确认提交订单?', '提示').then(async () => { | ||
255 | - // console.log("提交数据", this.orderBody); | ||
256 | - // uni.navigateTo({ | ||
257 | - // url:"/pages/home/orderSuccessful" | ||
258 | - // }) | ||
259 | - const result = await this.$api.memberApi.savewDd(this.orderBody); | ||
260 | - let { | ||
261 | - code, | ||
262 | - value | ||
263 | - } = result; | ||
264 | - if (code === 200) { | ||
265 | - uni.navigateTo({ | ||
266 | - url: "/pages/home/orderSuccessful?datas=" + JSON.stringify(value) | ||
267 | - }) | ||
268 | - } | ||
269 | - }).catch(() => { | ||
270 | - console.log("取消"); | ||
271 | - }); | ||
272 | - } | ||
273 | - } | ||
274 | - } | 117 | +export default { |
118 | + components: {}, | ||
119 | + props: {}, | ||
120 | + data() { | ||
121 | + return { | ||
122 | + orderBody: { | ||
123 | + // fBz: "", | ||
124 | + // fDdje: "", | ||
125 | + // fPsdz: "", | ||
126 | + // fQyid: "", | ||
127 | + // fCzid: "", | ||
128 | + ddly: "线上下单", | ||
129 | + zffs: "", | ||
130 | + psfs: "配送", | ||
131 | + mjly: "", | ||
132 | + hydzId: "", | ||
133 | + ddlx: "配送", | ||
134 | + sfhy: "是", | ||
135 | + xqList: [], | ||
136 | + }, | ||
137 | + adsObj: { | ||
138 | + name: "", | ||
139 | + address: "" | ||
140 | + }, | ||
141 | + qplist: { | ||
142 | + qplxId: "", | ||
143 | + sl: 1 | ||
144 | + }, | ||
145 | + totalPrice: 0, | ||
146 | + qpid: "", | ||
147 | + gasDetail: {}, | ||
148 | + gasNumber: 1, | ||
149 | + hasAds: false, | ||
150 | + adsId: "" | ||
151 | + } | ||
152 | + }, | ||
153 | + onLoad(data) { | ||
154 | + if (data.qpid) { | ||
155 | + this.qpid = data.qpid; | ||
156 | + this.qplist.qplxId = data.qpid; | ||
157 | + } | ||
158 | + if (data.adsId) { | ||
159 | + this.adsId = data.adsId; | ||
160 | + } | ||
161 | + }, | ||
162 | + async onShow() { | ||
163 | + await this.getGasDetail(); | ||
164 | + await this.getAdsDetail(); | ||
165 | + // this.$store.dispatch('GetDefaultAds').then(async (res) => { | ||
166 | + // console.log("是否默认地址",res); | ||
167 | + // if(res === 'Default'){ | ||
168 | + // } | ||
169 | + // }).catch(e => { | ||
170 | + // console.log("查询地址错误", e); | ||
171 | + // }); | ||
172 | + }, | ||
173 | + computed: { | ||
174 | + // ...mapGetters({ | ||
175 | + // adsId: 'adsId' | ||
176 | + // }) | ||
177 | + }, | ||
178 | + methods: { | ||
179 | + async getGasDetail() { | ||
180 | + let query = { | ||
181 | + id: this.qpid | ||
182 | + } | ||
183 | + const result = await this.$api.memberApi.getwQplxDetail(query); | ||
184 | + let { | ||
185 | + code, | ||
186 | + value | ||
187 | + } = result; | ||
188 | + if (code === 200) { | ||
189 | + this.gasDetail = value; | ||
190 | + // this.orderBody.fCzid = this.gasDetail.fSsczid; | ||
191 | + // this.orderBody.fQyid = this.gasDetail.fSsqyid; | ||
192 | + // this.orderBody.fDdje = this.gasDetail.fJg; | ||
193 | + this.totalPrice = this.gasDetail.fJg; | ||
194 | + let JsonParse = JSON.parse(this.gasDetail.fTp); | ||
195 | + this.gasDetail.image = await this.$getPhotoUrl(JsonParse[0].response.fileId); | ||
196 | + this.gasDetail = { | ||
197 | + ...this.gasDetail | ||
198 | + }; | ||
199 | + console.log('气瓶详情', JSON.parse(JSON.stringify(this.gasDetail))); | ||
200 | + } | ||
201 | + }, | ||
202 | + async getAdsDetail() { | ||
203 | + let that = this; | ||
204 | + let formData = { | ||
205 | + current: 1, | ||
206 | + size: 99 | ||
207 | + } | ||
208 | + const result = await this.$api.memberApi.getwHydzList(formData); | ||
209 | + let { | ||
210 | + code, | ||
211 | + value | ||
212 | + } = result; | ||
213 | + if (code === 200) { | ||
214 | + let data = value.records; | ||
215 | + const defaultAddress = data.find(item => item.fSfmrdz === 'y' || item.id === that.adsId); | ||
216 | + if (defaultAddress) { | ||
217 | + console.log("默认地址", defaultAddress); | ||
218 | + let area = defaultAddress.fLxrsf + defaultAddress.fLxrs + defaultAddress.fLxrq + defaultAddress | ||
219 | + .fLxrjd | ||
220 | + that.$set(that.orderBody, "hydzId", defaultAddress.id); | ||
221 | + that.$set(that.adsObj, "name", defaultAddress.fLxr); | ||
222 | + that.$set(that.adsObj, "address", area); | ||
223 | + // that.orderBody.hydzId = defaultAddress.id; | ||
224 | + // that.adsObj.name = defaultAddress.fLxr; | ||
225 | + // that.adsObj.address = area; | ||
226 | + that.hasAds = true; | ||
227 | + } else { | ||
228 | + that.orderBody.hydzId = ""; | ||
229 | + that.adsObj.name = ""; | ||
230 | + that.adsObj.address = ""; | ||
231 | + that.hasAds = false; | ||
232 | + } | ||
233 | + } | ||
234 | + }, | ||
235 | + gasNumberChange(e) { | ||
236 | + let number = e.value; | ||
237 | + let price = this.gasDetail.fJg; | ||
238 | + this.qplist.sl = number; | ||
239 | + this.totalPrice = this.$calcUtil.ride(price, number) | ||
240 | + }, | ||
241 | + selectAddress() { | ||
242 | + uni.navigateTo({ | ||
243 | + url: '/pages/mine/appList/addressManagement/addressManagement?qpid=' + this.qpid | ||
244 | + }) | ||
245 | + }, | ||
246 | + async submitOrder() { | ||
247 | + this.orderBody.xqList[0] = this.qplist; | ||
248 | + console.log("提交数据", this.orderBody); | ||
249 | + if (!this.orderBody.hydzId) { | ||
250 | + uni.$u.toast('未选择配送地址'); | ||
251 | + return false | ||
252 | + } | ||
253 | + this.$modal.confirm('确认提交订单?', '提示').then(async () => { | ||
254 | + // console.log("提交数据", this.orderBody); | ||
255 | + // uni.navigateTo({ | ||
256 | + // url:"/pages/home/orderSuccessful" | ||
257 | + // }) | ||
258 | + const result = await this.$api.memberApi.savewDd({...this.orderBody, zffs: '微信', zflx: 'JSAPI'}); | ||
259 | + let { | ||
260 | + code, | ||
261 | + value | ||
262 | + } = result; | ||
263 | + if (code === 200) { | ||
264 | + console.log('value--->',value); | ||
265 | + //在这里唤起支付 | ||
266 | + this.handlePayment(value); // 处理支付逻辑 | ||
267 | + } | ||
268 | + }).catch(() => { | ||
269 | + console.log("取消"); | ||
270 | + }); | ||
271 | + }, | ||
272 | + handlePayment(paymentData) { | ||
273 | + // 支付参数对象 | ||
274 | + const paymentParams = { | ||
275 | + appId: paymentData.payment.appId, | ||
276 | + timeStamp: paymentData.payment.timeStamp, | ||
277 | + nonceStr: paymentData.payment.nonceStr, | ||
278 | + package: paymentData.payment.packageValue, | ||
279 | + signType: paymentData.payment.signType, | ||
280 | + paySign: paymentData.payment.paySign | ||
281 | + }; | ||
282 | + // 调用微信支付 | ||
283 | + this.initWechatPay(paymentParams,paymentData); | ||
284 | + }, | ||
285 | + initWechatPay(paymentParams,paymentData) { | ||
286 | + if (typeof WeixinJSBridge == "undefined") { | ||
287 | + if (document.addEventListener) { | ||
288 | + document.addEventListener('WeixinJSBridgeReady', () => { | ||
289 | + this.onBridgeReady(paymentParams,paymentData); | ||
290 | + }, false); | ||
291 | + } else if (document.attachEvent) { | ||
292 | + document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(paymentParams,paymentData)); | ||
293 | + document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(paymentParams,paymentData)); | ||
294 | + } | ||
295 | + } else { | ||
296 | + this.onBridgeReady(paymentParams,paymentData); | ||
297 | + } | ||
298 | + }, | ||
299 | + onBridgeReady(paymentParams,paymentData) { | ||
300 | + WeixinJSBridge.invoke( | ||
301 | + 'getBrandWCPayRequest', | ||
302 | + paymentParams, | ||
303 | + res => { | ||
304 | + if (res.err_msg == "get_brand_wcpay_request:ok") { | ||
305 | + // 支付成功 | ||
306 | + console.log('支付成功',paymentParams); | ||
307 | + // 可以跳转到支付成功的页面 | ||
308 | + uni.navigateTo({ | ||
309 | + url: "/pages/home/orderSuccessful?datas=" + JSON.stringify({ddid:paymentData.ddid}) | ||
310 | + }); | ||
311 | + } else { | ||
312 | + // 支付失败 | ||
313 | + console.error('支付失败', res.err_msg); | ||
314 | + } | ||
315 | + } | ||
316 | + ); | ||
317 | + } | ||
318 | + } | ||
319 | +} | ||
275 | </script> | 320 | </script> |
276 | 321 | ||
277 | <style lang="scss" scoped> | 322 | <style lang="scss" scoped> |
278 | - .orderCss { | ||
279 | - // margin: 10px; | 323 | +.orderCss { |
324 | + // margin: 10px; | ||
280 | 325 | ||
281 | - .orderTopBarCss { | ||
282 | - background: #EA5504; | ||
283 | - height: 40px; | ||
284 | - border-radius: 10px 10px 0 0; | ||
285 | - display: flex; | ||
286 | - justify-content: center; | ||
287 | - align-items: center; | ||
288 | - } | 326 | + .orderTopBarCss { |
327 | + background: #EA5504; | ||
328 | + height: 40px; | ||
329 | + border-radius: 10px 10px 0 0; | ||
330 | + display: flex; | ||
331 | + justify-content: center; | ||
332 | + align-items: center; | ||
333 | + } | ||
289 | 334 | ||
290 | - .addressBarCss { | ||
291 | - position: relative; | ||
292 | - display: flex; | ||
293 | - justify-content: space-between; | ||
294 | - align-items: center; | ||
295 | - border-radius: 0 0 10px 10px; | ||
296 | - background: #ffffff; | ||
297 | - padding: 10px 10px 20px 10px; | 335 | + .addressBarCss { |
336 | + position: relative; | ||
337 | + display: flex; | ||
338 | + justify-content: space-between; | ||
339 | + align-items: center; | ||
340 | + border-radius: 0 0 10px 10px; | ||
341 | + background: #ffffff; | ||
342 | + padding: 10px 10px 20px 10px; | ||
298 | 343 | ||
299 | - .leftCss { | ||
300 | - width: 10%; | ||
301 | - } | 344 | + .leftCss { |
345 | + width: 10%; | ||
346 | + } | ||
302 | 347 | ||
303 | - .centerCss { | ||
304 | - width: 80%; | ||
305 | - min-height: 50px; | ||
306 | - margin-left: 5px; | ||
307 | - display: flex; | ||
308 | - flex-direction: column; | ||
309 | - justify-content: center; | ||
310 | - align-items: flex-start; | ||
311 | - } | 348 | + .centerCss { |
349 | + width: 80%; | ||
350 | + min-height: 50px; | ||
351 | + margin-left: 5px; | ||
352 | + display: flex; | ||
353 | + flex-direction: column; | ||
354 | + justify-content: center; | ||
355 | + align-items: flex-start; | ||
356 | + } | ||
312 | 357 | ||
313 | - .rightCss { | ||
314 | - width: 10%; | ||
315 | - } | ||
316 | - } | 358 | + .rightCss { |
359 | + width: 10%; | ||
360 | + } | ||
361 | + } | ||
317 | 362 | ||
318 | - .addressBarCss { | ||
319 | - background-color: #fff; | ||
320 | - position: relative; | ||
321 | - } | 363 | + .addressBarCss { |
364 | + background-color: #fff; | ||
365 | + position: relative; | ||
366 | + } | ||
322 | 367 | ||
323 | - .addressBarCss:before { | ||
324 | - position: absolute; | ||
325 | - right: 0; | ||
326 | - bottom: 0; | ||
327 | - left: 0; | ||
328 | - height: 5px; | ||
329 | - background: repeating-linear-gradient(-45deg, #A82831, #A82831 20%, transparent 0, transparent 25%, #254A81 0, #254A81 45%, transparent 0, transparent 50%); | ||
330 | - background-size: 200px; | ||
331 | - content: ""; | ||
332 | - } | 368 | + .addressBarCss:before { |
369 | + position: absolute; | ||
370 | + right: 0; | ||
371 | + bottom: 0; | ||
372 | + left: 0; | ||
373 | + height: 5px; | ||
374 | + background: repeating-linear-gradient(-45deg, #A82831, #A82831 20%, transparent 0, transparent 25%, #254A81 0, #254A81 45%, transparent 0, transparent 50%); | ||
375 | + background-size: 200px; | ||
376 | + content: ""; | ||
377 | + } | ||
333 | 378 | ||
334 | - .shopCardCss { | ||
335 | - margin: 10px; | ||
336 | - margin-top: 10px; | ||
337 | - padding: 20px 10px; | ||
338 | - border-radius: 15px; | ||
339 | - background: #ffffff; | ||
340 | - } | 379 | + .shopCardCss { |
380 | + margin: 10px; | ||
381 | + margin-top: 10px; | ||
382 | + padding: 20px 10px; | ||
383 | + border-radius: 15px; | ||
384 | + background: #ffffff; | ||
385 | + } | ||
341 | 386 | ||
342 | - .moneyCardCss { | ||
343 | - margin: 10px; | ||
344 | - padding: 20px 10px; | ||
345 | - border-radius: 15px; | ||
346 | - background: #ffffff; | ||
347 | - } | 387 | + .moneyCardCss { |
388 | + margin: 10px; | ||
389 | + padding: 20px 10px; | ||
390 | + border-radius: 15px; | ||
391 | + background: #ffffff; | ||
392 | + } | ||
348 | 393 | ||
349 | - .bomBarCss { | ||
350 | - position: absolute; | ||
351 | - width: 100%; | ||
352 | - bottom: 0; | ||
353 | - left: 0; | ||
354 | - padding: 0 20px; | ||
355 | - background: #fff; | ||
356 | - height: 50px; | ||
357 | - display: flex; | ||
358 | - justify-content: space-between; | ||
359 | - align-items: center; | ||
360 | - } | 394 | + .bomBarCss { |
395 | + position: absolute; | ||
396 | + width: 100%; | ||
397 | + bottom: 0; | ||
398 | + left: 0; | ||
399 | + padding: 0 20px; | ||
400 | + background: #fff; | ||
401 | + height: 50px; | ||
402 | + display: flex; | ||
403 | + justify-content: space-between; | ||
404 | + align-items: center; | ||
405 | + } | ||
361 | 406 | ||
362 | - /deep/.bomBarCss .u-button { | ||
363 | - border-radius: 10px !important; | ||
364 | - width: 120px; | ||
365 | - } | ||
366 | - } | ||
367 | -</style> | ||
368 | \ No newline at end of file | 407 | \ No newline at end of file |
408 | + /deep/ .bomBarCss .u-button { | ||
409 | + border-radius: 10px !important; | ||
410 | + width: 120px; | ||
411 | + } | ||
412 | +} | ||
413 | +</style> |