Authored by lea guo

订单:状态管理调用参数补全 review buy qiujun

1 -<template><!--求购用调价对话框--> 1 +<template>
  2 + <!--求购用调价对话框-->
2 <div class="dialog-wrapper" :class="[visible ? 'show' : '']"> 3 <div class="dialog-wrapper" :class="[visible ? 'show' : '']">
3 <div :class="['change-bid-price-wrapper', visible ? 'anim' : '']"> 4 <div :class="['change-bid-price-wrapper', visible ? 'anim' : '']">
4 <div class="change-bid-price-container"> 5 <div class="change-bid-price-container">
@@ -6,7 +7,7 @@ @@ -6,7 +7,7 @@
6 <span>我的求购价:</span> 7 <span>我的求购价:</span>
7 <span>¥{{ goodsInfo.goodPrice }}</span> 8 <span>¥{{ goodsInfo.goodPrice }}</span>
8 </p> 9 </p>
9 - <p class="price-item"> 10 + <p v-if="goodsInfo.bidHighestPrice" class="price-item">
10 <span>现货最高求购价:</span> 11 <span>现货最高求购价:</span>
11 <span>¥{{ goodsInfo.bidHighestPrice.toFixed(2) }}</span> 12 <span>¥{{ goodsInfo.bidHighestPrice.toFixed(2) }}</span>
12 </p> 13 </p>
@@ -18,7 +19,10 @@ @@ -18,7 +19,10 @@
18 type="number" 19 type="number"
19 placeholder="定价需以9结尾 例如1999" 20 placeholder="定价需以9结尾 例如1999"
20 :maxlength="8" 21 :maxlength="8"
21 - :class="[errorTip ? 'ipt-number show-error' : 'ipt-number', 'ufo-font']" 22 + :class="[
  23 + errorTip ? 'ipt-number show-error' : 'ipt-number',
  24 + 'ufo-font'
  25 + ]"
22 v-model="chgPrice" 26 v-model="chgPrice"
23 > 27 >
24 <span class="prepend" slot="prepend">¥</span> 28 <span class="prepend" slot="prepend">¥</span>
@@ -26,10 +30,10 @@ @@ -26,10 +30,10 @@
26 <p class="error-tip">{{ errorTip }}</p> 30 <p class="error-tip">{{ errorTip }}</p>
27 <p 31 <p
28 :class=" 32 :class="
29 - i === computePriceList.length - 1  
30 - ? 'promotion-list-item last'  
31 - : 'promotion-list-item'  
32 - " 33 + i === computePriceList.length - 1
  34 + ? 'promotion-list-item last'
  35 + : 'promotion-list-item'
  36 + "
33 v-for="(priceInfo, i) in computePriceList" 37 v-for="(priceInfo, i) in computePriceList"
34 :key="i" 38 :key="i"
35 > 39 >
@@ -45,18 +49,17 @@ @@ -45,18 +49,17 @@
45 </div> 49 </div>
46 </div> 50 </div>
47 </div> 51 </div>
48 -  
49 </template> 52 </template>
50 53
51 <script> 54 <script>
52 -import { createNamespacedHelpers } from 'vuex';  
53 -import InputUfo from './input-ufo';  
54 -import { debounce } from 'lodash'; 55 +import { createNamespacedHelpers } from "vuex";
  56 +import InputUfo from "./input-ufo";
  57 +import { debounce } from "lodash";
55 58
56 -const { mapActions } = createNamespacedHelpers('order/orderList'); 59 +const { mapActions } = createNamespacedHelpers("order/orderList");
57 60
58 export default { 61 export default {
59 - name: 'change-bid-price-dialog', 62 + name: "change-bid-price-dialog",
60 components: { InputUfo }, 63 components: { InputUfo },
61 props: { 64 props: {
62 computePriceInfo: { 65 computePriceInfo: {
@@ -75,8 +78,8 @@ export default { @@ -75,8 +78,8 @@ export default {
75 data() { 78 data() {
76 return { 79 return {
77 visible: false, 80 visible: false,
78 - chgPrice: '',  
79 - errorTip: '', 81 + chgPrice: "",
  82 + errorTip: "",
80 computePrice: null, 83 computePrice: null,
81 calced: false 84 calced: false
82 }; 85 };
@@ -97,14 +100,15 @@ export default { @@ -97,14 +100,15 @@ export default {
97 }, 100 },
98 methods: { 101 methods: {
99 ...mapActions(["computeChangePrice"]), 102 ...mapActions(["computeChangePrice"]),
100 - async onChange(price) { // 预先算费 103 + async onChange(price) {
  104 + // 预先算费
101 if (this.checkPrice(price)) { 105 if (this.checkPrice(price)) {
102 const res = await this.computeChangePrice({ 106 const res = await this.computeChangePrice({
103 price, 107 price,
104 orderCode: this.orderCode 108 orderCode: this.orderCode
105 }); 109 });
106 110
107 - if (typeof res === 'string') { 111 + if (typeof res === "string") {
108 this.errorTip = res; 112 this.errorTip = res;
109 this.calced = false; 113 this.calced = false;
110 } else { 114 } else {
@@ -125,16 +129,16 @@ export default { @@ -125,16 +129,16 @@ export default {
125 let valid = false; 129 let valid = false;
126 130
127 if (!price) { 131 if (!price) {
128 - this.errorTip = '没有价格'; 132 + this.errorTip = "没有价格";
129 return false; 133 return false;
130 } else if (!/^\d+$/.test(price)) { 134 } else if (!/^\d+$/.test(price)) {
131 - this.errorTip = '价格只能为正整数'; 135 + this.errorTip = "价格只能为正整数";
132 } else if (!/9$/.test(price)) { 136 } else if (!/9$/.test(price)) {
133 - this.errorTip = '出售价格必须以9结尾'; 137 + this.errorTip = "出售价格必须以9结尾";
134 } else if (+price === +this.goodsInfo.goodPrice) { 138 } else if (+price === +this.goodsInfo.goodPrice) {
135 - this.errorTip = '前后价格没有变化'; 139 + this.errorTip = "前后价格没有变化";
136 } else { 140 } else {
137 - this.errorTip = ''; 141 + this.errorTip = "";
138 valid = true; 142 valid = true;
139 } 143 }
140 return valid; 144 return valid;
@@ -142,7 +146,7 @@ export default { @@ -142,7 +146,7 @@ export default {
142 closeAction() { 146 closeAction() {
143 this.hide(); 147 this.hide();
144 this.clearData(); 148 this.clearData();
145 - this.$emit('closeAction'); 149 + this.$emit("closeAction");
146 }, 150 },
147 confirmAction() { 151 confirmAction() {
148 if (this.calced) { 152 if (this.calced) {
@@ -150,17 +154,14 @@ export default { @@ -150,17 +154,14 @@ export default {
150 154
151 this.hide(); 155 this.hide();
152 this.clearData(); 156 this.clearData();
153 - this.$emit('confirmAction', price); 157 + this.$emit("confirmAction", price);
154 } 158 }
155 -  
156 }, 159 },
157 clearData() { 160 clearData() {
158 - this.chgPrice = '';  
159 - this.errorTip = '',  
160 - this.computePrice = null; 161 + this.chgPrice = "";
  162 + (this.errorTip = ""), (this.computePrice = null);
161 this.calced = false; 163 this.calced = false;
162 } 164 }
163 -  
164 }, 165 },
165 watch: { 166 watch: {
166 chgPrice(newVal) { 167 chgPrice(newVal) {
@@ -172,114 +173,114 @@ export default { @@ -172,114 +173,114 @@ export default {
172 </script> 173 </script>
173 174
174 <style lang="scss" scoped> 175 <style lang="scss" scoped>
175 - .dialog-wrapper {  
176 - position: fixed;  
177 - width: 100%;  
178 - height: 100%;  
179 - left: 0;  
180 - top: 0;  
181 - background-color: rgba(0, 0, 0, 0.5);  
182 - z-index: 99;  
183 - display: none;  
184 - align-items: center;  
185 - justify-content: center; 176 +.dialog-wrapper {
  177 + position: fixed;
  178 + width: 100%;
  179 + height: 100%;
  180 + left: 0;
  181 + top: 0;
  182 + background-color: rgba(0, 0, 0, 0.5);
  183 + z-index: 99;
  184 + display: none;
  185 + align-items: center;
  186 + justify-content: center;
186 187
187 - &.show {  
188 - display: flex;  
189 - } 188 + &.show {
  189 + display: flex;
190 } 190 }
  191 +}
191 192
192 - .change-bid-price-wrapper {  
193 - position: absolute;  
194 - width: 600px;  
195 - background-color: #fff;  
196 - transform: scale(0.9); 193 +.change-bid-price-wrapper {
  194 + position: absolute;
  195 + width: 600px;
  196 + background-color: #fff;
  197 + transform: scale(0.9);
197 198
198 - &.anim {  
199 - animation: animateDialog 0.5s cubic-bezier(0.03,1.58,0.79,0.96) forwards;  
200 - } 199 + &.anim {
  200 + animation: animateDialog 0.5s cubic-bezier(0.03, 1.58, 0.79, 0.96) forwards;
201 } 201 }
  202 +}
202 203
203 - .change-bid-price-container {  
204 - background-color: #fff;  
205 - font-size: 24px;  
206 - color: #000;  
207 - padding: 60px 38px 0 38px;  
208 - letter-spacing: 0;  
209 -  
210 - .price-item {  
211 - font-size: 24px;  
212 - line-height: 34px;  
213 - margin-bottom: 10px;  
214 - } 204 +.change-bid-price-container {
  205 + background-color: #fff;
  206 + font-size: 24px;
  207 + color: #000;
  208 + padding: 60px 38px 0 38px;
  209 + letter-spacing: 0;
215 210
216 - .ipt-number {  
217 - margin: 30px 0; 211 + .price-item {
  212 + font-size: 24px;
  213 + line-height: 34px;
  214 + margin-bottom: 10px;
  215 + }
218 216
219 - /deep/ .prepend {  
220 - width: 40px;  
221 - margin-left: 20px;  
222 - text-align: left;  
223 - } 217 + .ipt-number {
  218 + margin: 30px 0;
224 219
225 - &.show-error {  
226 - margin-bottom: 0;  
227 - } 220 + /deep/ .prepend {
  221 + width: 40px;
  222 + margin-left: 20px;
  223 + text-align: left;
228 } 224 }
229 225
230 - .error-tip {  
231 - color: #d0021b;  
232 - margin-bottom: 10px; 226 + &.show-error {
  227 + margin-bottom: 0;
233 } 228 }
  229 + }
234 230
235 - .promotion-list-item {  
236 - display: flex;  
237 - justify-content: space-between;  
238 - align-items: center;  
239 - color: #999;  
240 - margin-bottom: 10px;  
241 - font-size: 24px; 231 + .error-tip {
  232 + color: #d0021b;
  233 + margin-bottom: 10px;
  234 + }
242 235
243 - &.last {  
244 - color: #000;  
245 - }  
246 - } 236 + .promotion-list-item {
  237 + display: flex;
  238 + justify-content: space-between;
  239 + align-items: center;
  240 + color: #999;
  241 + margin-bottom: 10px;
  242 + font-size: 24px;
247 243
248 - .tip {  
249 - color: #999;  
250 - margin: 40px auto;  
251 - font-size: 24px; 244 + &.last {
  245 + color: #000;
252 } 246 }
253 } 247 }
254 248
255 - .buttons-container {  
256 - width: 100%;  
257 - height: 100px;  
258 - display: flex;  
259 - border-top: 1px solid #f0f0f0; 249 + .tip {
  250 + color: #999;
  251 + margin: 40px auto;
  252 + font-size: 24px;
  253 + }
  254 +}
260 255
261 - button {  
262 - width: 100%;  
263 - height: 100%;  
264 - text-align: center;  
265 - line-height: 100px;  
266 - font-size: 32px;  
267 - border: none;  
268 - background-color: #fff;  
269 - } 256 +.buttons-container {
  257 + width: 100%;
  258 + height: 100px;
  259 + display: flex;
  260 + border-top: 1px solid #f0f0f0;
270 261
271 - button + button {  
272 - border-left: 1px solid #f0f0f0;  
273 - } 262 + button {
  263 + width: 100%;
  264 + height: 100%;
  265 + text-align: center;
  266 + line-height: 100px;
  267 + font-size: 32px;
  268 + border: none;
  269 + background-color: #fff;
274 } 270 }
275 271
276 - @keyframes animateDialog {  
277 - 0% {  
278 - transform: scale(0.9);  
279 - } 272 + button + button {
  273 + border-left: 1px solid #f0f0f0;
  274 + }
  275 +}
280 276
281 - 100% {  
282 - transform: scale(1);  
283 - } 277 +@keyframes animateDialog {
  278 + 0% {
  279 + transform: scale(0.9);
  280 + }
  281 +
  282 + 100% {
  283 + transform: scale(1);
284 } 284 }
  285 +}
285 </style> 286 </style>
1 -<template>  
2 - <div class="change-bid-price-wrapper">  
3 - <p class="price-item">  
4 - <span>我的求购价:</span>  
5 - <span>¥{{ goodsInfo.goodPrice }}</span>  
6 - </p>  
7 - <p class="price-item">  
8 - <span>当前最高求购价:</span>  
9 - <span>¥{{ goodsInfo.bidHighestPrice }}</span>  
10 - </p>  
11 - <p v-if="goodsInfo.leastPrice" class="price-item">  
12 - <span>最低现货价:</span>  
13 - <span>¥{{ goodsInfo.leastPrice }}</span>  
14 - </p>  
15 - <InputUfo  
16 - type="number"  
17 - placeholder="定价需以9结尾 例如1999"  
18 - :maxlength="8"  
19 - :class="errorTip ? 'ipt-number show-error' : 'ipt-number'"  
20 - v-model="chgPrice"  
21 - >  
22 - <span class="prepend" slot="prepend">¥</span>  
23 - </InputUfo>  
24 - <p class="error-tip">{{ errorTip }}</p>  
25 - <p  
26 - :class="  
27 - i === computePriceList.length - 1  
28 - ? 'promotion-list-item last'  
29 - : 'promotion-list-item'  
30 - "  
31 - v-for="(priceInfo, i) in computePriceList"  
32 - :key="i"  
33 - >  
34 - <span>{{ priceInfo.promotion }}:</span>  
35 - <span>{{ priceInfo.promotionAmount }}</span>  
36 - </p>  
37 - <p class="tip">Tip: 调整求购价成功后,当前的求购将被关闭</p>  
38 - </div>  
39 -</template>  
40 -  
41 -<script>  
42 -import { createNamespacedHelpers } from "vuex";  
43 -import InputUfo from "../price-change/components/input-ufo";  
44 -import { debounce } from "lodash";  
45 -  
46 -const { mapActions } = createNamespacedHelpers("order/orderList");  
47 -export default {  
48 - components: { InputUfo },  
49 - props: {  
50 - computePriceInfo: {  
51 - type: Object,  
52 - default: () => ({})  
53 - },  
54 - goodsInfo: {  
55 - type: Object,  
56 - default: () => ({})  
57 - },  
58 - orderCode: {  
59 - type: Number,  
60 - default: 0  
61 - },  
62 - onChangePrice: {  
63 - type: Function,  
64 - default: () => {}  
65 - }  
66 - },  
67 - data() {  
68 - return {  
69 - chgPrice: "",  
70 - errorTip: "",  
71 - computePrice: null  
72 - };  
73 - },  
74 -  
75 - computed: {  
76 - computePriceList() {  
77 - const priceInfo = this.computePrice || this.computePriceInfo;  
78 - return priceInfo.promotionFormulaList.filter(  
79 - ({ promotion }) => promotion === "运费" || promotion === "实付金额"  
80 - );  
81 - }  
82 - },  
83 - mounted() {  
84 - // debounce防抖动,输入数字后延迟500毫秒提交  
85 - this.inputChange = debounce(this.onChange.bind(this), 500);  
86 - },  
87 - methods: {  
88 - ...mapActions(["computeChangePrice"]),  
89 - async onChange(price) {  
90 - if (this.checkPrice(price)) {  
91 - const res = await this.computeChangePrice({  
92 - price,  
93 - orderCode: this.orderCode  
94 - });  
95 - if (typeof res === "string") {  
96 - this.errorTip = res;  
97 - this.onChangePrice(0);  
98 - } else {  
99 - this.computePrice = res;  
100 - this.onChangePrice(price);  
101 - }  
102 - } else {  
103 - this.onChangePrice(0);  
104 - }  
105 - },  
106 - checkPrice(price) {  
107 - let valid = false;  
108 -  
109 - if (!price) {  
110 - this.errorTip = "没有价格";  
111 - return false;  
112 - } else if (!/^\d+$/.test(price)) {  
113 - this.errorTip = "价格只能为正整数";  
114 - } else if (!/9$/.test(price)) {  
115 - this.errorTip = "出售价格必须以9结尾";  
116 - } else if (+price === +this.goodsInfo.goodPrice) {  
117 - this.errorTip = "前后价格没有变化";  
118 - } else {  
119 - this.errorTip = "";  
120 - valid = true;  
121 - }  
122 - return valid;  
123 - }  
124 - },  
125 - watch: {  
126 - chgPrice(newVal) {  
127 - this.inputChange(newVal);  
128 - }  
129 - }  
130 -};  
131 -</script>  
132 -  
133 -<style lang="scss" scoped>  
134 -.change-bid-price-wrapper {  
135 - font-size: 12*2px;  
136 - color: #000;  
137 - padding: 0 38px;  
138 - letter-spacing: 0;  
139 -  
140 - .ipt-number {  
141 - margin: 30px 0;  
142 -  
143 - &.show-error {  
144 - margin-bottom: 0;  
145 - }  
146 - }  
147 -  
148 - .error-tip {  
149 - color: #d0021b;  
150 - }  
151 -  
152 - .promotion-list-item {  
153 - display: flex;  
154 - justify-content: space-between;  
155 - align-items: center;  
156 - color: #999;  
157 -  
158 - &.last {  
159 - color: #000;  
160 - }  
161 - }  
162 -  
163 - .tip {  
164 - color: #999;  
165 - margin-top: 40px;  
166 - }  
167 -}  
168 -</style>  
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 import { orderActionsMap, ownType } from 'constants/order-constants'; 3 import { orderActionsMap, ownType } from 'constants/order-constants';
4 import { createNamespacedHelpers } from 'vuex'; 4 import { createNamespacedHelpers } from 'vuex';
5 import DialogConfirmInfo from '../components/dialog-confirm-info'; 5 import DialogConfirmInfo from '../components/dialog-confirm-info';
6 -import DialogChangeBidPrice from '../components/dialog-change-bid-price';  
7 6
8 const { mapActions, mapMutations } = createNamespacedHelpers('order/orderList'); 7 const { mapActions, mapMutations } = createNamespacedHelpers('order/orderList');
9 8
@@ -88,7 +87,7 @@ export default { @@ -88,7 +87,7 @@ export default {
88 if (isDetail) { 87 if (isDetail) {
89 this.fetchOrderDetail(this.$route.params); 88 this.fetchOrderDetail(this.$route.params);
90 } else { 89 } else {
91 - this.resetData(); 90 + this.resetData(this.$route.params);
92 this.fetchData(this.$route.params); 91 this.fetchData(this.$route.params);
93 } 92 }
94 } 93 }
@@ -166,7 +165,7 @@ export default { @@ -166,7 +165,7 @@ export default {
166 if (isDetail) { 165 if (isDetail) {
167 this.fetchOrderDetail(this.$route.params); 166 this.fetchOrderDetail(this.$route.params);
168 } else { 167 } else {
169 - this.resetData(); 168 + this.resetData(this.$route.params);
170 this.fetchData(this.$route.params); 169 this.fetchData(this.$route.params);
171 } 170 }
172 } 171 }
@@ -184,6 +183,7 @@ export default { @@ -184,6 +183,7 @@ export default {
184 }); 183 });
185 184
186 let isStr = false; 185 let isStr = false;
  186 +
187 if (typeof computePriceInfo === 'string') { 187 if (typeof computePriceInfo === 'string') {
188 isStr = true; 188 isStr = true;
189 this.$createToast({ 189 this.$createToast({
@@ -191,29 +191,28 @@ export default { @@ -191,29 +191,28 @@ export default {
191 txt: computePriceInfo, 191 txt: computePriceInfo,
192 mask: true, 192 mask: true,
193 }).show(); 193 }).show();
194 - // return; 194 + return;
195 } 195 }
196 let that = this; 196 let that = this;
197 197
198 this.$createChangeBidPriceDialog({ 198 this.$createChangeBidPriceDialog({
199 - computePriceInfo: isStr ? {"promotionFormulaList":[]} : computePriceInfo, 199 + computePriceInfo: isStr
  200 + ? { promotionFormulaList: [] }
  201 + : computePriceInfo,
200 goodsInfo, 202 goodsInfo,
201 orderCode, 203 orderCode,
202 - onCloseAction() {  
203 - },  
204 - onConfirmAction: async(price) => { 204 + onCloseAction() {},
  205 + onConfirmAction: async price => {
205 const { isOk, errMsg = '' } = await that.confirmChangePrice({ 206 const { isOk, errMsg = '' } = await that.confirmChangePrice({
206 price: price, 207 price: price,
207 orderCode, 208 orderCode,
208 }); 209 });
209 210
210 -  
211 if (isOk) { 211 if (isOk) {
212 if (isDetail) { 212 if (isDetail) {
213 that.$router.back(); 213 that.$router.back();
214 - // that.fetchOrderDetail(this.$route.params);  
215 } else { 214 } else {
216 - that.resetData(); 215 + that.resetData(this.$route.params);
217 that.fetchData(this.$route.params); 216 that.fetchData(this.$route.params);
218 } 217 }
219 } else { 218 } else {
@@ -224,7 +223,7 @@ export default { @@ -224,7 +223,7 @@ export default {
224 }); 223 });
225 } 224 }
226 } 225 }
227 - } 226 + },
228 }).show(); 227 }).show();
229 break; 228 break;
230 } 229 }
@@ -96,7 +96,7 @@ export default { @@ -96,7 +96,7 @@ export default {
96 ...mapActions(["fetchEntryOrderList", "fetchNotEntryOrderList"]), 96 ...mapActions(["fetchEntryOrderList", "fetchNotEntryOrderList"]),
97 ...mapMutations(["resetData"]), 97 ...mapMutations(["resetData"]),
98 onRefresh() { 98 onRefresh() {
99 - this.resetData(); 99 + this.resetData(this.$route.params);
100 this.fetchData(); 100 this.fetchData();
101 }, 101 },
102 fetchData() { 102 fetchData() {
1 <template> 1 <template>
2 - <layout-app :title="$route.params.owner === 'sell' ? '我的出售' : '我的订单'"  
3 - class="list-page">  
4 - <status-nav :status="status" :owner="owner" @select="onStatusChange"/> 2 + <layout-app
  3 + :title="$route.params.owner === 'sell' ? '我的出售' : '我的订单'"
  4 + class="list-page"
  5 + >
  6 + <status-nav :status="status" :owner="owner" @select="onStatusChange" />
5 <div class="content-wrapper"> 7 <div class="content-wrapper">
6 <scroll 8 <scroll
7 @pulling-up="fetchData" 9 @pulling-up="fetchData"
@@ -67,7 +69,7 @@ import CountDown from "../components/count-down"; @@ -67,7 +69,7 @@ import CountDown from "../components/count-down";
67 69
68 import orderActionMixin from "../mixin/order-action"; 70 import orderActionMixin from "../mixin/order-action";
69 import orderInSaleActionMixin from "../mixin/order-in-sale-action"; 71 import orderInSaleActionMixin from "../mixin/order-in-sale-action";
70 -import {orderStatusKey} from "constants/order-constants"; 72 +import { orderStatusKey } from "constants/order-constants";
71 73
72 const STORE_PATH = "order/orderList"; 74 const STORE_PATH = "order/orderList";
73 75
@@ -90,10 +92,10 @@ export default { @@ -90,10 +92,10 @@ export default {
90 }, 92 },
91 props: { 93 props: {
92 owner: String, 94 owner: String,
93 - status: Number, 95 + status: Number
94 }, 96 },
95 computed: { 97 computed: {
96 - ...mapState(['orderListByType']), 98 + ...mapState(["orderListByType"]),
97 orderStatus() { 99 orderStatus() {
98 return this.orderListByType[orderStatusKey(this.owner, this.status)]; 100 return this.orderListByType[orderStatusKey(this.owner, this.status)];
99 }, 101 },
@@ -103,11 +105,13 @@ export default { @@ -103,11 +105,13 @@ export default {
103 options() { 105 options() {
104 const options = { 106 const options = {
105 pullUpLoad: this.orderStatus.pullUpLoad, 107 pullUpLoad: this.orderStatus.pullUpLoad,
106 - bounce: !this.orderStatus.isShowEmpty, 108 + bounce: !this.orderStatus.isShowEmpty
107 }; 109 };
108 110
109 if (this.$refs.scroll && this.$refs.scroll.scroll) { 111 if (this.$refs.scroll && this.$refs.scroll.scroll) {
110 - options.pullDownRefresh = this.isShowEmpty ? false : {txt: '更新成功'}; 112 + options.pullDownRefresh = this.isShowEmpty
  113 + ? false
  114 + : { txt: "更新成功" };
111 } 115 }
112 116
113 return options; 117 return options;
@@ -116,10 +120,10 @@ export default { @@ -116,10 +120,10 @@ export default {
116 120
117 // 获取订单数据 121 // 获取订单数据
118 asyncData({ store, router }) { 122 asyncData({ store, router }) {
119 - const {owner, status} = router.params; 123 + const { owner, status } = router.params;
120 124
121 - store.commit(`${STORE_PATH}/resetData`, {owner, status});  
122 - return store.dispatch(`${STORE_PATH}/fetchOrderList`, {owner, status}); 125 + store.commit(`${STORE_PATH}/resetData`, { owner, status });
  126 + return store.dispatch(`${STORE_PATH}/fetchOrderList`, { owner, status });
123 }, 127 },
124 methods: { 128 methods: {
125 ...mapActions(["fetchOrderList", "confirmReceipt"]), 129 ...mapActions(["fetchOrderList", "confirmReceipt"]),
@@ -127,13 +131,13 @@ export default { @@ -127,13 +131,13 @@ export default {
127 fetchData() { 131 fetchData() {
128 this.fetchOrderList({ 132 this.fetchOrderList({
129 owner: this.owner, 133 owner: this.owner,
130 - status: this.status, 134 + status: this.status
131 }); 135 });
132 }, 136 },
133 onRefresh() { 137 onRefresh() {
134 this.resetData({ 138 this.resetData({
135 owner: this.owner, 139 owner: this.owner,
136 - status: this.status, 140 + status: this.status
137 }); 141 });
138 this.fetchData(); 142 this.fetchData();
139 }, 143 },
@@ -152,11 +156,11 @@ export default { @@ -152,11 +156,11 @@ export default {
152 name: this.$route.name, 156 name: this.$route.name,
153 params: { 157 params: {
154 owner: this.owner, 158 owner: this.owner,
155 - status,  
156 - }, 159 + status
  160 + }
157 }); 161 });
158 - },  
159 - }, 162 + }
  163 + }
160 }; 164 };
161 </script> 165 </script>
162 <style lang="scss" scoped> 166 <style lang="scss" scoped>
@@ -3,7 +3,7 @@ import { @@ -3,7 +3,7 @@ import {
3 sellerOrderStatusList, 3 sellerOrderStatusList,
4 orderStatusKey, 4 orderStatusKey,
5 ownType, 5 ownType,
6 -} from "constants/order-constants"; 6 +} from 'constants/order-constants';
7 7
8 function initialOrderState() { 8 function initialOrderState() {
9 return { 9 return {
@@ -20,7 +20,10 @@ function initialOrderState() { @@ -20,7 +20,10 @@ function initialOrderState() {
20 const initialState = () => { 20 const initialState = () => {
21 const orderListByType = {}; 21 const orderListByType = {};
22 22
23 - [[ownType.BUY, buyerOrderStatusList], [ownType.SELL, sellerOrderStatusList]].forEach(statusInfo => { 23 + [
  24 + [ownType.BUY, buyerOrderStatusList],
  25 + [ownType.SELL, sellerOrderStatusList],
  26 + ].forEach(statusInfo => {
24 statusInfo[1].forEach(orderStatus => { 27 statusInfo[1].forEach(orderStatus => {
25 const key = orderStatusKey(statusInfo[0], orderStatus.value); 28 const key = orderStatusKey(statusInfo[0], orderStatus.value);
26 29
@@ -42,7 +45,7 @@ export default function() { @@ -42,7 +45,7 @@ export default function() {
42 namespaced: true, 45 namespaced: true,
43 state: initialState, 46 state: initialState,
44 mutations: { 47 mutations: {
45 - setOrderList(state, {res, owner, status}) { 48 + setOrderList(state, { res, owner, status }) {
46 let { page, pagetotal, data = [] } = res; 49 let { page, pagetotal, data = [] } = res;
47 const orderState = state.orderListByType[orderStatusKey(owner, status)]; 50 const orderState = state.orderListByType[orderStatusKey(owner, status)];
48 51
@@ -56,7 +59,7 @@ export default function() { @@ -56,7 +59,7 @@ export default function() {
56 orderState.pullUpLoad = false; 59 orderState.pullUpLoad = false;
57 } 60 }
58 }, 61 },
59 - filterOrderList(state, {orderCode, owner, status}) { 62 + filterOrderList(state, { orderCode, owner, status }) {
60 const orderState = state.orderListByType[orderStatusKey(owner, status)]; 63 const orderState = state.orderListByType[orderStatusKey(owner, status)];
61 64
62 orderState.orderList = orderState.orderList.filter( 65 orderState.orderList = orderState.orderList.filter(
@@ -70,7 +73,7 @@ export default function() { @@ -70,7 +73,7 @@ export default function() {
70 setRouteParamStatus(state, status = 1) { 73 setRouteParamStatus(state, status = 1) {
71 state.routeParamStatus = +status; 74 state.routeParamStatus = +status;
72 }, 75 },
73 - resetPartialData(state, {owner, status}) { 76 + resetPartialData(state, { owner, status }) {
74 Object.assign(state.orderListByType[orderStatusKey(owner, status)], { 77 Object.assign(state.orderListByType[orderStatusKey(owner, status)], {
75 page: 1, 78 page: 1,
76 orderList: [], 79 orderList: [],
@@ -78,7 +81,7 @@ export default function() { @@ -78,7 +81,7 @@ export default function() {
78 pullUpLoad: true, 81 pullUpLoad: true,
79 }); 82 });
80 }, 83 },
81 - resetData(state, {owner, status}) { 84 + resetData(state, { owner, status } = {}) {
82 const orderListState = initialOrderState(); 85 const orderListState = initialOrderState();
83 86
84 state.orderListByType[orderStatusKey(owner, status)] = orderListState; 87 state.orderListByType[orderStatusKey(owner, status)] = orderListState;
@@ -94,7 +97,7 @@ export default function() { @@ -94,7 +97,7 @@ export default function() {
94 * } 97 * }
95 * r 98 * r
96 */ 99 */
97 - async fetchOrderList({commit, state}, { owner, status }) { 100 + async fetchOrderList({ commit, state }, { owner, status }) {
98 const { page } = state.orderListByType[orderStatusKey(owner, status)]; 101 const { page } = state.orderListByType[orderStatusKey(owner, status)];
99 102
100 const res = await this.$api.get('/api/order/list', { 103 const res = await this.$api.get('/api/order/list', {
@@ -104,7 +107,7 @@ export default function() { @@ -104,7 +107,7 @@ export default function() {
104 }); 107 });
105 108
106 if (res.code === 200) { 109 if (res.code === 200) {
107 - commit('setOrderList', { res: res.data, owner, status}); 110 + commit('setOrderList', { res: res.data, owner, status });
108 } 111 }
109 }, 112 },
110 113
@@ -125,7 +128,7 @@ export default function() { @@ -125,7 +128,7 @@ export default function() {
125 // data 为true时删除成功 128 // data 为true时删除成功
126 if (code === 200) { 129 if (code === 200) {
127 if (data) { 130 if (data) {
128 - commit('filterOrderList', {orderCode, owner, status}); 131 + commit('filterOrderList', { orderCode, owner, status });
129 } 132 }
130 } 133 }
131 return data; 134 return data;
@@ -199,7 +202,7 @@ export default function() { @@ -199,7 +202,7 @@ export default function() {
199 }); 202 });
200 203
201 if (res.code === 200) { 204 if (res.code === 200) {
202 - return { errMsg: '', isOk: true , bidData: res.data}; 205 + return { errMsg: '', isOk: true, bidData: res.data };
203 } else { 206 } else {
204 return { errMsg: res.message, isOk: false }; 207 return { errMsg: res.message, isOk: false };
205 } 208 }