seller-ask-order.vue
7.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<!--卖家求购变现-->
<template>
<LayoutApp :show-back="true" title="变现">
<Scroll :options="options">
<div class="body">
<!--<TitleComp txt="变现"></TitleComp>-->
<ProductInfo :data="originProductData" class="product-info" :priceType="'现货最高求购价:'"></ProductInfo>
<div class="inputView">
<span class="inputViewIcon">
¥
</span>
<span class="wordText">{{price}}</span>
</div>
<OrderMargin class="order-item order-margin" :data="computeTip" :url="url" :superSell="isEntry" ></OrderMargin>
<OrderFee class="order-item" :data="computeTip"></OrderFee>
<AddressInfo :data="addressInfo" class="order-item"></AddressInfo>
</div>
</Scroll>
<div class="footer">
<OrderAgree :value="isAgreeTerms" @input="isAgreeTerms = !isAgreeTerms" class="agree-wrapper" :desc="agreeDesc" :url="url"></OrderAgree>
<div class="btn-wrapper">
<YohoButton :txt="submitText"class="submit-btn" :disable="!isAgreeTerms" @click="submitClick"></YohoButton>
</div>
</div>
</LayoutApp>
</template>
<script>
import {Button} from 'cube-ui';
import ProductInfo from './components/confirm/product';
import InputPrice from './components/confirm/input-price';
import AddressInfo from './components/confirm/address';
import TitleComp from './components/confirm/title';
import OrderMargin from './components/confirm/order-margin';
import OrderFee from './components/confirm/order-fee';
import OrderAgree from './components/confirm/agree';
import {get} from 'lodash';
import { createNamespacedHelpers} from 'vuex';
const { mapState, mapActions, mapMutations, mapGetters} = createNamespacedHelpers(
'order/sellerAskOrder'
);
export default {
name: 'seller-ask-order',
props: {
skup: Number,
price: Number,
},
components: {
Button,
ProductInfo,
AddressInfo,
InputPrice,
TitleComp,
OrderMargin,
OrderFee,
OrderAgree
},
data() {
return {
isAgreeTerms: false,
hiddenIcon: true,
agreeDesc: '有货卖家协议',
url: 'http://m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"url\":\"https://activity.yoho.cn/feature/3187.html?title=卖家协议\"}}',
isEntry: false,
submitText: '提交',
options: {pullDownRefresh: false},
};
},
computed: {
...mapState([
'originProductData',
// 'price',
'computeTip',
'addressInfo',
'publishinfo',
'isShowTip',
'toastMessage',
]),
...mapGetters([
]),
},
mounted() {
this.isEntry = false;
this.fetchSellerEntryStatus({})
.then((res)=> {
if (res) {
this.isEntry = get(res, 'entrySellerType', 0) !== 0;
}
});
this.fetchSellerOrderCount({tabType: 'sell'});// 19268
this.sellerCompute({price: this.price, skup: this.skup});
},
watch: {
isShowTip(val) {
if (val) {
this.showToast();
}
}
},
methods: {
...mapMutations([
'SELLER_ASK_SET_IS_SHOWTOAST',
]),
...mapActions([
'fetchSellerOrderCount',
'sellerCompute',
'sellerPublish',
'fetchSellerEntryStatus',
]),
submitClick() {
if (this.isEntry) {
this.$createDialog({
type: 'confirm',
title: '',
content: `确定以¥${this.price}立即出售此商品`,
confirmBtn: {
text: '确定出售',
active: true,
disabled: false,
href: 'javascript:;',
},
cancelBtn: {
text: '我再想想',
active: false,
disabled: false,
href: 'javascript:;'
},
onConfirm: () => {
this.sellerPublish({price: this.price, skup: this.skup, address_id: this.addressInfo.address_id})
.then((res) => {
if (res && res.code && res.code == 200) {
this.$createToast({
time: 1000,
type: 'txt',
txt: '出售成功'
}).show();
this.$router.go(-1);
} else {
this.$createToast({
time: 1000,
type: 'txt',
txt: res.message
}).show();
}
});
},
onCancel: () => {
this.computePrice();
}
}).show();
} else {
this.sellerPublish({price: this.price, skup: this.skup, address_id: this.addressInfo.address_id})
.then((res) => {
if (res && res.code && res.code == 200) {
this.payOrder();
} else {
this.$createToast({
time: 1000,
type: 'txt',
txt: res.message
}).show();
}
});
}
},
payOrder() {
let vm = this;
this.$createOrderPayType({
price: get(this.computeTip, 'earnestMoney', 0),
desc: '保证金',
orderCode: get(this.publishinfo, 'orderCode', ''),
extra: JSON.stringify({
type: 'sell',
back: {
name: 'ProductDetail',
params: {
productId: get(this.originProductData, 'productId', '')
}
},
forward: {
name: 'SellPayOk',
query: {
orderCode: get(this.publishinfo, 'orderCode', '')
}
}
}),
onCloseAction() {
vm.onClose(get(this.publishinfo, 'orderCode', ''));
}
}).show();
},
showToast() {
this.SELLER_ASK_SET_IS_SHOWTOAST(false);
this.$createToast({
time: 1000,
type: 'txt',
txt: this.toastMessage
}).show();
},
onClose(orderCode) {
if (orderCode) {
this.$router.replace({
name: 'sellOrderDetail',
params: {
owner: 'sell',
code: orderCode
}
});
}
}
}
};
</script>
<style lang="scss" scoped>
.body {
height: 100%;
margin: 0 40px;
padding-bottom: 200px;
overflow-y: auto;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
z-index: 1;
}
.inputView {
width: calc(100%);
height: 50*2px;
border-radius: 5*2px;
display: flex;
flex-direction: row;
align-items: center;
background-color: #f5f5f5;
}
.inputViewIcon{
line-height: 50*2px;
font-size: 20*2px;
color: #000;
margin-left: 10*2px;
}
.wordText {
margin-left: 10*2px;
font-family: "DIN Alternate";
font-size: 20*2px;
height: 50*2px;
line-height: 50*2px;
color: #000;
width: 100%;
background-color: transparent;
}
.agree-wrapper {
height: 60px;
background-color: white;
border-top: 1px solid #eee;
padding: 0 40px;
line-height: 60px;
}
.order-item {
padding-top: 40px;
padding-bottom: 40px;
}
.order-item + .order-item {
border-top: 1px solid #eee;
}
.submit-btn {
height: 80px;
line-height: 80px;
font-size: 28px;
}
.btn-wrapper {
padding: 0 40px 40px;
background-color: white;
}
</style>