Authored by TaoHuang

fix by huangtao

@@ -40,7 +40,9 @@ export default { @@ -40,7 +40,9 @@ export default {
40 name: 'BuyOrderConfirm', 40 name: 'BuyOrderConfirm',
41 props: ['productId', 'storageId'], 41 props: ['productId', 'storageId'],
42 data() { 42 data() {
43 - return {}; 43 + return {
  44 + isActive: false
  45 + };
44 }, 46 },
45 components: { 47 components: {
46 ProductInfo, 48 ProductInfo,
@@ -54,6 +56,10 @@ export default { @@ -54,6 +56,10 @@ export default {
54 }, 56 },
55 activated() { 57 activated() {
56 this.init(); 58 this.init();
  59 + this.isActive = true;
  60 + },
  61 + deactivated() {
  62 + this.isActive = false;
57 }, 63 },
58 beforeRouteLeave(to, from, next) { 64 beforeRouteLeave(to, from, next) {
59 if (to.name !== 'address') { 65 if (to.name !== 'address') {
@@ -85,7 +91,9 @@ export default { @@ -85,7 +91,9 @@ export default {
85 watch: { 91 watch: {
86 address: { 92 address: {
87 handler() { 93 handler() {
88 - this.compute(); 94 + if (this.isActive) {
  95 + this.compute();
  96 + }
89 }, 97 },
90 deep: true 98 deep: true
91 } 99 }
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 </div> 7 </div>
8 <div class="num-wrapper" v-if="superSell"> 8 <div class="num-wrapper" v-if="superSell">
9 <i class="iconfont iconplus-minus icon-class" @click="onMinus"></i> 9 <i class="iconfont iconplus-minus icon-class" @click="onMinus"></i>
10 - <span class="icon-class count">{{count}}</span> 10 + <span class="icon-class count">{{num}}</span>
11 <i class="iconfont iconi-add icon-class" @click="onAdd"></i> 11 <i class="iconfont iconi-add icon-class" @click="onAdd"></i>
12 </div> 12 </div>
13 </div> 13 </div>
@@ -32,8 +32,7 @@ export default { @@ -32,8 +32,7 @@ export default {
32 }, 32 },
33 data() { 33 data() {
34 return { 34 return {
35 - val: this.value,  
36 - count: this.num 35 + val: this.value
37 }; 36 };
38 }, 37 },
39 methods: { 38 methods: {
@@ -44,20 +43,22 @@ export default { @@ -44,20 +43,22 @@ export default {
44 this.$emit('input', this.$refs.input.value); 43 this.$emit('input', this.$refs.input.value);
45 }, 44 },
46 onMinus() { 45 onMinus() {
47 - if (this.count > 1) {  
48 - this.count -= 1;  
49 - this.$emit('on-num-change', this.count); 46 + if (this.num > 1) {
  47 + const count = this.num - 1;
  48 +
  49 + this.$emit('on-num-change', { count, type: 'minus' });
50 } 50 }
51 }, 51 },
52 onAdd() { 52 onAdd() {
53 - this.count += 1;  
54 - this.$emit('on-num-change', this.count); 53 + const count = this.num + 1;
  54 +
  55 + this.$emit('on-num-change', { count, type: 'add' });
55 } 56 }
56 }, 57 },
57 watch: { 58 watch: {
58 value(newVal) { 59 value(newVal) {
59 this.val = newVal; 60 this.val = newVal;
60 - } 61 + },
61 } 62 }
62 }; 63 };
63 </script> 64 </script>
@@ -21,9 +21,6 @@ export default { @@ -21,9 +21,6 @@ export default {
21 default() { 21 default() {
22 return {}; 22 return {};
23 } 23 }
24 - },  
25 - priceType: {  
26 - type: String,  
27 } 24 }
28 } 25 }
29 }; 26 };
@@ -31,7 +31,7 @@ import OrderMargin from './components/confirm/order-margin'; @@ -31,7 +31,7 @@ import OrderMargin from './components/confirm/order-margin';
31 import OrderFee from './components/confirm/order-fee'; 31 import OrderFee from './components/confirm/order-fee';
32 import OrderAgree from './components/confirm/agree'; 32 import OrderAgree from './components/confirm/agree';
33 import { Types, UserType } from 'store/order/order-confirm'; 33 import { Types, UserType } from 'store/order/order-confirm';
34 -import { get, inRange } from 'lodash'; 34 +import { get } from 'lodash';
35 35
36 import { createNamespacedHelpers, mapState } from 'vuex'; 36 import { createNamespacedHelpers, mapState } from 'vuex';
37 37
@@ -56,6 +56,7 @@ export default { @@ -56,6 +56,7 @@ export default {
56 agreeDesc: '有货卖家协议', 56 agreeDesc: '有货卖家协议',
57 url: 'https://activity.yoho.cn/feature/6773.html?share_id=9479&title=%E9%97%B2%E9%B1%BC%E6%BD%AE%E5%8D%96%E5%AE%B6%E5%8D%8F%E8%AE%AE', 57 url: 'https://activity.yoho.cn/feature/6773.html?share_id=9479&title=%E9%97%B2%E9%B1%BC%E6%BD%AE%E5%8D%96%E5%AE%B6%E5%8D%8F%E8%AE%AE',
58 superSell: false, 58 superSell: false,
  59 + addNumError: false
59 }; 60 };
60 }, 61 },
61 activated() { 62 activated() {
@@ -111,13 +112,15 @@ export default { @@ -111,13 +112,15 @@ export default {
111 productName: get(state.product.selectedProductInfo, 'product.product_name', ''), 112 productName: get(state.product.selectedProductInfo, 'product.product_name', ''),
112 colorName: get(state.product.selectedProductInfo, 'product.goods_list[0].color_name', ''), 113 colorName: get(state.product.selectedProductInfo, 'product.goods_list[0].color_name', ''),
113 sizeName: get(state.product.selectedProductInfo, 'size.size_name', ''), 114 sizeName: get(state.product.selectedProductInfo, 'size.size_name', ''),
  115 + skup: get(state.product.selectedProductInfo, 'size.skup', ''),
114 goodPrice, 116 goodPrice,
115 priceType, 117 priceType,
116 goodBidPrice, 118 goodBidPrice,
117 priceBidType, 119 priceBidType,
118 isSuggest: suggestHighPrice && suggestLowPrice, 120 isSuggest: suggestHighPrice && suggestLowPrice,
119 suggestHighPrice, 121 suggestHighPrice,
120 - suggestLowPrice 122 + suggestLowPrice,
  123 + bidPrice
121 }; 124 };
122 } 125 }
123 }) 126 })
@@ -130,6 +133,34 @@ export default { @@ -130,6 +133,34 @@ export default {
130 this.submit(); 133 this.submit();
131 }, 134 },
132 compute() { 135 compute() {
  136 + if (this.productDetail.bidPrice && (Number(this.price) >= this.productDetail.bidPrice)) {
  137 + this.$createDialog({
  138 + type: 'confirm',
  139 + title: `最高求购价${this.productDetail.bidPrice}`,
  140 + content: '已有求购高于您的出价,可直接变现',
  141 + confirmBtn: {
  142 + text: '我再想想',
  143 + active: true,
  144 + disabled: false,
  145 + },
  146 + cancelBtn: {
  147 + text: '确定变现',
  148 + active: false,
  149 + disabled: false
  150 + },
  151 + onCancel: () => {
  152 + this.$router.replace({
  153 + name: 'sellAskOrder',
  154 + query: {
  155 + skup: this.productDetail.skup,
  156 + price: this.productDetail.bidPrice
  157 + }
  158 + });
  159 + }
  160 + }).show();
  161 + return;
  162 + }
  163 +
133 return this.fetchOrderPrice({ 164 return this.fetchOrderPrice({
134 address_id: this.address?.address_id, 165 address_id: this.address?.address_id,
135 num: this.num, 166 num: this.num,
@@ -138,14 +169,21 @@ export default { @@ -138,14 +169,21 @@ export default {
138 }).then(result => { 169 }).then(result => {
139 if (result.error) { 170 if (result.error) {
140 this.error = result.error; 171 this.error = result.error;
  172 +
141 this.$createToast({ 173 this.$createToast({
142 time: 1500, 174 time: 1500,
143 txt: result.error, 175 txt: result.error,
144 type: 'txt' 176 type: 'txt'
145 }).show(); 177 }).show();
  178 +
  179 + if (result.code === 438) {
  180 + this.addNumError = true;
  181 + }
  182 +
146 return; 183 return;
147 } 184 }
148 this.error = false; 185 this.error = false;
  186 + this.addNumError = false;
149 }); 187 });
150 }, 188 },
151 changePrice(val) { 189 changePrice(val) {
@@ -276,7 +314,12 @@ export default { @@ -276,7 +314,12 @@ export default {
276 } 314 }
277 }); 315 });
278 }, 316 },
279 - onNumChange(count) { 317 + onNumChange({ count, type }) {
  318 + console.log(count, type, this.addNumError);
  319 + if (type === 'add' && this.addNumError) {
  320 + return;
  321 + }
  322 +
280 this[Types.CHANGE_SELL_NUM](count); 323 this[Types.CHANGE_SELL_NUM](count);
281 this.compute(); 324 this.compute();
282 }, 325 },
@@ -31,6 +31,7 @@ export default function() { @@ -31,6 +31,7 @@ export default function() {
31 return { 31 return {
32 namespaced: true, 32 namespaced: true,
33 state: { 33 state: {
  34 + buyAddress: null,
34 address: null, 35 address: null,
35 fee: { 36 fee: {
36 income: '', 37 income: '',
@@ -200,6 +201,7 @@ export default function() { @@ -200,6 +201,7 @@ export default function() {
200 201
201 if (order.code !== 200) { 202 if (order.code !== 200) {
202 return { 203 return {
  204 + code: order.code,
203 error: order.message 205 error: order.message
204 }; 206 };
205 } 207 }