Authored by TaoHuang

Merge remote-tracking branch 'origin/develop' into develop

1 <template> 1 <template>
2 - <CubeInput v-bind="$attrs" v-bind:value="value" v-on="inputListeners" :maxlength="8" class="input-number"> 2 + <CubeInput v-bind="$attrs" v-bind:value="value" v-bind:needBlur="needBlur" v-on="inputListeners" :maxlength="8" class="input-number">
3 <span slot="prepend"> 3 <span slot="prepend">
4 <slot name="prepend"></slot> 4 <slot name="prepend"></slot>
5 </span> 5 </span>
@@ -14,7 +14,7 @@ import {Input} from 'cube-ui'; @@ -14,7 +14,7 @@ import {Input} from 'cube-ui';
14 14
15 export default { 15 export default {
16 name: 'InputUfo', 16 name: 'InputUfo',
17 - props: ['value'], 17 + props: ['value', 'needBlur'],
18 computed: { 18 computed: {
19 inputListeners() { 19 inputListeners() {
20 return Object.assign({}, 20 return Object.assign({},
@@ -22,11 +22,21 @@ export default { @@ -22,11 +22,21 @@ export default {
22 { 22 {
23 input: (value) => { 23 input: (value) => {
24 this.$emit('input', value); 24 this.$emit('input', value);
  25 + },
  26 + blur: () => {
  27 + this.$emit('blur', this.value);
25 } 28 }
26 } 29 }
27 ); 30 );
28 } 31 }
29 }, 32 },
  33 + methods: {
  34 + onBlur() {
  35 + if (this.needBlur) {
  36 +
  37 + }
  38 + }
  39 + },
30 components: {CubeInput: Input} 40 components: {CubeInput: Input}
31 }; 41 };
32 </script> 42 </script>
@@ -10,8 +10,8 @@ @@ -10,8 +10,8 @@
10 </div> 10 </div>
11 <div class="modal-footer"> 11 <div class="modal-footer">
12 <slot name="footer"> 12 <slot name="footer">
13 - <button class="btn" :class="{active: loading}" type="button" @click="onSure">{{sureText}}</button>  
14 - <button class="btn" type="button" @click="onCancel">{{cancelText}}</button> 13 + <button class="btn" v-if="sureText" :class="{active: loading}" type="button" @click="onSure">{{sureText}}</button>
  14 + <button class="btn cancel-btn" v-if="cancelText" type="button" @click="onCancel">{{cancelText}}</button>
15 </slot> 15 </slot>
16 </div> 16 </div>
17 </div> 17 </div>
@@ -29,11 +29,11 @@ export default { @@ -29,11 +29,11 @@ export default {
29 loading: Boolean, 29 loading: Boolean,
30 sureText: { 30 sureText: {
31 type: String, 31 type: String,
32 - default: '确认' 32 + default: ''
33 }, 33 },
34 cancelText: { 34 cancelText: {
35 type: String, 35 type: String,
36 - default: '取消' 36 + default: ''
37 } 37 }
38 }, 38 },
39 methods: { 39 methods: {
@@ -119,7 +119,7 @@ export default { @@ -119,7 +119,7 @@ export default {
119 display: flex; 119 display: flex;
120 120
121 button { 121 button {
122 - width: 50%; 122 + width: 100%;
123 overflow: hidden; 123 overflow: hidden;
124 height: 100px; 124 height: 100px;
125 background: none; 125 background: none;
@@ -129,6 +129,10 @@ export default { @@ -129,6 +129,10 @@ export default {
129 color: #c94353; 129 color: #c94353;
130 font-weight: 500; 130 font-weight: 500;
131 } 131 }
  132 +
  133 + &.cancel-btn {
  134 + color: #000;
  135 + }
132 } 136 }
133 137
134 button + button { 138 button + button {
@@ -6,12 +6,12 @@ @@ -6,12 +6,12 @@
6 <ImgSize class="pro-img" :src="noEntryOrderInfo.goodsInfo.goodImg || ''" :width="200" :height="200"></ImgSize> 6 <ImgSize class="pro-img" :src="noEntryOrderInfo.goodsInfo.goodImg || ''" :width="200" :height="200"></ImgSize>
7 <div class="pro-info"> 7 <div class="pro-info">
8 <p class="pro-name">{{noEntryOrderInfo.goodsInfo.colorName}}, {{noEntryOrderInfo.goodsInfo.sizeName}}码</p> 8 <p class="pro-name">{{noEntryOrderInfo.goodsInfo.colorName}}, {{noEntryOrderInfo.goodsInfo.sizeName}}码</p>
9 - <p class="stock-info ufo-font">最低售价: ¥{{noEntryOrderInfo.goodsInfo.leastPrice}}</p> 9 + <p class="stock-info ufo-font">最低售价: ¥{{noEntryOrderInfo.goodsInfo.leastPrice || noEntryOrderInfo.goodsInfo.price}}</p>
10 </div> 10 </div>
11 </div> 11 </div>
12 <div class="input-container"> 12 <div class="input-container">
13 <InputUfo type="number" placeholder="定价需以9结尾.例如1999" 13 <InputUfo type="number" placeholder="定价需以9结尾.例如1999"
14 - :maxlength="8" class="ipt-number" v-model="chgPrice"> 14 + :maxlength="8" class="ipt-number ufo-font" v-model="chgPrice" @blur="onChange">
15 <span class="prepend" slot="prepend">¥</span> 15 <span class="prepend" slot="prepend">¥</span>
16 </InputUfo> 16 </InputUfo>
17 </div> 17 </div>
@@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
21 </div> 21 </div>
22 <div class="fee-container"> 22 <div class="fee-container">
23 <div class="fee-line"> 23 <div class="fee-line">
24 - <p class="fee-title">平台费用:</p>  
25 - <p class="fee-price">{{platformFee}}</p> 24 + <p class="fee-title">平台费用: <i class="iconfont iconquestion" @click="showFeeDetail"></i></p>
  25 + <p class="fee-price">{{platformFee.amount}}</p>
26 </div> 26 </div>
27 <div class="fee-line"> 27 <div class="fee-line">
28 <p class="fee-title">银行转账费(1%):</p> 28 <p class="fee-title">银行转账费(1%):</p>
@@ -47,8 +47,37 @@ @@ -47,8 +47,37 @@
47 </p> 47 </p>
48 </div> 48 </div>
49 </div> 49 </div>
  50 + </div>
  51 + <div class="submit-container">
  52 + <div class="agree-container">
  53 + <div class="checkbox">
  54 + <Checkbox :option="labelOption" shape="square" v-model="isAgree"></Checkbox>
  55 + </div>
  56 + <a @click="showAgreement">卖家协议</a>
  57 + </div>
50 58
  59 + <div :class="['submit-button', (isAgree && calced) ? 'active' : '']">
  60 + <button @click="changePrice">提交</button>
  61 + </div>
51 </div> 62 </div>
  63 + <Modal v-model="platformFeeModalVisible" :transfer="true" cancel-text="我知道了">
  64 + <div class="fee-dialog-container">
  65 + <p class="modal-title">平台费用</p>
  66 +
  67 + <p class="fee-line">
  68 + <span class="fee-title">商品鉴定费:</span>
  69 + <span class="fee-price">{{platformFee.appraiseFee}}</span>
  70 + </p>
  71 + <p class="fee-line">
  72 + <span class="fee-title">商品包装费:</span>
  73 + <span class="fee-price">{{platformFee.packageFee}}</span>
  74 + </p>
  75 + <p class="fee-line total">
  76 + <span class="fee-title">平台服务费:</span>
  77 + <span class="fee-price">{{platformFee.serviceFee}}</span>
  78 + </p>
  79 + </div>
  80 + </Modal>
52 </LayoutApp> 81 </LayoutApp>
53 </template> 82 </template>
54 83
@@ -58,22 +87,35 @@ import ScrollView from '../../../components/layout/scroll-view'; @@ -58,22 +87,35 @@ import ScrollView from '../../../components/layout/scroll-view';
58 import ImgSize from '../../../components/img-size'; 87 import ImgSize from '../../../components/img-size';
59 import {createNamespacedHelpers} from 'vuex'; 88 import {createNamespacedHelpers} from 'vuex';
60 import InputUfo from './components/input-ufo'; 89 import InputUfo from './components/input-ufo';
  90 +import {Checkbox} from 'cube-ui';
  91 +import {get} from 'lodash';
  92 +import Modal from './components/modal';
61 93
62 -const {mapState, mapActions, mapMutations} = createNamespacedHelpers('order/priceChange'); 94 +const {mapState, mapActions} = createNamespacedHelpers('order/priceChange');
63 95
64 export default { 96 export default {
65 name: 'noEntryDetail', 97 name: 'noEntryDetail',
66 - components: {InputUfo, ScrollView, LayoutApp, ImgSize}, 98 + components: {Modal, InputUfo, ScrollView, LayoutApp, ImgSize, Checkbox},
67 data() { 99 data() {
68 return { 100 return {
69 title: '', 101 title: '',
70 - platformFee: '-¥0', 102 + platformFeeModalVisible: false,
  103 + platformFee: {
  104 + amount: '-¥0',
  105 + appraiseFee: '¥0.00',
  106 + packageFee: '¥0.00',
  107 + serviceFee: '¥0.00'
  108 + },
71 bankTransferFee: '-¥0', 109 bankTransferFee: '-¥0',
72 income: '¥0', 110 income: '¥0',
73 errorTip: '', 111 errorTip: '',
74 chgPrice: '', 112 chgPrice: '',
75 calced: false, 113 calced: false,
76 earnestMoney: '¥0', 114 earnestMoney: '¥0',
  115 + isAgree: false,
  116 + labelOption: {
  117 + label: '我已阅读并同意'
  118 + }
77 }; 119 };
78 }, 120 },
79 asyncData({store, router}) { 121 asyncData({store, router}) {
@@ -81,12 +123,87 @@ export default { @@ -81,12 +123,87 @@ export default {
81 }, 123 },
82 mounted() { 124 mounted() {
83 // this.fetchOrder({orderCode: this.$route.params.orderCode}); 125 // this.fetchOrder({orderCode: this.$route.params.orderCode});
  126 + // this.inputChange = debounce(this.onChange.bind(this), 500);
84 }, 127 },
85 computed: { 128 computed: {
86 - ...mapState(['noEntryOrderInfo']), 129 + ...mapState(['noEntryOrderInfo', 'fetching']),
  130 + postLoading() {
  131 + return this.fetchingChangePrice || !this.calced;
  132 + }
  133 + },
  134 + watch: {
  135 + chgPrice(newVal) {
  136 + this.calced = false;
  137 + this.platformFee = '-¥0';
  138 + this.bankTransferFee = '-¥0';
  139 + this.income = '¥0';
  140 + this.earnestMoney = '¥0';
  141 + }
87 }, 142 },
88 methods: { 143 methods: {
89 - ...mapActions(['fetchOrder']) 144 + ...mapActions(['fetchOrder', 'postNoEntryCalcPrice', 'postNoEntryChangePrice']),
  145 + showAgreement() {
  146 + console.log('showAgreement');
  147 + },
  148 + checkPrice(price) {
  149 + let valid = false;
  150 +
  151 + if (!price) {
  152 + this.errorTip = '没有价格';
  153 + return false;
  154 + } else if (!/^\d+$/.test(price)) {
  155 + this.errorTip = '价格只能为正整数';
  156 + } else if (!/9$/.test(price)) {
  157 + this.errorTip = '出售价格必须以9结尾';
  158 + } else {
  159 + this.errorTip = '';
  160 + valid = true;
  161 + }
  162 + console.log(this.errorTip, valid);
  163 + return valid;
  164 + },
  165 + changePrice() {
  166 +
  167 + },
  168 + async calcPrice(price) {
  169 + const result = await this.postNoEntryCalcPrice({
  170 + price: price,
  171 + skup: this.noEntryOrderInfo.goodsInfo.skup
  172 + });
  173 +
  174 + console.log(result);
  175 +
  176 + if (result && result.code === 200) {
  177 + this.platformFee = get(result, 'data.platformFee', '');
  178 + this.bankTransferFee = get(result, 'data.bankTransferFee', '');
  179 + this.income = '¥' + get(result, 'data.income', '');
  180 + this.earnestMoney = '¥' + get(result, 'data.earnestMoney', '');
  181 + this.calced = true;
  182 + } else {
  183 + if (result.message) {
  184 + this.errorTip = result.message;
  185 + }
  186 + this.calced = false;
  187 +
  188 + this.$createToast({
  189 + txt: this.errorTip,
  190 + type: 'warn'
  191 + }).show();
  192 + }
  193 + },
  194 + onChange(price) { // 价格改变时(文本框离开焦点)
  195 + if (this.checkPrice(price)) {
  196 + this.calcPrice(price);
  197 + } else {
  198 + this.$createToast({
  199 + txt: this.errorTip,
  200 + type: 'warn'
  201 + }).show();
  202 + }
  203 + },
  204 + showFeeDetail() { // 显示平台费用详情
  205 + this.platformFeeModalVisible = true;
  206 + }
90 } 207 }
91 }; 208 };
92 </script> 209 </script>
@@ -221,6 +338,10 @@ export default { @@ -221,6 +338,10 @@ export default {
221 color: #c94353; 338 color: #c94353;
222 } 339 }
223 } 340 }
  341 +
  342 + .iconquestion {
  343 + font-size: 28px;
  344 + }
224 } 345 }
225 } 346 }
226 347
@@ -229,7 +350,6 @@ export default { @@ -229,7 +350,6 @@ export default {
229 width: 690px; 350 width: 690px;
230 margin: 40px auto 20px auto; 351 margin: 40px auto 20px auto;
231 overflow: hidden; 352 overflow: hidden;
232 - border-bottom: 1px solid #f0f0f0;  
233 353
234 .icon-container { 354 .icon-container {
235 position: absolute; 355 position: absolute;
@@ -250,6 +370,110 @@ export default { @@ -250,6 +370,110 @@ export default {
250 .address-info { 370 .address-info {
251 overflow: hidden; 371 overflow: hidden;
252 padding: 0 0 20px 100px; 372 padding: 0 0 20px 100px;
  373 +
  374 + .user-name {
  375 + font-size: 32px;
  376 + font-weight: 500;
  377 + line-height: 36px;
  378 + margin-bottom: 10px;
  379 + }
  380 +
  381 + .user-address {
  382 + font-size: 24px;
  383 + color: #999;
  384 + line-height: 30px;
  385 + margin-bottom: 10px;
  386 + }
  387 +
  388 + .user-phone {
  389 + font-size: 28px;
  390 + font-weight: bold;
  391 + line-height: 32px;
  392 + }
  393 + }
  394 + }
  395 + }
  396 +
  397 + /deep/ .modal-content {
  398 + width: 570px;
  399 + }
  400 +
  401 + .fee-dialog-container {
  402 + width: 100%;
  403 +
  404 + .modal-title {
  405 + line-height: 120px;
  406 + text-align: center;
  407 + font-size: 28px;
  408 + }
  409 +
  410 + .fee-line {
  411 + margin-bottom: 20px;
  412 + color: #000;
  413 + font-size: 28px;
  414 + display: flex;
  415 +
  416 + .fee-title {
  417 + width: 50%;
  418 + }
  419 +
  420 + .fee-price {
  421 + width: 50%;
  422 + text-align: right;
  423 + }
  424 + }
  425 + }
  426 +
  427 + .submit-container {
  428 + width: 100%;
  429 + height: 180px;
  430 + position: fixed;
  431 + bottom: 0;
  432 + z-index: 9;
  433 +
  434 + .agree-container {
  435 + width: 100%;
  436 + height: 80px;
  437 + border-top: 1px solid #f0f0f0;
  438 + background-color: #fff;
  439 +
  440 + a {
  441 + display: inline-block;
  442 + text-decoration: underline;
  443 + color: #64ad88;
  444 + }
  445 +
  446 + .checkbox {
  447 + display: inline-block;
  448 + }
  449 +
  450 + /deep/ .cube-checkbox-wrap {
  451 + padding: 10px 0;
  452 + color: #999;
  453 +
  454 + .cube-checkbox-label {
  455 + font-size: 0.6rem;
  456 + }
  457 + }
  458 +
  459 + .cube-checkbox_checked .cube-checkbox-ui i {
  460 + color: #0c2b48;
  461 + }
  462 + }
  463 +
  464 + .submit-button {
  465 + width: 100%;
  466 + height: 100px;
  467 + background-color: #ccc;
  468 +
  469 + button {
  470 + width: 100%;
  471 + height: 100%;
  472 + color: #fff;
  473 + }
  474 +
  475 + &.active {
  476 + background-color: #0c2b48;
253 } 477 }
254 } 478 }
255 } 479 }
@@ -159,6 +159,12 @@ export default { @@ -159,6 +159,12 @@ export default {
159 return result || {}; 159 return result || {};
160 }, 160 },
161 161
  162 + /**
  163 + * 入驻商家试算调价
  164 + * @param commit
  165 + * @param payload
  166 + * @returns {Promise<*|{}>}
  167 + */
162 async postCalcPrice({commit}, payload) { 168 async postCalcPrice({commit}, payload) {
163 commit(Types.POST_CALCPRICE_REQUEST); 169 commit(Types.POST_CALCPRICE_REQUEST);
164 const result = await this.$api.get('/api/ufo/sellerOrder/computeAdjustPrice', payload); 170 const result = await this.$api.get('/api/ufo/sellerOrder/computeAdjustPrice', payload);
@@ -175,6 +181,28 @@ export default { @@ -175,6 +181,28 @@ export default {
175 }, 181 },
176 182
177 /** 183 /**
  184 + * 未入驻商家试算调价
  185 + * @param commit
  186 + * @param payload
  187 + * @returns {Promise<{}>}
  188 + */
  189 + async postNoEntryCalcPrice({commit}, payload) {
  190 + commit(Types.POST_NOENTRY_CALCPRICE_REQUEST);
  191 +
  192 + const result = await this.$api.get('/api/ufo/notEntrySeller/computeChangePrice', payload);
  193 +
  194 + if (result && result.code === 200) {
  195 + commit(Types.POST_NOENTRY_CALCPRICE_SUCCESS, {
  196 + order: result.data
  197 + });
  198 + } else {
  199 + commit(Types.POST_NOENTRY_CALCPRICE_FAILED);
  200 + }
  201 +
  202 + return result || {};
  203 + },
  204 +
  205 + /**
178 * 调价 206 * 调价
179 * @param commit 207 * @param commit
180 * @param payload 208 * @param payload
@@ -193,5 +221,26 @@ export default { @@ -193,5 +221,26 @@ export default {
193 } 221 }
194 222
195 return result || {}; 223 return result || {};
  224 + },
  225 +
  226 + /**
  227 + * 未入驻商家调价
  228 + * @param commit
  229 + * @param payload
  230 + * @returns {Promise<*|{}>}
  231 + */
  232 + async postNoEntryChangePrice({commit}, payload) {
  233 + commit(Types.POST_NOENTRY_CHANGE_PRICE_REQUEST);
  234 + const result = await this.$api.get('/api/ufo/notEntrySeller/changePrice', payload);
  235 +
  236 + if (result && result.code === 200) {
  237 + commit(Types.POST_NOENTRY_CHANGE_PRICE_SUCCESS, {
  238 + order: result.data
  239 + });
  240 + } else {
  241 + commit(Types.POST_NOENTRY_CHANGE_PRICE_FAILED);
  242 + }
  243 +
  244 + return result || {};
196 } 245 }
197 }; 246 };
@@ -87,5 +87,30 @@ export default { @@ -87,5 +87,30 @@ export default {
87 87
88 [Types.POST_CALCPRICE_SUCCESS](state) { 88 [Types.POST_CALCPRICE_SUCCESS](state) {
89 state.fetchingCalcPrice = true; 89 state.fetchingCalcPrice = true;
  90 + },
  91 +
  92 + [Types.POST_NOENTRY_CALCPRICE_REQUEST](state) {
  93 + state.fetchingCalcPrice = true;
  94 + },
  95 +
  96 + [Types.POST_NOENTRY_CALCPRICE_FAILED](state) {
  97 + state.fetchingCalcPrice = false;
  98 + },
  99 +
  100 + [Types.POST_NOENTRY_CALCPRICE_SUCCESS](state) {
  101 + state.fetchingCalcPrice = false;
  102 + },
  103 +
  104 + [Types.POST_NOENTRY_CHANGE_PRICE_REQUEST](state) {
  105 + state.fetchingChangePrice = true;
  106 + },
  107 +
  108 + [Types.POST_NOENTRY_CHANGE_PRICE_FAILED](state) {
  109 + state.fetchingChangePrice = false;
  110 + },
  111 +
  112 + [Types.POST_NOENTRY_CHANGE_PRICE_SUCCESS](state) {
  113 + state.fetchingChangePrice = false;
90 } 114 }
  115 +
91 }; 116 };
@@ -73,6 +73,33 @@ module.exports = { @@ -73,6 +73,33 @@ module.exports = {
73 }, 73 },
74 }, 74 },
75 75
  76 + // 未入驻商家试算价格
  77 + '/api/ufo/notEntrySeller/computeChangePrice': {
  78 + auth: true,
  79 + accessLog: true,
  80 + checkSign: true,
  81 + ufo: true,
  82 + api: 'ufo.notEntrySeller.computeChangePrice',
  83 + params: {
  84 + price: { type: Number },
  85 + skup: { type: Number }
  86 + },
  87 + },
  88 +
  89 + // 未入驻商家调价
  90 + '/api/ufo/notEntrySeller/changePrice': {
  91 + auth: true,
  92 + accessLog: true,
  93 + checkSign: true,
  94 + ufo: true,
  95 + api: 'ufo.notEntrySeller.changePrice',
  96 + params: {
  97 + address_id: {type: Number},
  98 + price: { type: Number },
  99 + skup: { type: Number }
  100 + },
  101 + },
  102 +
76 // 调价 103 // 调价
77 '/api/ufo/sellerOrder/batchAdjustPrice': { 104 '/api/ufo/sellerOrder/batchAdjustPrice': {
78 auth: true, 105 auth: true,
@@ -46,8 +46,6 @@ module.exports = (req, res, next) => { @@ -46,8 +46,6 @@ module.exports = (req, res, next) => {
46 46
47 // Todo 删除 600032996 47 // Todo 删除 600032996
48 48
49 - // req.user.uid = 600043484;  
50 -  
51 res.locals.isLogin = Boolean(req.user.uid); // 用户是否登录 49 res.locals.isLogin = Boolean(req.user.uid); // 用户是否登录
52 if (_.get(req, 'user.appSessionType') === 'miniapp') { 50 if (_.get(req, 'user.appSessionType') === 'miniapp') {
53 // miniapp环境下调用接口使用web的version 51 // miniapp环境下调用接口使用web的version