Merge branch 'develop' of git.yoho.cn:fe/xianyu-ufo-app-web into develop
Showing
35 changed files
with
627 additions
and
164 deletions
1 | +<template> | ||
2 | + <div class="canvas-container" ref="canvasContainer"> | ||
3 | + <canvas ref="countCanvas" | ||
4 | + id="countCircleCanvas" | ||
5 | + :width="canvasWidth" | ||
6 | + :height="canvasHeight" | ||
7 | + :time="time" | ||
8 | + :totalTime="totalTime" | ||
9 | + :lineWidth="lineWidth" | ||
10 | + ></canvas> | ||
11 | + </div> | ||
12 | + | ||
13 | +</template> | ||
14 | + | ||
15 | +<script> | ||
16 | + | ||
17 | +/** | ||
18 | + * 使用方法, 在对应页面引入CountCircle | ||
19 | + * <CountCircle :line-width="6" :time="time" :total-time="totalTime" @on-end="onTimeEnd" style="width: 70px; height: 70px; display: block;"></CountCircle> | ||
20 | + * 在自己的页面做定时器,修改time, | ||
21 | + */ | ||
22 | +export default { // 环形倒计时 | ||
23 | + name: 'CountCircle', | ||
24 | + props: { | ||
25 | + time: { | ||
26 | + type: Number, | ||
27 | + default: 60000 | ||
28 | + }, | ||
29 | + totalTime: { | ||
30 | + type: Number, | ||
31 | + default: 60000 | ||
32 | + }, | ||
33 | + lineWidth: { | ||
34 | + type: Number, | ||
35 | + default: 8 | ||
36 | + }, | ||
37 | + }, | ||
38 | + data() { | ||
39 | + return { | ||
40 | + canvas: null, | ||
41 | + context: null, | ||
42 | + interval: 100, | ||
43 | + circle: { | ||
44 | + x: 0, | ||
45 | + y: 0, | ||
46 | + radius: 0 | ||
47 | + }, | ||
48 | + canvasWidth: 200, | ||
49 | + canvasHeight: 200, | ||
50 | + pixelRatio: 2, | ||
51 | + }; | ||
52 | + }, | ||
53 | + mounted() { | ||
54 | + this.resetCanvas(); | ||
55 | + this.draw(); | ||
56 | + }, | ||
57 | + computed: { | ||
58 | + canvasLineWidth() { | ||
59 | + return this.lineWidth * this.pixelRatio; | ||
60 | + } | ||
61 | + }, | ||
62 | + methods: { | ||
63 | + resetCanvas() { | ||
64 | + this.canvas = this.$refs.countCanvas; | ||
65 | + if (window.devicePixelRatio) { | ||
66 | + this.pixelRatio = window.devicePixelRatio; | ||
67 | + } | ||
68 | + | ||
69 | + this.canvasWidth = this.$refs.canvasContainer.getBoundingClientRect().width * this.pixelRatio || 200; | ||
70 | + this.canvasHeight = this.$refs.canvasContainer.getBoundingClientRect().height * this.pixelRatio || 200; | ||
71 | + this.context = this.canvas.getContext('2d'); | ||
72 | + | ||
73 | + this.circle = { | ||
74 | + x: this.canvasWidth / 2, | ||
75 | + y: this.canvasHeight / 2, | ||
76 | + radius: this.canvasWidth / 2 | ||
77 | + }; | ||
78 | + }, | ||
79 | + drawCircle() { | ||
80 | + if (this.canvas && this.context) { | ||
81 | + let ctx = this.context; | ||
82 | + | ||
83 | + ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); | ||
84 | + ctx.save(); | ||
85 | + ctx.beginPath(); | ||
86 | + ctx.strokeStyle = 'rgba(2, 42, 71, 1)'; | ||
87 | + ctx.lineCap = 'round'; | ||
88 | + ctx.lineWidth = this.canvasLineWidth - 2; | ||
89 | + ctx.arc(this.circle.x, this.circle.y, (this.circle.radius - this.canvasLineWidth / 2), -Math.PI / 2, (Math.PI + Math.PI / 2), false); | ||
90 | + ctx.stroke(); | ||
91 | + ctx.closePath(); | ||
92 | + ctx.restore(); | ||
93 | + } | ||
94 | + }, | ||
95 | + strokeCircle(percent) { | ||
96 | + if (this.canvas && this.context) { | ||
97 | + this.drawCircle(); | ||
98 | + | ||
99 | + let ctx = this.context; | ||
100 | + | ||
101 | + if (percent > 0) { | ||
102 | + ctx.save(); | ||
103 | + ctx.strokeStyle = '#f0f0f0'; | ||
104 | + ctx.lineCap = 'square'; | ||
105 | + ctx.lineWidth = this.canvasLineWidth; | ||
106 | + | ||
107 | + ctx.beginPath(); | ||
108 | + ctx.arc(this.circle.x, this.circle.y, (this.circle.radius - this.canvasLineWidth / 2), -Math.PI / 2, Math.PI * ( 2 * percent - 0.5), false); | ||
109 | + ctx.stroke(); | ||
110 | + ctx.closePath(); | ||
111 | + ctx.restore(); | ||
112 | + } | ||
113 | + | ||
114 | + ctx.save(); | ||
115 | + ctx.font = 'bold ' + 20 * this.pixelRatio + 'px "ufofont"'; | ||
116 | + ctx.fillStyle = '#022A47'; | ||
117 | + ctx.textAlign = 'center'; | ||
118 | + ctx.textBaseline = 'middle'; | ||
119 | + ctx.fillText(Math.round(this.time / 1000) + 's', this.circle.x, this.circle.y); | ||
120 | + ctx.restore(); | ||
121 | + | ||
122 | + setTimeout(this.draw.bind(this), this.interval); | ||
123 | + } | ||
124 | + }, | ||
125 | + draw() { | ||
126 | + if (this.time > 0) { | ||
127 | + let percent = 1 - this.time / this.totalTime; | ||
128 | + | ||
129 | + this.strokeCircle(percent); | ||
130 | + } else { | ||
131 | + this.$emit('on-end'); | ||
132 | + } | ||
133 | + } | ||
134 | + } | ||
135 | +}; | ||
136 | +</script> | ||
137 | + | ||
138 | +<style lang="scss" scoped> | ||
139 | + .canvas-container { | ||
140 | + display: block; | ||
141 | + width: 100%; | ||
142 | + margin: 44px auto; | ||
143 | + | ||
144 | + canvas { | ||
145 | + position: relative; | ||
146 | + width: 100%; | ||
147 | + height: 100%; | ||
148 | + } | ||
149 | + | ||
150 | + p { | ||
151 | + text-align: center; | ||
152 | + font-weight: 600; | ||
153 | + font-size: 28px; | ||
154 | + white-space: nowrap; | ||
155 | + } | ||
156 | + } | ||
157 | + | ||
158 | +</style> |
apps/components/count-circle/index.js
0 → 100644
@@ -3,11 +3,13 @@ import LayoutHeader from './layout/layout-header'; | @@ -3,11 +3,13 @@ import LayoutHeader from './layout/layout-header'; | ||
3 | import LayoutLink from './layout/layout-link'; | 3 | import LayoutLink from './layout/layout-link'; |
4 | import Images from './images'; | 4 | import Images from './images'; |
5 | import YohoButton from './button'; | 5 | import YohoButton from './button'; |
6 | +import CountCircle from './count-circle'; | ||
6 | 7 | ||
7 | export default [ | 8 | export default [ |
8 | LayoutApp, | 9 | LayoutApp, |
9 | LayoutHeader, | 10 | LayoutHeader, |
10 | LayoutLink, | 11 | LayoutLink, |
11 | ...Images, | 12 | ...Images, |
12 | - YohoButton | 13 | + YohoButton, |
14 | + ...CountCircle | ||
13 | ]; | 15 | ]; |
@@ -52,7 +52,7 @@ Vue.use(ConfirmDialog); | @@ -52,7 +52,7 @@ Vue.use(ConfirmDialog); | ||
52 | initClient(store); | 52 | initClient(store); |
53 | 53 | ||
54 | yoho.auth = async loginUrl => { | 54 | yoho.auth = async loginUrl => { |
55 | - let user = await sdk.getUser(); | 55 | + let user = await sdk.getUser(true); |
56 | 56 | ||
57 | if (user && user.uid) { | 57 | if (user && user.uid) { |
58 | return user; | 58 | return user; |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <LayoutApp :show-back="true" :hide-header="hideHeader"> | 2 | <LayoutApp :show-back="true" :hide-header="hideHeader"> |
3 | <div class="scroll-list-wrap"> | 3 | <div class="scroll-list-wrap"> |
4 | <template v-if="isShow"> | 4 | <template v-if="isShow"> |
5 | - <div v-for="(item, index) in channelList.list" v-if="item.template_name == 'guessLike'"> | 5 | + <div v-for="(item, index) in channelList.list" :key="index" v-if="item.template_name == 'guessLike'"> |
6 | <ScrollNav :list="item.data" :current="active"></ScrollNav> | 6 | <ScrollNav :list="item.data" :current="active"></ScrollNav> |
7 | </div> | 7 | </div> |
8 | </template> | 8 | </template> |
@@ -16,6 +16,9 @@ | @@ -16,6 +16,9 @@ | ||
16 | <div class="body" ref="body"> | 16 | <div class="body" ref="body"> |
17 | <div class="channel-top"></div> | 17 | <div class="channel-top"></div> |
18 | <div class="marginTop"> | 18 | <div class="marginTop"> |
19 | + <div class="channel-html"> | ||
20 | + <img src="../../../statics/image/channel/server.png" alt="" /> | ||
21 | + </div> | ||
19 | <div v-for="(item, index) in channelList.list" :key="index" class="space-between"> | 22 | <div v-for="(item, index) in channelList.list" :key="index" class="space-between"> |
20 | <Swiper :list="item.data" v-if="item.template_name == 'threePicture'"/> | 23 | <Swiper :list="item.data" v-if="item.template_name == 'threePicture'"/> |
21 | <Hot :list="item.data" v-if="item.template_name == 'image_list'"/> | 24 | <Hot :list="item.data" v-if="item.template_name == 'image_list'"/> |
@@ -146,7 +149,7 @@ export default { | @@ -146,7 +149,7 @@ export default { | ||
146 | } | 149 | } |
147 | 150 | ||
148 | .marginTop { | 151 | .marginTop { |
149 | - margin-top: -150px; | 152 | + margin-top: -260px; |
150 | } | 153 | } |
151 | 154 | ||
152 | .scroll-app { | 155 | .scroll-app { |
@@ -199,7 +202,14 @@ export default { | @@ -199,7 +202,14 @@ export default { | ||
199 | left: 0; | 202 | left: 0; |
200 | z-index: 999; | 203 | z-index: 999; |
201 | } | 204 | } |
202 | -.marginTop { | ||
203 | - // margin-top: 64px; | 205 | + |
206 | +.channel-html { | ||
207 | + padding: 0 80px; | ||
208 | + margin-bottom: 20px; | ||
209 | + img { | ||
210 | + width: 100%; | ||
211 | + display: block; | ||
212 | + } | ||
204 | } | 213 | } |
214 | + | ||
205 | </style> | 215 | </style> |
@@ -2,19 +2,19 @@ | @@ -2,19 +2,19 @@ | ||
2 | <LayoutApp> | 2 | <LayoutApp> |
3 | <div class="tab"> | 3 | <div class="tab"> |
4 | <div class="item right-line" :class="type ==='unused' ? 'item-selected' : 'item-default'" | 4 | <div class="item right-line" :class="type ==='unused' ? 'item-selected' : 'item-default'" |
5 | - @click="onChangeList('unused')">未使用{{unused.length && '('+ unused.length + ')'}} | 5 | + @click="onChangeList('unused')">未使用{{unused.total && '('+ unused.total + ')'}} |
6 | </div> | 6 | </div> |
7 | <div class="item right-line" :class="type ==='used' ? 'item-selected' : 'item-default'" | 7 | <div class="item right-line" :class="type ==='used' ? 'item-selected' : 'item-default'" |
8 | - @click="onChangeList('used')">已使用{{used.length && '('+ used.length + ')'}} | 8 | + @click="onChangeList('used')">已使用{{used.total && '('+ used.total + ')'}} |
9 | </div> | 9 | </div> |
10 | <div class="item" :class="type ==='overtime' ? 'item-selected' : 'item-default'" | 10 | <div class="item" :class="type ==='overtime' ? 'item-selected' : 'item-default'" |
11 | - @click="onChangeList('overtime')">已失效{{overtime.length && '('+ overtime.length + ')'}} | 11 | + @click="onChangeList('overtime')">已失效{{overtime.total && '('+ overtime.total + ')'}} |
12 | </div> | 12 | </div> |
13 | </div> | 13 | </div> |
14 | <Scroll class="coupon-list" | 14 | <Scroll class="coupon-list" |
15 | :options="scrollOptions" | 15 | :options="scrollOptions" |
16 | :data="list" | 16 | :data="list" |
17 | - @pulling-up="onPullingUp"> | 17 | + @pulling-up="onPullingUp" v-show="!showEmpty"> |
18 | <div class="item" v-for="(item,index) in list"> | 18 | <div class="item" v-for="(item,index) in list"> |
19 | <div :class="type === 'unused' ? 'item-bg' : 'item-gray-bg'"> | 19 | <div :class="type === 'unused' ? 'item-bg' : 'item-gray-bg'"> |
20 | <div class="item-left"> | 20 | <div class="item-left"> |
@@ -27,14 +27,32 @@ | @@ -27,14 +27,32 @@ | ||
27 | {{item.coupon_name}} | 27 | {{item.coupon_name}} |
28 | </div> | 28 | </div> |
29 | <div class="item-time" :class="type !== 'unused' && 'gray'">{{item.coupon_validity}}</div> | 29 | <div class="item-time" :class="type !== 'unused' && 'gray'">{{item.coupon_validity}}</div> |
30 | - <div class="item-desc-btn" :class="type !== 'unused' && 'gray'">使用说明</div> | 30 | + <div class="item-desc-btn" v-show="type === 'unused'" @click="handleShowNotice(item,index)"> |
31 | + 使用说明 | ||
32 | + <div class="down" :class="item.showNotice && 'up'"></div> | ||
33 | + </div> | ||
31 | <div class="time-up" v-if="item.is_expired_soon === 'Y'"></div> | 34 | <div class="time-up" v-if="item.is_expired_soon === 'Y'"></div> |
32 | <div class="item-used-flag" v-if="type === 'used'"></div> | 35 | <div class="item-used-flag" v-if="type === 'used'"></div> |
33 | <div class="item-overtime-flag" v-if="type === 'overtime'"></div> | 36 | <div class="item-overtime-flag" v-if="type === 'overtime'"></div> |
34 | </div> | 37 | </div> |
35 | </div> | 38 | </div> |
39 | + <div class="notice" v-show="item.showNotice"> | ||
40 | + <div class="shadow"></div> | ||
41 | + <div v-for="no in item.notes" class="row"> | ||
42 | + <div class="mr10">•</div> | ||
43 | + <div class="no-text">{{no}}</div> | ||
44 | + </div> | ||
45 | + </div> | ||
36 | </div> | 46 | </div> |
37 | </Scroll> | 47 | </Scroll> |
48 | + <div | ||
49 | + class="empty-wrapper" | ||
50 | + v-show="showEmpty" | ||
51 | + > | ||
52 | + <div class="couponErrorPageImage"></div> | ||
53 | + 暂无优惠券 | ||
54 | + | ||
55 | + </div> | ||
38 | </LayoutApp> | 56 | </LayoutApp> |
39 | </template> | 57 | </template> |
40 | 58 | ||
@@ -42,15 +60,18 @@ | @@ -42,15 +60,18 @@ | ||
42 | 60 | ||
43 | import {Scroll} from 'cube-ui'; | 61 | import {Scroll} from 'cube-ui'; |
44 | import {createNamespacedHelpers} from 'vuex'; | 62 | import {createNamespacedHelpers} from 'vuex'; |
63 | +import EmptyList from "../../../components/ufo-no-item"; | ||
45 | 64 | ||
46 | const {mapState, mapActions} = createNamespacedHelpers('home/coupon'); | 65 | const {mapState, mapActions} = createNamespacedHelpers('home/coupon'); |
47 | 66 | ||
48 | export default { | 67 | export default { |
49 | name: 'Coupon', | 68 | name: 'Coupon', |
50 | - components: {Scroll}, | 69 | + components: {Scroll,EmptyList}, |
51 | activated: function() { | 70 | activated: function() { |
52 | - this.fetchCouponList({type: 'unused', isReset: true}).then(r => { | 71 | + this.type = 'unused'; |
72 | + this.fetchCouponList({type: 'unused', isReset: true}).then(r=>{ | ||
53 | this.list = r; | 73 | this.list = r; |
74 | + this.showEmpty = !(r && r.length); | ||
54 | }); | 75 | }); |
55 | this.fetchCouponList({type: 'used', isReset: true}); | 76 | this.fetchCouponList({type: 'used', isReset: true}); |
56 | this.fetchCouponList({type: 'overtime', isReset: true}); | 77 | this.fetchCouponList({type: 'overtime', isReset: true}); |
@@ -64,7 +85,8 @@ export default { | @@ -64,7 +85,8 @@ export default { | ||
64 | pullUpLoad: true | 85 | pullUpLoad: true |
65 | }, | 86 | }, |
66 | type: 'unused', | 87 | type: 'unused', |
67 | - list: [] | 88 | + list: [], |
89 | + showEmpty: false, | ||
68 | }; | 90 | }; |
69 | }, | 91 | }, |
70 | methods: { | 92 | methods: { |
@@ -76,10 +98,21 @@ export default { | @@ -76,10 +98,21 @@ export default { | ||
76 | 98 | ||
77 | // 切换list | 99 | // 切换list |
78 | this.list = this[type].list; | 100 | this.list = this[type].list; |
101 | + this.showEmpty = this[type].isEmpty; | ||
102 | + }, | ||
103 | + | ||
104 | + handleShowNotice(item, index) { | ||
105 | + if (item.showNotice !== void(0)) { | ||
106 | + item.showNotice = !item.showNotice; | ||
107 | + } else { | ||
108 | + item.showNotice = true; | ||
109 | + } | ||
110 | + this.$set(this.list, index, item); | ||
79 | }, | 111 | }, |
80 | 112 | ||
81 | async onPullingUp() { | 113 | async onPullingUp() { |
82 | this.list = await this.fetchCouponList({type: this.type}); | 114 | this.list = await this.fetchCouponList({type: this.type}); |
115 | + this.showEmpty = this[this.type].isEmpty; | ||
83 | }, | 116 | }, |
84 | 117 | ||
85 | }, | 118 | }, |
@@ -91,11 +124,14 @@ export default { | @@ -91,11 +124,14 @@ export default { | ||
91 | 124 | ||
92 | <style lang="scss" scoped> | 125 | <style lang="scss" scoped> |
93 | .tab { | 126 | .tab { |
127 | + position: relative; | ||
94 | display: flex; | 128 | display: flex; |
95 | width: 100%; | 129 | width: 100%; |
96 | height: 88px; | 130 | height: 88px; |
97 | padding: 14px 0; | 131 | padding: 14px 0; |
98 | align-items: center; | 132 | align-items: center; |
133 | + z-index: 9999; | ||
134 | + background: #fff; | ||
99 | 135 | ||
100 | .item { | 136 | .item { |
101 | font-size: 28px; | 137 | font-size: 28px; |
@@ -106,7 +142,7 @@ export default { | @@ -106,7 +142,7 @@ export default { | ||
106 | } | 142 | } |
107 | 143 | ||
108 | .right-line { | 144 | .right-line { |
109 | - border-left: 1px solid #E0E0E0; | 145 | + border-right: 1px solid #E0E0E0; |
110 | } | 146 | } |
111 | 147 | ||
112 | .item-default { | 148 | .item-default { |
@@ -134,6 +170,33 @@ export default { | @@ -134,6 +170,33 @@ export default { | ||
134 | margin: 0 auto; | 170 | margin: 0 auto; |
135 | display: flex; | 171 | display: flex; |
136 | position: relative; | 172 | position: relative; |
173 | + z-index: 10; | ||
174 | + } | ||
175 | + | ||
176 | + .down { | ||
177 | + transform: rotate(0deg); | ||
178 | + background: url(~statics/image/coupon/down@3x.png) no-repeat; | ||
179 | + background-size: contain; | ||
180 | + width: 20px; | ||
181 | + height: 20px; | ||
182 | + margin-left: 10px; | ||
183 | + margin-top: 4px; | ||
184 | + } | ||
185 | + | ||
186 | + .up { | ||
187 | + margin-top: -8px !important; | ||
188 | + transform: rotate(180deg); | ||
189 | + } | ||
190 | + | ||
191 | + .shadow { | ||
192 | + opacity: 0.7; | ||
193 | + background: #fff; | ||
194 | + position: absolute; | ||
195 | + top: 0; | ||
196 | + left: 0; | ||
197 | + height: 2px; | ||
198 | + width: 702px; | ||
199 | + box-shadow: #ddd 0 1px 10px 10px; | ||
137 | } | 200 | } |
138 | 201 | ||
139 | .item-left { | 202 | .item-left { |
@@ -162,6 +225,11 @@ export default { | @@ -162,6 +225,11 @@ export default { | ||
162 | font-size: 24px; | 225 | font-size: 24px; |
163 | color: #222; | 226 | color: #222; |
164 | margin-top: 22px; | 227 | margin-top: 22px; |
228 | + width: 320px; | ||
229 | + -webkit-line-clamp: 1; | ||
230 | + -webkit-box-orient: vertical; | ||
231 | + word-break: break-all; | ||
232 | + overflow: hidden; | ||
165 | } | 233 | } |
166 | 234 | ||
167 | .item-type { | 235 | .item-type { |
@@ -174,10 +242,12 @@ export default { | @@ -174,10 +242,12 @@ export default { | ||
174 | color: #999; | 242 | color: #999; |
175 | } | 243 | } |
176 | 244 | ||
177 | - .item-desc-btn{ | 245 | + .item-desc-btn { |
178 | margin-top: 26px; | 246 | margin-top: 26px; |
179 | font-size: 22px; | 247 | font-size: 22px; |
180 | color: #999; | 248 | color: #999; |
249 | + display: flex; | ||
250 | + align-items: center; | ||
181 | } | 251 | } |
182 | 252 | ||
183 | .time-up { | 253 | .time-up { |
@@ -212,7 +282,7 @@ export default { | @@ -212,7 +282,7 @@ export default { | ||
212 | } | 282 | } |
213 | 283 | ||
214 | .gray { | 284 | .gray { |
215 | - color: #ccc; | 285 | + color: #ccc !important; |
216 | } | 286 | } |
217 | 287 | ||
218 | .item-gray-bg { | 288 | .item-gray-bg { |
@@ -223,6 +293,52 @@ export default { | @@ -223,6 +293,52 @@ export default { | ||
223 | margin: 0 auto; | 293 | margin: 0 auto; |
224 | display: flex; | 294 | display: flex; |
225 | position: relative; | 295 | position: relative; |
296 | + z-index: 10; | ||
297 | + } | ||
298 | + | ||
299 | + .notice { | ||
300 | + opacity: 0.7; | ||
301 | + background: #fff; | ||
302 | + margin: -10px 20px 0 20px; | ||
303 | + padding: 36px 26px 26px 26px; | ||
304 | + position: relative; | ||
305 | + | ||
306 | + .mr10 { | ||
307 | + margin-right: 10px; | ||
308 | + } | ||
309 | + | ||
310 | + .row { | ||
311 | + display: flex; | ||
312 | + margin-bottom: 8px; | ||
313 | + } | ||
314 | + | ||
315 | + .no-text { | ||
316 | + font-size: 22px; | ||
317 | + color: #444; | ||
318 | + } | ||
319 | + } | ||
226 | } | 320 | } |
321 | + | ||
322 | + .empty-wrapper { | ||
323 | + width: 100%; | ||
324 | + margin: auto 0; | ||
325 | + position: absolute; | ||
326 | + top: 0; | ||
327 | + bottom: 0; | ||
328 | + background: #f5f5f5; | ||
329 | + display: flex; | ||
330 | + justify-content: center; | ||
331 | + align-items: center; | ||
332 | + flex-direction: column; | ||
333 | + font-size: 28px; | ||
334 | + color: #b0b0b0; | ||
335 | + } | ||
336 | + | ||
337 | + .couponErrorPageImage { | ||
338 | + background: url(~statics/image/coupon/no_coupon.png) no-repeat; | ||
339 | + background-size: cover; | ||
340 | + width: 208px; | ||
341 | + height: 130px; | ||
342 | + margin-bottom: 30px; | ||
227 | } | 343 | } |
228 | </style> | 344 | </style> |
1 | <template> | 1 | <template> |
2 | <LayoutApp :show-back="true" :title="title"> | 2 | <LayoutApp :show-back="true" :title="title"> |
3 | - <Scroll :scrollEvents="['scroll']" :options="scrollOptions" @scroll="scroll" | 3 | + <Scroll :scroll-events="['scroll-end','scroll']" |
4 | + @scroll-end="fetchList" | ||
4 | v-if="favoriteProductList.list.length" | 5 | v-if="favoriteProductList.list.length" |
5 | - @pulling-up="onPullingUp"> | 6 | + > |
6 | <ProductList :list="favoriteProductList.list"></ProductList> | 7 | <ProductList :list="favoriteProductList.list"></ProductList> |
7 | </Scroll> | 8 | </Scroll> |
8 | <!-- <empty-list v-show="!isShowEmpty" /> --> | 9 | <!-- <empty-list v-show="!isShowEmpty" /> --> |
@@ -42,20 +43,23 @@ export default { | @@ -42,20 +43,23 @@ export default { | ||
42 | this.fetchFavoriteList(); | 43 | this.fetchFavoriteList(); |
43 | }, | 44 | }, |
44 | methods: { | 45 | methods: { |
45 | - ...mapActions(['fetchFavoriteList','isShowEmpty']), | 46 | + ...mapActions(['fetchFavoriteList','isMore']), |
46 | 47 | ||
47 | - async onPullingUp() { | 48 | + async fetchList() { |
49 | + if(isMore){ | ||
48 | await this.fetchFavoriteList(); | 50 | await this.fetchFavoriteList(); |
51 | + } | ||
52 | + | ||
49 | }, | 53 | }, |
50 | - scroll({ y }) { | ||
51 | - const height = this.$refs.banner.$el.offsetHeight + this.$refs.header.offsetHeight; | 54 | + // scroll({ y }) { |
55 | + // const height = this.$refs.banner.$el.offsetHeight + this.$refs.header.offsetHeight; | ||
52 | 56 | ||
53 | - if (-y >= height) { | ||
54 | - this.fixed = true; | ||
55 | - } else { | ||
56 | - this.fixed = false; | ||
57 | - } | ||
58 | - } | 57 | + // if (-y >= height) { |
58 | + // this.fixed = true; | ||
59 | + // } else { | ||
60 | + // this.fixed = false; | ||
61 | + // } | ||
62 | + // } | ||
59 | }, | 63 | }, |
60 | 64 | ||
61 | computed: { | 65 | computed: { |
@@ -24,7 +24,7 @@ export default { | @@ -24,7 +24,7 @@ export default { | ||
24 | ...mapState( | 24 | ...mapState( |
25 | { | 25 | { |
26 | amountPart1: (state) => { | 26 | amountPart1: (state) => { |
27 | - return (''+state.userWalletInfo.walletAmount).split('.')[0] | 27 | + return (''+state.userWalletInfo.walletAmount).split('.')[0].split('¥')[1] |
28 | }, | 28 | }, |
29 | amountPart2: (state) => { | 29 | amountPart2: (state) => { |
30 | return (''+state.userWalletInfo.walletAmount).split('.')[1] | 30 | return (''+state.userWalletInfo.walletAmount).split('.')[1] |
@@ -7,6 +7,75 @@ import Coupon from './coupon'; | @@ -7,6 +7,75 @@ import Coupon from './coupon'; | ||
7 | 7 | ||
8 | export default [ | 8 | export default [ |
9 | { | 9 | { |
10 | + name: 'IndexPage', | ||
11 | + path: '/xianyu/index', | ||
12 | + component: () => import(/* webpackChunkName: "index" */ './indexPage/index-page'), | ||
13 | + redirect: { name: 'ChannelPage' }, | ||
14 | + props: (route) => { | ||
15 | + switch (route.name) { | ||
16 | + case 'ChannelPage': { | ||
17 | + return { | ||
18 | + tabIndex: 0 | ||
19 | + }; | ||
20 | + } | ||
21 | + case 'CategoryPage': { | ||
22 | + return { | ||
23 | + tabIndex: 1 | ||
24 | + }; | ||
25 | + } | ||
26 | + case 'NewsPage': { | ||
27 | + return { | ||
28 | + tabIndex: 2 | ||
29 | + }; | ||
30 | + } | ||
31 | + case 'MinePage': { | ||
32 | + return { | ||
33 | + tabIndex: 3 | ||
34 | + }; | ||
35 | + } | ||
36 | + default: { | ||
37 | + return { | ||
38 | + tabIndex: 0 | ||
39 | + }; | ||
40 | + } | ||
41 | + } | ||
42 | + }, | ||
43 | + children: [ | ||
44 | + { | ||
45 | + name: 'ChannelPage', | ||
46 | + path: 'channel', | ||
47 | + component: () => import(/* webpackChunkName: "index" */ './channel/channel'), | ||
48 | + props: () => ({ | ||
49 | + hideHeader: true, | ||
50 | + }), | ||
51 | + }, | ||
52 | + { | ||
53 | + name: 'CategoryPage', | ||
54 | + path: 'category', | ||
55 | + component: () => import(/* webpackChunkName: "index" */ '../category/category'), | ||
56 | + props: () => ({ | ||
57 | + hideHeader: true, | ||
58 | + }), | ||
59 | + }, | ||
60 | + { | ||
61 | + name: 'NewsPage', | ||
62 | + path: 'news', | ||
63 | + component: () => import(/* webpackChunkName: "index" */ './news/news'), | ||
64 | + props: () => ({ | ||
65 | + hideHeader: true, | ||
66 | + }), | ||
67 | + }, | ||
68 | + { | ||
69 | + name: 'MinePage', | ||
70 | + path: 'mine', | ||
71 | + component: () => import(/* webpackChunkName: "index" */ './mine/mine'), | ||
72 | + props: () => ({ | ||
73 | + hideHeader: true, | ||
74 | + }), | ||
75 | + }, | ||
76 | + ] | ||
77 | + }, | ||
78 | + { | ||
10 | name: 'channel', | 79 | name: 'channel', |
11 | path: '/xianyu/channel', | 80 | path: '/xianyu/channel', |
12 | component: () => import(/* webpackChunkName: "channel" */ './channel/channel') | 81 | component: () => import(/* webpackChunkName: "channel" */ './channel/channel') |
@@ -7,6 +7,6 @@ export default [ | @@ -7,6 +7,6 @@ export default [ | ||
7 | { | 7 | { |
8 | name: 'newsDetail', | 8 | name: 'newsDetail', |
9 | path: '/xianyu/newsDetail', | 9 | path: '/xianyu/newsDetail', |
10 | - component: () => import(/* webpackChunkName: "newsDetail" */ './newsDetail') | 10 | + component: () => import(/* webpackChunkName: "newsDetail" */ './newsDetail'), |
11 | } | 11 | } |
12 | ]; | 12 | ]; |
@@ -5,10 +5,10 @@ | @@ -5,10 +5,10 @@ | ||
5 | ref="scroll" | 5 | ref="scroll" |
6 | :options="options" | 6 | :options="options" |
7 | @pulling-up="onPullingUp" | 7 | @pulling-up="onPullingUp" |
8 | - :data="newsList.list"> | 8 | + :data="newsDeatilList.list"> |
9 | <div class="news-content"> | 9 | <div class="news-content"> |
10 | <Title :title="title"></Title> | 10 | <Title :title="title"></Title> |
11 | - <List :list="newsList && newsList.list || []" :isTitle="false"></List> | 11 | + <List :list="newsDeatilList && newsDeatilList.list || []" :isTitle="false"></List> |
12 | </div> | 12 | </div> |
13 | </Scroll> | 13 | </Scroll> |
14 | </div> | 14 | </div> |
@@ -36,7 +36,7 @@ export default { | @@ -36,7 +36,7 @@ export default { | ||
36 | } | 36 | } |
37 | }, | 37 | }, |
38 | computed: { | 38 | computed: { |
39 | - ...mapState(['newsList']), | 39 | + ...mapState(['newsList','newsDeatilList']), |
40 | }, | 40 | }, |
41 | mounted() { | 41 | mounted() { |
42 | let params = { | 42 | let params = { |
@@ -9,6 +9,10 @@ import Notice from './notice'; | @@ -9,6 +9,10 @@ import Notice from './notice'; | ||
9 | import Category from './category'; | 9 | import Category from './category'; |
10 | 10 | ||
11 | export default [ | 11 | export default [ |
12 | + { | ||
13 | + path: '/xianyu', | ||
14 | + redirect: { name: 'ChannelPage' }, | ||
15 | + }, | ||
12 | ...Order, | 16 | ...Order, |
13 | ...Common, | 17 | ...Common, |
14 | ...List, | 18 | ...List, |
@@ -8,31 +8,56 @@ | @@ -8,31 +8,56 @@ | ||
8 | 8 | ||
9 | <div class="desc">如卖家原因导致交易失败,您可获赔付200元保证金,建议您设置支付宝账号作为赔偿收款账户,如未绑定银行卡则视为放弃赔偿</div> | 9 | <div class="desc">如卖家原因导致交易失败,您可获赔付200元保证金,建议您设置支付宝账号作为赔偿收款账户,如未绑定银行卡则视为放弃赔偿</div> |
10 | 10 | ||
11 | + <div class="btn-wrap"> | ||
11 | <YohoButton :txt="txt" class="btn-class" @click="onClick"></YohoButton> | 12 | <YohoButton :txt="txt" class="btn-class" @click="onClick"></YohoButton> |
13 | + </div> | ||
12 | 14 | ||
13 | <div class="info"> | 15 | <div class="info"> |
14 | <div class="item" @click="goHome">随便逛逛</div> | 16 | <div class="item" @click="goHome">随便逛逛</div> |
15 | </div> | 17 | </div> |
18 | + | ||
19 | + <div class="recommend" v-if="productList.length"> | ||
20 | + <div class="recommend-title">为您推荐</div> | ||
21 | + <ProductList :list="productList"></ProductList> | ||
22 | + </div> | ||
16 | </div> | 23 | </div> |
17 | </LayoutApp> | 24 | </LayoutApp> |
18 | </template> | 25 | </template> |
19 | 26 | ||
20 | <script> | 27 | <script> |
21 | 28 | ||
29 | +import ProductList from '../list/components/productList'; | ||
30 | +import { createNamespacedHelpers } from 'vuex'; | ||
31 | + | ||
32 | +const { mapActions: mapProductAction } = createNamespacedHelpers('product'); | ||
33 | + | ||
22 | export default { | 34 | export default { |
23 | name: 'BuyPayOk', | 35 | name: 'BuyPayOk', |
36 | + props: ['productId', 'orderCode'], | ||
37 | + components: { | ||
38 | + ProductList | ||
39 | + }, | ||
24 | data() { | 40 | data() { |
25 | return { | 41 | return { |
26 | - txt: '返回首页' | 42 | + txt: '返回首页', |
43 | + productList: [] | ||
27 | }; | 44 | }; |
28 | }, | 45 | }, |
46 | + mounted() { | ||
47 | + if (this.productId) { | ||
48 | + this.fetchRecommendProduct({ productId: this.productId }).then(result => { | ||
49 | + this.productList = result; | ||
50 | + }); | ||
51 | + } | ||
52 | + }, | ||
29 | methods: { | 53 | methods: { |
54 | + ...mapProductAction(['fetchRecommendProduct']), | ||
30 | onClick() { | 55 | onClick() { |
31 | this.goHome(); | 56 | this.goHome(); |
32 | }, | 57 | }, |
33 | goHome() { | 58 | goHome() { |
34 | this.$router.replace({ | 59 | this.$router.replace({ |
35 | - name: 'channel' | 60 | + name: 'ChannelPage' |
36 | }); | 61 | }); |
37 | } | 62 | } |
38 | } | 63 | } |
@@ -42,7 +67,6 @@ export default { | @@ -42,7 +67,6 @@ export default { | ||
42 | <style lang="scss" scoped> | 67 | <style lang="scss" scoped> |
43 | .body { | 68 | .body { |
44 | height: 100%; | 69 | height: 100%; |
45 | - margin: 0 32px; | ||
46 | padding-bottom: 140px; | 70 | padding-bottom: 140px; |
47 | overflow-y: auto; | 71 | overflow-y: auto; |
48 | } | 72 | } |
@@ -56,8 +80,12 @@ export default { | @@ -56,8 +80,12 @@ export default { | ||
56 | font-size: 120px; | 80 | font-size: 120px; |
57 | } | 81 | } |
58 | 82 | ||
83 | +.btn-wrap { | ||
84 | + margin: 0 32px; | ||
85 | +} | ||
86 | + | ||
59 | .btn-class { | 87 | .btn-class { |
60 | - height: 100px; | 88 | + height: 88px; |
61 | font-size: 32px; | 89 | font-size: 32px; |
62 | line-height: 100px; | 90 | line-height: 100px; |
63 | } | 91 | } |
@@ -82,6 +110,7 @@ export default { | @@ -82,6 +110,7 @@ export default { | ||
82 | font-size: 28px; | 110 | font-size: 28px; |
83 | display: flex; | 111 | display: flex; |
84 | margin-top: 30px; | 112 | margin-top: 30px; |
113 | + margin-bottom: 66px; | ||
85 | 114 | ||
86 | .item { | 115 | .item { |
87 | width: 100%; | 116 | width: 100%; |
@@ -89,4 +118,16 @@ export default { | @@ -89,4 +118,16 @@ export default { | ||
89 | } | 118 | } |
90 | } | 119 | } |
91 | 120 | ||
121 | +.recommend { | ||
122 | + background: #f5f5f5; | ||
123 | + | ||
124 | + .recommend-title { | ||
125 | + font-weight: bold; | ||
126 | + font-size: 36px; | ||
127 | + line-height: 50px; | ||
128 | + padding: 20px 0 0; | ||
129 | + margin: 0 40px; | ||
130 | + } | ||
131 | +} | ||
132 | + | ||
92 | </style> | 133 | </style> |
@@ -191,6 +191,10 @@ export default { | @@ -191,6 +191,10 @@ export default { | ||
191 | }, | 191 | }, |
192 | forward: { | 192 | forward: { |
193 | name: 'BuyPayOk', | 193 | name: 'BuyPayOk', |
194 | + query: { | ||
195 | + productId: this.productId, | ||
196 | + orderCode: result.data.orderCode | ||
197 | + } | ||
194 | } | 198 | } |
195 | }), | 199 | }), |
196 | onCloseAction() { | 200 | onCloseAction() { |
@@ -45,6 +45,7 @@ export default [ | @@ -45,6 +45,7 @@ export default [ | ||
45 | component: () => import(/* webpackChunkName: "order" */ './buy-pay-ok'), | 45 | component: () => import(/* webpackChunkName: "order" */ './buy-pay-ok'), |
46 | props: route => ({ | 46 | props: route => ({ |
47 | orderCode: route.query.orderCode, | 47 | orderCode: route.query.orderCode, |
48 | + productId: route.query.productId | ||
48 | }) | 49 | }) |
49 | }, | 50 | }, |
50 | { | 51 | { |
1 | <template> | 1 | <template> |
2 | <LayoutApp :show-back="true" title="支付中"> | 2 | <LayoutApp :show-back="true" title="支付中"> |
3 | - <div class="timer-wrapper"> | ||
4 | - <div class="timer">{{count}}s</div> | ||
5 | - </div> | 3 | + <CountCircle :line-width="6" :time="count * 1000" style="width: 70px; height: 70px; display: block;"></CountCircle> |
6 | 4 | ||
7 | <div class="tip">正在支付中…</div> | 5 | <div class="tip">正在支付中…</div> |
8 | <div class="tip2">支付成功跳转成功页面,支付失败返回上一层</div> | 6 | <div class="tip2">支付成功跳转成功页面,支付失败返回上一层</div> |
@@ -18,17 +16,18 @@ | @@ -18,17 +16,18 @@ | ||
18 | 16 | ||
19 | import config from 'config'; | 17 | import config from 'config'; |
20 | import { UserType } from 'store/order/order-confirm'; | 18 | import { UserType } from 'store/order/order-confirm'; |
21 | -import YohoButton from '../../components/button'; | 19 | +import { createNamespacedHelpers } from 'vuex'; |
20 | + | ||
21 | +const { mapActions: mapOrderAction } = createNamespacedHelpers('order/orderConfirm'); | ||
22 | 22 | ||
23 | export default { | 23 | export default { |
24 | name: 'PayPage', | 24 | name: 'PayPage', |
25 | - components: { YohoButton }, | ||
26 | props: ['orderCode', 'payParams', 'extra'], | 25 | props: ['orderCode', 'payParams', 'extra'], |
27 | data() { | 26 | data() { |
28 | return { | 27 | return { |
29 | count: 60, | 28 | count: 60, |
30 | page: null, | 29 | page: null, |
31 | - timer: null | 30 | + timer: null, |
32 | }; | 31 | }; |
33 | }, | 32 | }, |
34 | mounted() { | 33 | mounted() { |
@@ -41,6 +40,12 @@ export default { | @@ -41,6 +40,12 @@ export default { | ||
41 | if (this.extra) { | 40 | if (this.extra) { |
42 | this.page = JSON.parse(this.extra || '{}'); | 41 | this.page = JSON.parse(this.extra || '{}'); |
43 | } | 42 | } |
43 | + | ||
44 | + this.check().catch((result) => { | ||
45 | + if (result?.data?.statusDetail?.leftTime < 60) { | ||
46 | + this.count = result?.data?.statusDetail?.leftTime; | ||
47 | + } | ||
48 | + }); | ||
44 | }, | 49 | }, |
45 | beforeRouteLeave(to, from, next) { | 50 | beforeRouteLeave(to, from, next) { |
46 | if (this.timer) { | 51 | if (this.timer) { |
@@ -50,6 +55,7 @@ export default { | @@ -50,6 +55,7 @@ export default { | ||
50 | next(); | 55 | next(); |
51 | }, | 56 | }, |
52 | methods: { | 57 | methods: { |
58 | + ...mapOrderAction(['fetchOrderStatus']), | ||
53 | openPay() { | 59 | openPay() { |
54 | const url = config.alipayUrl + '?' + this.payParams; | 60 | const url = config.alipayUrl + '?' + this.payParams; |
55 | 61 | ||
@@ -63,15 +69,29 @@ export default { | @@ -63,15 +69,29 @@ export default { | ||
63 | this.count = this.count - 1; | 69 | this.count = this.count - 1; |
64 | this.setCount(); | 70 | this.setCount(); |
65 | }, 1000); | 71 | }, 1000); |
72 | + | ||
73 | + if (this.count % 5 === 0) { | ||
74 | + this.check().catch(() => {}); | ||
75 | + } | ||
66 | } else { | 76 | } else { |
67 | this.goOk(); | 77 | this.goOk(); |
68 | } | 78 | } |
69 | }, | 79 | }, |
70 | check() { | 80 | check() { |
71 | - | ||
72 | - }, | ||
73 | - goOk() { | 81 | + return this.fetchOrderStatus({ |
82 | + orderCode: this.orderCode | ||
83 | + }).then((result) => { | ||
84 | + if (result?.data?.statusDetail?.status === 1) { | ||
74 | this.$router.replace(this.page?.forward); | 85 | this.$router.replace(this.page?.forward); |
86 | + } else { | ||
87 | + return Promise.reject(result); | ||
88 | + } | ||
89 | + }); | ||
90 | + }, | ||
91 | + async goOk() { | ||
92 | + this.check().catch(() => { | ||
93 | + this.goDetail(); | ||
94 | + }); | ||
75 | }, | 95 | }, |
76 | goDetail() { | 96 | goDetail() { |
77 | switch (this.page.type) { | 97 | switch (this.page.type) { |
@@ -121,7 +121,8 @@ export default { | @@ -121,7 +121,8 @@ export default { | ||
121 | isAgree: false, | 121 | isAgree: false, |
122 | labelOption: { | 122 | labelOption: { |
123 | label: '我已阅读并同意' | 123 | label: '我已阅读并同意' |
124 | - } | 124 | + }, |
125 | + time: 15000 | ||
125 | }; | 126 | }; |
126 | }, | 127 | }, |
127 | asyncData({store, router}) { | 128 | asyncData({store, router}) { |
@@ -241,9 +242,9 @@ export default { | @@ -241,9 +242,9 @@ export default { | ||
241 | this.platformFeeModalVisible = true; | 242 | this.platformFeeModalVisible = true; |
242 | }, | 243 | }, |
243 | 244 | ||
244 | - showEarnestQuestion() { // 跳转保证金页面 | 245 | + showEarnestQuestion() { // 跳转保证金说明页 |
245 | console.log('showEarnest'); | 246 | console.log('showEarnest'); |
246 | - | 247 | + this.$xianyu.goXianyuNewPage({url: this.agreementURL}); |
247 | }, | 248 | }, |
248 | 249 | ||
249 | /** | 250 | /** |
@@ -280,8 +281,9 @@ export default { | @@ -280,8 +281,9 @@ export default { | ||
280 | onCloseAction() { | 281 | onCloseAction() { |
281 | that.clearData(); | 282 | that.clearData(); |
282 | that.$router.replace({ | 283 | that.$router.replace({ |
283 | - name: 'InSaleOrderList', | 284 | + name: 'sellOrderDetail', |
284 | params: { | 285 | params: { |
286 | + owner: 'sell', | ||
285 | code: result.data.orderCode | 287 | code: result.data.orderCode |
286 | } | 288 | } |
287 | }); | 289 | }); |
@@ -595,6 +597,7 @@ export default { | @@ -595,6 +597,7 @@ export default { | ||
595 | position: relative; | 597 | position: relative; |
596 | width: 100%; | 598 | width: 100%; |
597 | height: 100px; | 599 | height: 100px; |
600 | + background-color: #fff; | ||
598 | 601 | ||
599 | button { | 602 | button { |
600 | display: block; | 603 | display: block; |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | 8 | ||
9 | <ProductInfo class="product-info" :data="product"></ProductInfo> | 9 | <ProductInfo class="product-info" :data="product"></ProductInfo> |
10 | 10 | ||
11 | - <YohoButton :txt="txt" class="btn-class" @on-click="onClick"></YohoButton> | 11 | + <YohoButton :txt="txt" class="btn-class" @click="onClick"></YohoButton> |
12 | 12 | ||
13 | <div class="info"> | 13 | <div class="info"> |
14 | <div class="item" @click="goPublish">继续发布</div> | 14 | <div class="item" @click="goPublish">继续发布</div> |
@@ -60,7 +60,7 @@ export default { | @@ -60,7 +60,7 @@ export default { | ||
60 | }, | 60 | }, |
61 | goHome() { | 61 | goHome() { |
62 | this.$router.replace({ | 62 | this.$router.replace({ |
63 | - name: 'channel' | 63 | + name: 'ChannelPage' |
64 | }); | 64 | }); |
65 | } | 65 | } |
66 | } | 66 | } |
@@ -18,8 +18,7 @@ | @@ -18,8 +18,7 @@ | ||
18 | @select="onSelectSize" | 18 | @select="onSelectSize" |
19 | @add="onAdd" /> | 19 | @add="onAdd" /> |
20 | <transition name="slide-up"> | 20 | <transition name="slide-up"> |
21 | - <div class="footer" v-if="isAvailable"> | ||
22 | - <cube-button v-if="config.type === 'sell'" @click="convertToCash" :class="{active: isMarketable}">变现<span> <i>¥</i>{{cashPrice}}</span></cube-button> | 21 | + <div class="footer"> |
23 | <cube-button @click="select" :class="{active: isTradable}">{{config.title}}</cube-button> | 22 | <cube-button @click="select" :class="{active: isTradable}">{{config.title}}</cube-button> |
24 | </div> | 23 | </div> |
25 | </transition> | 24 | </transition> |
@@ -97,25 +96,6 @@ export default { | @@ -97,25 +96,6 @@ export default { | ||
97 | isTradable() { | 96 | isTradable() { |
98 | return this.isAvailable && this.selectedSize.storage_num > 0 && this.selectedSize.least_price !== '-'; | 97 | return this.isAvailable && this.selectedSize.storage_num > 0 && this.selectedSize.least_price !== '-'; |
99 | }, | 98 | }, |
100 | - | ||
101 | - /** | ||
102 | - * 变现价格,使用bid_moster_price | ||
103 | - */ | ||
104 | - cashPrice() { | ||
105 | - if (this.selectedSize && this.selectedSize.hasOwnProperty('bid_moster_price')) { | ||
106 | - return this.selectedSize.bid_moster_price; | ||
107 | - } | ||
108 | - | ||
109 | - return '-'; | ||
110 | - }, | ||
111 | - | ||
112 | - /** | ||
113 | - * 可变现 | ||
114 | - * 通过bid_moster_price或bid_skup判断 | ||
115 | - */ | ||
116 | - isMarketable() { | ||
117 | - return this.cashPrice > 0; | ||
118 | - } | ||
119 | }, | 99 | }, |
120 | mounted() { | 100 | mounted() { |
121 | this.$refs.popup.show(); | 101 | this.$refs.popup.show(); |
@@ -148,14 +128,6 @@ export default { | @@ -148,14 +128,6 @@ export default { | ||
148 | bid_skup: this.selectedSize.bid_skup, | 128 | bid_skup: this.selectedSize.bid_skup, |
149 | }); | 129 | }); |
150 | }, | 130 | }, |
151 | - convertToCash() { | ||
152 | - if (!this.isMarketable) { | ||
153 | - return; | ||
154 | - } | ||
155 | - this.hide(); | ||
156 | - | ||
157 | - // TODO: TBD | ||
158 | - }, | ||
159 | }, | 131 | }, |
160 | }; | 132 | }; |
161 | </script> | 133 | </script> |
apps/statics/image/coupon/no_coupon.png
0 → 100644
![](/fe/xianyu-ufo-app-web/raw/cf3703b464d90cae9fd6761efcd99e5ee1460681/apps/statics/image/coupon/no_coupon.png)
8.49 KB
@@ -52,8 +52,6 @@ export default function() { | @@ -52,8 +52,6 @@ export default function() { | ||
52 | async fetchChannelList({ commit }) { | 52 | async fetchChannelList({ commit }) { |
53 | const result = await this.$api.get('/api/ufo/channel/channelList', { | 53 | const result = await this.$api.get('/api/ufo/channel/channelList', { |
54 | content_code: 'f788335b57b67c1711f255648c744dab', | 54 | content_code: 'f788335b57b67c1711f255648c744dab', |
55 | - // uid: '64668089', | ||
56 | - uid: '500031170', | ||
57 | }); | 55 | }); |
58 | if (result.code === 200) { | 56 | if (result.code === 200) { |
59 | commit(Types.FETCH_CHANNEL, { list: result.data }); | 57 | commit(Types.FETCH_CHANNEL, { list: result.data }); |
1 | -const uid = '500031170'; | ||
2 | - | ||
3 | export default function() { | 1 | export default function() { |
4 | return { | 2 | return { |
5 | namespaced: true, | 3 | namespaced: true, |
@@ -8,6 +6,7 @@ export default function() { | @@ -8,6 +6,7 @@ export default function() { | ||
8 | type: 'unused', | 6 | type: 'unused', |
9 | isFetching: false, | 7 | isFetching: false, |
10 | reachedEnd: false, | 8 | reachedEnd: false, |
9 | + isEmpty: false, | ||
11 | list: [], | 10 | list: [], |
12 | filter: 0, | 11 | filter: 0, |
13 | page: 0, | 12 | page: 0, |
@@ -18,6 +17,7 @@ export default function() { | @@ -18,6 +17,7 @@ export default function() { | ||
18 | type: 'used', | 17 | type: 'used', |
19 | isFetching: false, | 18 | isFetching: false, |
20 | reachedEnd: false, | 19 | reachedEnd: false, |
20 | + isEmpty: false, | ||
21 | list: [], | 21 | list: [], |
22 | filter: 0, | 22 | filter: 0, |
23 | page: 0, | 23 | page: 0, |
@@ -28,6 +28,7 @@ export default function() { | @@ -28,6 +28,7 @@ export default function() { | ||
28 | type: 'overtime', | 28 | type: 'overtime', |
29 | isFetching: false, | 29 | isFetching: false, |
30 | reachedEnd: false, | 30 | reachedEnd: false, |
31 | + isEmpty: false, | ||
31 | list: [], | 32 | list: [], |
32 | filter: 0, | 33 | filter: 0, |
33 | page: 0, | 34 | page: 0, |
@@ -62,7 +63,7 @@ export default function() { | @@ -62,7 +63,7 @@ export default function() { | ||
62 | } else { | 63 | } else { |
63 | params.page += 1; | 64 | params.page += 1; |
64 | } | 65 | } |
65 | - params.uid = uid; | 66 | + |
66 | let result = await this.$api.get('/api/ufo/coupon/list', {...params}); | 67 | let result = await this.$api.get('/api/ufo/coupon/list', {...params}); |
67 | 68 | ||
68 | if (result.code === 200) { | 69 | if (result.code === 200) { |
@@ -79,8 +80,13 @@ export default function() { | @@ -79,8 +80,13 @@ export default function() { | ||
79 | if (couponData.list.length === couponData.total) { | 80 | if (couponData.list.length === couponData.total) { |
80 | couponData.reachedEnd = true; | 81 | couponData.reachedEnd = true; |
81 | } | 82 | } |
83 | + couponData.list.length ? couponData.isEmpty = false : couponData.isEmpty = true; | ||
84 | + | ||
82 | commit('addList', { data: couponData }); | 85 | commit('addList', { data: couponData }); |
83 | } | 86 | } |
87 | + } else { | ||
88 | + couponData.isEmpty = true; | ||
89 | + commit('addList', { data: couponData }); | ||
84 | } | 90 | } |
85 | return couponData.list || []; | 91 | return couponData.list || []; |
86 | }, | 92 | }, |
1 | import { get, set } from 'lodash'; | 1 | import { get, set } from 'lodash'; |
2 | import { getImgUrl } from '../../common/utils'; | 2 | import { getImgUrl } from '../../common/utils'; |
3 | import Vue from 'vue'; | 3 | import Vue from 'vue'; |
4 | -const uid = '500031170'; | 4 | +// const uid = '500031170'; |
5 | 5 | ||
6 | export default function() { | 6 | export default function() { |
7 | return { | 7 | return { |
@@ -13,17 +13,23 @@ export default function() { | @@ -13,17 +13,23 @@ export default function() { | ||
13 | favoriteProductList: { | 13 | favoriteProductList: { |
14 | list:[] | 14 | list:[] |
15 | }, | 15 | }, |
16 | - isShowEmpty: false, | 16 | + isMore: true, |
17 | }, | 17 | }, |
18 | mutations: { | 18 | mutations: { |
19 | addList(state, { data }) { | 19 | addList(state, { data }) { |
20 | console.log(data) | 20 | console.log(data) |
21 | if(data && data.product_list){ | 21 | if(data && data.product_list){ |
22 | // data.product_list. | 22 | // data.product_list. |
23 | - let { page, product_list = [] } = data; | 23 | + let { page, product_list = [], pageTotal } = data; |
24 | let isShowEmpty = page === 1 && product_list === 0; | 24 | let isShowEmpty = page === 1 && product_list === 0; |
25 | // console.log("isShowEmpty:"+isShowEmpty) | 25 | // console.log("isShowEmpty:"+isShowEmpty) |
26 | // state.isShowEmpty = isShowEmpty | 26 | // state.isShowEmpty = isShowEmpty |
27 | + if(pageTotal > page){ | ||
28 | + state.isMore = true; | ||
29 | + } | ||
30 | + state.pageTotal = pageTotal; | ||
31 | + state.page = page + 1; | ||
32 | + | ||
27 | let list = state.favoriteProductList.list.concat(product_list); | 33 | let list = state.favoriteProductList.list.concat(product_list); |
28 | Vue.set(state.favoriteProductList, "list", list); | 34 | Vue.set(state.favoriteProductList, "list", list); |
29 | }else { | 35 | }else { |
@@ -38,8 +44,10 @@ export default function() { | @@ -38,8 +44,10 @@ export default function() { | ||
38 | 44 | ||
39 | }, | 45 | }, |
40 | actions: { | 46 | actions: { |
41 | - async fetchFavoriteList({ commit }) { | ||
42 | - const result = await this.$api.get('/api/ufo/home/favoriteProduct', {uid}); | 47 | + async fetchFavoriteList({ commit, state }) { |
48 | + let page = state.page; | ||
49 | + let limit = 20; | ||
50 | + const result = await this.$api.get('/api/ufo/home/favoriteProduct', {page, limit}); | ||
43 | if (result.code === 200) { | 51 | if (result.code === 200) { |
44 | let data =result.data; | 52 | let data =result.data; |
45 | commit('addList', { data:data }); | 53 | commit('addList', { data:data }); |
@@ -48,6 +56,9 @@ export default function() { | @@ -48,6 +56,9 @@ export default function() { | ||
48 | commit('errorData'); | 56 | commit('errorData'); |
49 | } | 57 | } |
50 | return result.data || []; | 58 | return result.data || []; |
59 | + // }else { | ||
60 | + // return []; | ||
61 | + // } | ||
51 | }, | 62 | }, |
52 | }, | 63 | }, |
53 | }; | 64 | }; |
@@ -46,11 +46,11 @@ export default function() { | @@ -46,11 +46,11 @@ export default function() { | ||
46 | endTime: 0, | 46 | endTime: 0, |
47 | }, | 47 | }, |
48 | userWalletInfo: { | 48 | userWalletInfo: { |
49 | - totalAmount: 0.0, | 49 | + totalAmount: 0.00, |
50 | withdrawLimit: 0, | 50 | withdrawLimit: 0, |
51 | withdrawAmount: 0, | 51 | withdrawAmount: 0, |
52 | shareSettlementAmount: 0, | 52 | shareSettlementAmount: 0, |
53 | - walletAmount: 0.0, | 53 | + walletAmount: '¥0.00', |
54 | }, | 54 | }, |
55 | filterData: { | 55 | filterData: { |
56 | tradeTypes: [], | 56 | tradeTypes: [], |
@@ -102,7 +102,7 @@ export default function() { | @@ -102,7 +102,7 @@ export default function() { | ||
102 | resource1: { name: 'resource1', data: state.resource1 }, | 102 | resource1: { name: 'resource1', data: state.resource1 }, |
103 | income: { | 103 | income: { |
104 | title: '我的收入', | 104 | title: '我的收入', |
105 | - num: '¥' + state.userWalletInfo.walletAmount, | 105 | + num: state.userWalletInfo.walletAmount, |
106 | page: 'income', | 106 | page: 'income', |
107 | }, // 原交易收入 tradeIncome | 107 | }, // 原交易收入 tradeIncome |
108 | buyOrder: { | 108 | buyOrder: { |
@@ -127,7 +127,7 @@ export default function() { | @@ -127,7 +127,7 @@ export default function() { | ||
127 | name: 'coupon', | 127 | name: 'coupon', |
128 | title: '我的优惠券', | 128 | title: '我的优惠券', |
129 | num: state.couponNum, | 129 | num: state.couponNum, |
130 | - page: '' | 130 | + page: 'Coupon' |
131 | }, | 131 | }, |
132 | service: { | 132 | service: { |
133 | name: 'service', | 133 | name: 'service', |
@@ -249,6 +249,8 @@ export default function() { | @@ -249,6 +249,8 @@ export default function() { | ||
249 | state.walletData.endTime = endTime; | 249 | state.walletData.endTime = endTime; |
250 | }, | 250 | }, |
251 | addUserWalletInfo(state, data) { | 251 | addUserWalletInfo(state, data) { |
252 | + // data.totalAmount = formatNumber(data.totalAmount); | ||
253 | + data.walletAmount = formatNumber(data.walletAmount); | ||
252 | state.userWalletInfo = data; | 254 | state.userWalletInfo = data; |
253 | }, | 255 | }, |
254 | addfilterData(state, data) { | 256 | addfilterData(state, data) { |
@@ -13,6 +13,14 @@ export default function() { | @@ -13,6 +13,14 @@ export default function() { | ||
13 | totalPage: 0, | 13 | totalPage: 0, |
14 | uid: '500031170', | 14 | uid: '500031170', |
15 | }, | 15 | }, |
16 | + newsDeatilList: { | ||
17 | + list: [], | ||
18 | + tabList: [], | ||
19 | + page: 0, | ||
20 | + limit: 10, | ||
21 | + totalPage: 0, | ||
22 | + uid: '500031170', | ||
23 | + } | ||
16 | }, | 24 | }, |
17 | mutations: { | 25 | mutations: { |
18 | [Types.FETCH_NEWS_LIST](state, { list }) { | 26 | [Types.FETCH_NEWS_LIST](state, { list }) { |
@@ -21,12 +29,19 @@ export default function() { | @@ -21,12 +29,19 @@ export default function() { | ||
21 | state.newsList.totalPage = list.totalPage; | 29 | state.newsList.totalPage = list.totalPage; |
22 | }, | 30 | }, |
23 | 31 | ||
32 | + [Types.FETCH_NEWSDETAIL_LIST](state, { list }) { | ||
33 | + state.newsDeatilList.list = list.page > 1 ? state.newsDeatilList.list.concat(list.list) : list.list; | ||
34 | + state.newsDeatilList.page = list.page; | ||
35 | + state.newsDeatilList.totalPage = list.totalPage; | ||
36 | + }, | ||
37 | + | ||
24 | [Types.FETCH_NEWS_TAB_LIST](state, { list }) { | 38 | [Types.FETCH_NEWS_TAB_LIST](state, { list }) { |
25 | state.newsList.tabList = list; | 39 | state.newsList.tabList = list; |
26 | }, | 40 | }, |
27 | }, | 41 | }, |
28 | actions: { | 42 | actions: { |
29 | async fetchNewsList({ commit, state }, obj) { | 43 | async fetchNewsList({ commit, state }, obj) { |
44 | + console.log(obj); | ||
30 | let page = state.newsList.page + 1; | 45 | let page = state.newsList.page + 1; |
31 | let uid = state.newsList.uid; | 46 | let uid = state.newsList.uid; |
32 | let limit = state.newsList.limit; | 47 | let limit = state.newsList.limit; |
@@ -40,21 +55,23 @@ export default function() { | @@ -40,21 +55,23 @@ export default function() { | ||
40 | if (page === totalPage) { | 55 | if (page === totalPage) { |
41 | return false; | 56 | return false; |
42 | } | 57 | } |
58 | + | ||
43 | const result = await this.$api.post('/api/ufo/home/newsList', { | 59 | const result = await this.$api.post('/api/ufo/home/newsList', { |
44 | - page, uid, type, limit | 60 | + page, type, limit |
45 | }); | 61 | }); |
46 | 62 | ||
47 | if (result.code === 200) { | 63 | if (result.code === 200) { |
48 | - // 时间戳转换 moment | ||
49 | result.data.list.map((res) => { | 64 | result.data.list.map((res) => { |
50 | res.createTime = moment(new Date(res.createTime * 1000)).format('YYYY.MM.DD HH:mm'); | 65 | res.createTime = moment(new Date(res.createTime * 1000)).format('YYYY.MM.DD HH:mm'); |
51 | }); | 66 | }); |
52 | commit(Types.FETCH_NEWS_LIST, {list: result.data}); | 67 | commit(Types.FETCH_NEWS_LIST, {list: result.data}); |
68 | + if (obj.type == 1 || obj.type == 2 || obj.type == 3) { | ||
69 | + commit(Types.FETCH_NEWSDETAIL_LIST, {list: result.data}); | ||
70 | + } | ||
53 | } | 71 | } |
54 | }, | 72 | }, |
55 | - async fetchNewsTabList({ commit, state }) { | ||
56 | - let uid = '500031170'; | ||
57 | - const result = await this.$api.post('/api/ufo/home/newsListTab', { uid }); | 73 | + async fetchNewsTabList({ commit }) { |
74 | + const result = await this.$api.post('/api/ufo/home/newsListTab', {}); | ||
58 | if (result.code === 200) { | 75 | if (result.code === 200) { |
59 | commit(Types.FETCH_NEWS_TAB_LIST, {list: result.data}); | 76 | commit(Types.FETCH_NEWS_TAB_LIST, {list: result.data}); |
60 | } | 77 | } |
@@ -6,6 +6,7 @@ export const FETCH_CHANNEL = 'FETCH_CHANNEL'; | @@ -6,6 +6,7 @@ export const FETCH_CHANNEL = 'FETCH_CHANNEL'; | ||
6 | export const FETCH_PRODUCT = 'FETCH_PRODUCT'; | 6 | export const FETCH_PRODUCT = 'FETCH_PRODUCT'; |
7 | export const FETCH_NEWS_LIST = 'FETCH_NEWS_LIST'; | 7 | export const FETCH_NEWS_LIST = 'FETCH_NEWS_LIST'; |
8 | export const FETCH_NEWS_TAB_LIST = 'FETCH_NEWS_TAB_LIST'; | 8 | export const FETCH_NEWS_TAB_LIST = 'FETCH_NEWS_TAB_LIST'; |
9 | +export const FETCH_NEWSDETAIL_LIST = 'FETCH_NEWSDETAIL_LIST'; | ||
9 | 10 | ||
10 | export const FETCH_FAVORITE_LIST_REQUEST = 'FETCH_FAVORITE_LIST_REQUEST'; | 11 | export const FETCH_FAVORITE_LIST_REQUEST = 'FETCH_FAVORITE_LIST_REQUEST'; |
11 | export const FETCH_FAVORITE_LIST_FAILD = 'FETCH_FAVORITE_LIST_FAILD'; | 12 | export const FETCH_FAVORITE_LIST_FAILD = 'FETCH_FAVORITE_LIST_FAILD'; |
@@ -222,6 +222,12 @@ export default function() { | @@ -222,6 +222,12 @@ export default function() { | ||
222 | return this.$api.get('/api/order/goods', { | 222 | return this.$api.get('/api/order/goods', { |
223 | orderCode | 223 | orderCode |
224 | }); | 224 | }); |
225 | + }, | ||
226 | + | ||
227 | + async fetchOrderStatus(ctx, { orderCode }) { | ||
228 | + return this.$api.get('/api/order/status', { | ||
229 | + orderCode | ||
230 | + }); | ||
225 | } | 231 | } |
226 | }, | 232 | }, |
227 | getters: {}, | 233 | getters: {}, |
@@ -37,7 +37,7 @@ export default { | @@ -37,7 +37,7 @@ export default { | ||
37 | }); | 37 | }); |
38 | } | 38 | } |
39 | 39 | ||
40 | - console.log(result); | 40 | + // console.log(result); |
41 | 41 | ||
42 | if (result && result.code === 200) { | 42 | if (result && result.code === 200) { |
43 | commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, { | 43 | commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, { |
@@ -64,7 +64,8 @@ export default { | @@ -64,7 +64,8 @@ export default { | ||
64 | orderCode, | 64 | orderCode, |
65 | tabType: 'sell' | 65 | tabType: 'sell' |
66 | }); | 66 | }); |
67 | - console.log('fetchOrder= ', result.data); | 67 | + |
68 | + // console.log('fetchOrder= ', result.data); | ||
68 | 69 | ||
69 | if (result && result.code === 200) { | 70 | if (result && result.code === 200) { |
70 | commit(Types.FETCH_NOENTRY_ORDER_PRODUCT_SUCCESS, { | 71 | commit(Types.FETCH_NOENTRY_ORDER_PRODUCT_SUCCESS, { |
@@ -89,7 +90,7 @@ export default { | @@ -89,7 +90,7 @@ export default { | ||
89 | commit(Types.POST_NOSALE_REQUEST); | 90 | commit(Types.POST_NOSALE_REQUEST); |
90 | const result = await this.$api.get('/api/ufo/sellerOrder/batchDownShelf', payload); | 91 | const result = await this.$api.get('/api/ufo/sellerOrder/batchDownShelf', payload); |
91 | 92 | ||
92 | - console.log('下架=', result); | 93 | + // console.log('下架=', result); |
93 | if (result && result.code === 200) { | 94 | if (result && result.code === 200) { |
94 | commit(Types.POST_NOSALE_SUCCESS, { | 95 | commit(Types.POST_NOSALE_SUCCESS, { |
95 | order: result.data | 96 | order: result.data |
@@ -3,9 +3,9 @@ import { get } from 'lodash'; | @@ -3,9 +3,9 @@ import { get } from 'lodash'; | ||
3 | import Vue from 'vue'; | 3 | import Vue from 'vue'; |
4 | 4 | ||
5 | export default { | 5 | export default { |
6 | - async fetchProductInfo({commit}, {productId}) { | 6 | + async fetchProductInfo({ commit }, { productId }) { |
7 | const queryTasks = ['', '/resource', '/activity', '/recommend'].map(path => { | 7 | const queryTasks = ['', '/resource', '/activity', '/recommend'].map(path => { |
8 | - let params = {product_id: productId}; | 8 | + let params = { product_id: productId }; |
9 | 9 | ||
10 | if (path === '/resource') { | 10 | if (path === '/resource') { |
11 | params = { | 11 | params = { |
@@ -31,7 +31,12 @@ export default { | @@ -31,7 +31,12 @@ export default { | ||
31 | recommend: recommend && recommend.product_list || [], | 31 | recommend: recommend && recommend.product_list || [], |
32 | })); | 32 | })); |
33 | }, | 33 | }, |
34 | - async fetchFav({commit, rootGetters}, {productId}) { | 34 | + async fetchRecommendProduct({ commit }, { productId }) { |
35 | + const result = await this.$api.get('/api/ufo/product/recommend', { product_id: productId }) | ||
36 | + | ||
37 | + return result?.data?.product_list ?? [] | ||
38 | + }, | ||
39 | + async fetchFav({ commit, rootGetters }, { productId }) { | ||
35 | let isLogin = rootGetters.getLogin; | 40 | let isLogin = rootGetters.getLogin; |
36 | 41 | ||
37 | if (!isLogin) { | 42 | if (!isLogin) { |
@@ -44,7 +49,7 @@ export default { | @@ -44,7 +49,7 @@ export default { | ||
44 | return false; | 49 | return false; |
45 | } | 50 | } |
46 | 51 | ||
47 | - const isFav = await this.$api.get('/api/ufo/product/fav', {productId}).then(result => { | 52 | + const isFav = await this.$api.get('/api/ufo/product/fav', { productId }).then(result => { |
48 | if (result.code === 200) { | 53 | if (result.code === 200) { |
49 | return result.data; | 54 | return result.data; |
50 | } else { | 55 | } else { |
@@ -52,27 +57,27 @@ export default { | @@ -52,27 +57,27 @@ export default { | ||
52 | } | 57 | } |
53 | }); | 58 | }); |
54 | 59 | ||
55 | - commit(Types.UPDATE_PRODUCT_FAV, {productId, isFav}); | 60 | + commit(Types.UPDATE_PRODUCT_FAV, { productId, isFav }); |
56 | }, | 61 | }, |
57 | - async fetchTop3({commit}, {productId}) { | ||
58 | - const result = await this.$api.get('/api/ufo/product/top', {product_id: productId}); | 62 | + async fetchTop3({ commit }, { productId }) { |
63 | + const result = await this.$api.get('/api/ufo/product/top', { product_id: productId }); | ||
59 | 64 | ||
60 | if (result.code === 200) { | 65 | if (result.code === 200) { |
61 | const productList = result.data.product_list || []; | 66 | const productList = result.data.product_list || []; |
62 | 67 | ||
63 | - commit(Types.UPDATE_PRODUCT_TOP3, {productId, topList: productList.slice(0, 3)}); | 68 | + commit(Types.UPDATE_PRODUCT_TOP3, { productId, topList: productList.slice(0, 3) }); |
64 | } | 69 | } |
65 | }, | 70 | }, |
66 | - async toggleFav({commit}, {productId, isFav}) { | ||
67 | - const result = await this.$api.get(`/api/ufo/product/favorite/${isFav ? 'add' : 'cancel'}`, {productId}); | 71 | + async toggleFav({ commit }, { productId, isFav }) { |
72 | + const result = await this.$api.get(`/api/ufo/product/favorite/${isFav ? 'add' : 'cancel'}`, { productId }); | ||
68 | 73 | ||
69 | if (result && result.code === 200) { | 74 | if (result && result.code === 200) { |
70 | - commit(Types.UPDATE_PRODUCT_FAV, {productId, isFav}); | 75 | + commit(Types.UPDATE_PRODUCT_FAV, { productId, isFav }); |
71 | } | 76 | } |
72 | }, | 77 | }, |
73 | - async updateTradeInfo({commit, state}, {productId, sizeInfo}) { | 78 | + async updateTradeInfo({ commit, state }, { productId, sizeInfo }) { |
74 | if (sizeInfo) { | 79 | if (sizeInfo) { |
75 | - commit(Types.UPDATE_SELECTED_PRODUCT_SIZE, {productId, sizeId: sizeInfo.size_id}); | 80 | + commit(Types.UPDATE_SELECTED_PRODUCT_SIZE, { productId, sizeId: sizeInfo.size_id }); |
76 | } | 81 | } |
77 | 82 | ||
78 | return { | 83 | return { |
@@ -81,18 +86,18 @@ export default { | @@ -81,18 +86,18 @@ export default { | ||
81 | storageId: state.selectedProductInfo.storageId, | 86 | storageId: state.selectedProductInfo.storageId, |
82 | }; | 87 | }; |
83 | }, | 88 | }, |
84 | - async getSelectedTradeProduct({state, commit, dispatch}, {productId, storageId}) { | 89 | + async getSelectedTradeProduct({ state, commit, dispatch }, { productId, storageId }) { |
85 | productId = parseInt(productId, 10); | 90 | productId = parseInt(productId, 10); |
86 | storageId = parseInt(storageId, 10); | 91 | storageId = parseInt(storageId, 10); |
87 | if (state.selectedProductInfo.productId !== productId && state.product.product_id !== productId) { | 92 | if (state.selectedProductInfo.productId !== productId && state.product.product_id !== productId) { |
88 | - await dispatch('fetchProductInfo', {productId}); | 93 | + await dispatch('fetchProductInfo', { productId }); |
89 | } | 94 | } |
90 | 95 | ||
91 | - commit(Types.UPDATE_SELECTED_PRODUCT_SIZE, {productId, storageId}); | 96 | + commit(Types.UPDATE_SELECTED_PRODUCT_SIZE, { productId, storageId }); |
92 | 97 | ||
93 | return state.selectedProductInfo; | 98 | return state.selectedProductInfo; |
94 | }, | 99 | }, |
95 | - async requestSize({state}, { sizeIds }) { | 100 | + async requestSize({ state }, { sizeIds }) { |
96 | const selectedProduct = state.selectedProductInfo; | 101 | const selectedProduct = state.selectedProductInfo; |
97 | 102 | ||
98 | await this.$api.get('/api/ufo/product/addsize', { | 103 | await this.$api.get('/api/ufo/product/addsize', { |
@@ -103,7 +108,7 @@ export default { | @@ -103,7 +108,7 @@ export default { | ||
103 | 108 | ||
104 | // 忽略错误 | 109 | // 忽略错误 |
105 | }, | 110 | }, |
106 | - async payment(context, {skup}) { | ||
107 | - return this.$api.post('/api/ufo/product/order/payment', {skup, api_version: 1}); | 111 | + async payment(context, { skup }) { |
112 | + return this.$api.post('/api/ufo/product/order/payment', { skup, api_version: 1 }); | ||
108 | }, | 113 | }, |
109 | }; | 114 | }; |
@@ -58,14 +58,14 @@ module.exports = { | @@ -58,14 +58,14 @@ module.exports = { | ||
58 | '/api/ufo/mine/order/summary': { | 58 | '/api/ufo/mine/order/summary': { |
59 | ufo: true, | 59 | ufo: true, |
60 | auth: true, | 60 | auth: true, |
61 | - path: '/ufo-gateway/shopping', | 61 | + path: 'shopping', |
62 | api: 'ufo.order.summary', | 62 | api: 'ufo.order.summary', |
63 | params: {}, | 63 | params: {}, |
64 | }, | 64 | }, |
65 | '/api/ufo/mine/coupon': { | 65 | '/api/ufo/mine/coupon': { |
66 | ufo: true, | 66 | ufo: true, |
67 | auth: true, | 67 | auth: true, |
68 | - path: '/ufo-gateway/coupon', | 68 | + path: 'coupon', |
69 | api: 'ufo.coupons.cnt', | 69 | api: 'ufo.coupons.cnt', |
70 | params: {}, | 70 | params: {}, |
71 | }, | 71 | }, |
@@ -82,34 +82,37 @@ module.exports = { | @@ -82,34 +82,37 @@ module.exports = { | ||
82 | }, | 82 | }, |
83 | '/api/ufo/home/favoriteProduct': { | 83 | '/api/ufo/home/favoriteProduct': { |
84 | ufo: true, | 84 | ufo: true, |
85 | + auth: true, | ||
85 | api: 'ufo.user.favoriteList', | 86 | api: 'ufo.user.favoriteList', |
86 | params: {}, | 87 | params: {}, |
88 | + auth: true, | ||
87 | }, | 89 | }, |
88 | '/api/ufo/channel/channelList': { | 90 | '/api/ufo/channel/channelList': { |
89 | ufo: true, | 91 | ufo: true, |
90 | api: 'ufo.resource.get', | 92 | api: 'ufo.resource.get', |
91 | params: { | 93 | params: { |
92 | content_code: { type: String }, | 94 | content_code: { type: String }, |
93 | - uid: { type: Number, require: true }, | ||
94 | }, | 95 | }, |
96 | + auth: true, | ||
95 | }, | 97 | }, |
96 | '/api/ufo/home/newsList': { | 98 | '/api/ufo/home/newsList': { |
97 | ufo: true, | 99 | ufo: true, |
100 | + auth: true, | ||
98 | api: 'ufo.users.listInboxs', | 101 | api: 'ufo.users.listInboxs', |
99 | - params: { | ||
100 | - uid: { type: Number }, | ||
101 | - }, | 102 | + params: {}, |
103 | + auth: true, | ||
102 | }, | 104 | }, |
103 | '/api/ufo/home/newsListTab': { | 105 | '/api/ufo/home/newsListTab': { |
104 | ufo: true, | 106 | ufo: true, |
107 | + auth: true, | ||
105 | api: 'ufo.users.listInboxTypeInfo', | 108 | api: 'ufo.users.listInboxTypeInfo', |
106 | - params: { | ||
107 | - uid: { type: Number }, | ||
108 | - }, | 109 | + params: {}, |
110 | + auth: true, | ||
109 | }, | 111 | }, |
110 | '/api/ufo/coupon/list': { | 112 | '/api/ufo/coupon/list': { |
111 | ufo: true, | 113 | ufo: true, |
112 | - path: '/ufo-gateway/coupon', | 114 | + auth: true, |
115 | + path: 'coupon', | ||
113 | api: 'ufo.coupons.list', | 116 | api: 'ufo.coupons.list', |
114 | param: { | 117 | param: { |
115 | page: {type: Number}, | 118 | page: {type: Number}, |
@@ -306,7 +306,14 @@ module.exports = { | @@ -306,7 +306,14 @@ module.exports = { | ||
306 | '/api/order/goods': { | 306 | '/api/order/goods': { |
307 | ufo: true, | 307 | ufo: true, |
308 | auth: true, | 308 | auth: true, |
309 | - api: 'ufo.buyerOrder.goodsDetail', | 309 | + api: 'ufo.order.goodsDetail', |
310 | + params: {} | ||
311 | + }, | ||
312 | + | ||
313 | + '/api/order/status': { | ||
314 | + ufo: true, | ||
315 | + auth: true, | ||
316 | + api: 'ufo.order.payDetail', | ||
310 | params: {} | 317 | params: {} |
311 | }, | 318 | }, |
312 | 319 |
@@ -59,20 +59,9 @@ module.exports = { | @@ -59,20 +59,9 @@ module.exports = { | ||
59 | }, | 59 | }, |
60 | }, | 60 | }, |
61 | 61 | ||
62 | - // 限制出售 | ||
63 | - '/api/ufo/product/limit': { | ||
64 | - ufo: true, | ||
65 | - auth: false, | ||
66 | - api: 'ufo.product.limitInfo', | ||
67 | - params: { | ||
68 | - product_id: {type: Number}, // 商品id | ||
69 | - }, | ||
70 | - }, | ||
71 | - | ||
72 | // TOP3 | 62 | // TOP3 |
73 | '/api/ufo/product/top': { | 63 | '/api/ufo/product/top': { |
74 | ufo: true, | 64 | ufo: true, |
75 | - auth: false, | ||
76 | api: 'ufo.product.data.search.recommendBySeriesBrand', | 65 | api: 'ufo.product.data.search.recommendBySeriesBrand', |
77 | params: { | 66 | params: { |
78 | product_id: {type: Number}, // 商品id | 67 | product_id: {type: Number}, // 商品id |
@@ -82,26 +71,12 @@ module.exports = { | @@ -82,26 +71,12 @@ module.exports = { | ||
82 | // 推荐 | 71 | // 推荐 |
83 | '/api/ufo/product/recommend': { | 72 | '/api/ufo/product/recommend': { |
84 | ufo: true, | 73 | ufo: true, |
85 | - auth: false, | ||
86 | api: 'ufo.product.data.search.recommend', | 74 | api: 'ufo.product.data.search.recommend', |
87 | params: { | 75 | params: { |
88 | product_id: {type: Number}, // 商品id | 76 | product_id: {type: Number}, // 商品id |
89 | }, | 77 | }, |
90 | }, | 78 | }, |
91 | 79 | ||
92 | - // 建议尺码 | ||
93 | - '/api/ufo/product/addsize': { | ||
94 | - ufo: true, | ||
95 | - auth: true, | ||
96 | - path: '/ufoLive', | ||
97 | - api: 'ufo.product.addSize', | ||
98 | - params: { | ||
99 | - product_id: {type: Number}, // 商品id | ||
100 | - goods_id: {type: Number}, // 商品id | ||
101 | - size_ids: {type: String}, // 建议尺码id | ||
102 | - }, | ||
103 | - }, | ||
104 | - | ||
105 | // 入驻状态 用户入驻状态,这里放入product命名下,防止冲突 | 80 | // 入驻状态 用户入驻状态,这里放入product命名下,防止冲突 |
106 | '/api/ufo/product/user/entrystatus': { | 81 | '/api/ufo/product/user/entrystatus': { |
107 | ufo: true, | 82 | ufo: true, |
1 | 1 | ||
2 | const _ = require('lodash'); | 2 | const _ = require('lodash'); |
3 | +const url = require('url'); | ||
3 | const uuid = require('uuid'); | 4 | const uuid = require('uuid'); |
4 | const passport = require('passport'); | 5 | const passport = require('passport'); |
5 | const TaobaoStrategy = require('./passport-taobao'); | 6 | const TaobaoStrategy = require('./passport-taobao'); |
@@ -13,6 +14,8 @@ const config = global.yoho.config; | @@ -13,6 +14,8 @@ const config = global.yoho.config; | ||
13 | const loginPage = '//m.yohobuy.com/signin.html'; | 14 | const loginPage = '//m.yohobuy.com/signin.html'; |
14 | const homePage = `${config.siteUrl}/xianyu/channel`; | 15 | const homePage = `${config.siteUrl}/xianyu/channel`; |
15 | 16 | ||
17 | +const URL_BIND_KEY = 'bind_code'; | ||
18 | + | ||
16 | // taobao 登录 | 19 | // taobao 登录 |
17 | passport.use('taobao', new TaobaoStrategy({ | 20 | passport.use('taobao', new TaobaoStrategy({ |
18 | clientID: '27930297', | 21 | clientID: '27930297', |
@@ -23,6 +26,19 @@ passport.use('taobao', new TaobaoStrategy({ | @@ -23,6 +26,19 @@ passport.use('taobao', new TaobaoStrategy({ | ||
23 | done(null, profile); | 26 | done(null, profile); |
24 | })); | 27 | })); |
25 | 28 | ||
29 | +function handleReferUrl(refer) { | ||
30 | + let referParse = url.parse(refer, true); | ||
31 | + let query = []; | ||
32 | + | ||
33 | + _.forEach(referParse.query, (val, key) => { | ||
34 | + if (key !== URL_BIND_KEY) { | ||
35 | + query.push(`${key}=${val}`); | ||
36 | + } | ||
37 | + }); | ||
38 | + | ||
39 | + return `${refer.split('?')[0]}${query.length ? '?' : ''}${query.join(',')}`; | ||
40 | +} | ||
41 | + | ||
26 | class passportModel extends global.yoho.BaseModel { | 42 | class passportModel extends global.yoho.BaseModel { |
27 | constructor(ctx) { | 43 | constructor(ctx) { |
28 | super(ctx); | 44 | super(ctx); |
@@ -147,11 +163,15 @@ const login = { | @@ -147,11 +163,15 @@ const login = { | ||
147 | }).then(result => { | 163 | }).then(result => { |
148 | let redirectUrl = loginPage; | 164 | let redirectUrl = loginPage; |
149 | 165 | ||
166 | + if (req.cookies.third_backurl) { | ||
167 | + redirectUrl += '?refer=' + encodeURIComponent(handleReferUrl(req.cookies.third_backurl)); | ||
168 | + } | ||
169 | + | ||
150 | if (result.code === 200) { | 170 | if (result.code === 200) { |
151 | if (_.get(result, 'data.is_bind') === 'N') { | 171 | if (_.get(result, 'data.is_bind') === 'N') { |
152 | redirectUrl = req.cookies.third_backurl ? req.cookies.third_backurl : homePage; | 172 | redirectUrl = req.cookies.third_backurl ? req.cookies.third_backurl : homePage; |
153 | redirectUrl += redirectUrl.indexOf('?') > 0 ? '&' : '?'; | 173 | redirectUrl += redirectUrl.indexOf('?') > 0 ? '&' : '?'; |
154 | - redirectUrl += 'bind_code=' + encodeURIComponent(aes.dynamicEncryption(`taobao::${user.open_uid}`)); | 174 | + redirectUrl += URL_BIND_KEY + '=' + encodeURIComponent(aes.dynamicEncryption(`taobao::${user.open_uid}`)); |
155 | } else if (+_.get(result, 'data.uid') > 0) { | 175 | } else if (+_.get(result, 'data.uid') > 0) { |
156 | return model.syncUserSession({ | 176 | return model.syncUserSession({ |
157 | uid: result.data.uid, | 177 | uid: result.data.uid, |
@@ -159,9 +179,10 @@ const login = { | @@ -159,9 +179,10 @@ const login = { | ||
159 | req, | 179 | req, |
160 | res | 180 | res |
161 | }).finally(() => { | 181 | }).finally(() => { |
162 | - let refer = req.cookies.third_backurl ? req.cookies.third_backurl : homePage; | ||
163 | - | ||
164 | - return res.redirect(refer); | 182 | + res.cookie('third_backurl', '', { |
183 | + domain: 'yohobuy.com' | ||
184 | + }); | ||
185 | + return res.redirect(handleReferUrl(req.cookies.third_backurl ? req.cookies.third_backurl : homePage)); | ||
165 | }); | 186 | }); |
166 | } | 187 | } |
167 | } else { | 188 | } else { |
-
Please register or login to post a comment