Authored by htoooth

Merge remote-tracking branch 'origin/feature/ufo' into feature/ufo

  1 +10.3.0
@@ -5,7 +5,7 @@ import { @@ -5,7 +5,7 @@ import {
5 } from 'store/yoho/types'; 5 } from 'store/yoho/types';
6 import {createApp} from './app'; 6 import {createApp} from './app';
7 import {createApi} from 'create-api'; 7 import {createApi} from 'create-api';
8 -import {Style, Toast} from 'cube-ui'; //eslint-disable-line 8 +import {Style, Toast, Dialog} from 'cube-ui'; //eslint-disable-line
9 import Lazy from 'vue-lazyload'; 9 import Lazy from 'vue-lazyload';
10 import 'statics/scss/common.scss'; 10 import 'statics/scss/common.scss';
11 import 'statics/font/iconfont.css'; 11 import 'statics/font/iconfont.css';
@@ -19,6 +19,7 @@ if (window.__INITIAL_STATE__) { @@ -19,6 +19,7 @@ if (window.__INITIAL_STATE__) {
19 19
20 // Vue.prop('yoho', yoho); 20 // Vue.prop('yoho', yoho);
21 Vue.use(Toast); 21 Vue.use(Toast);
  22 +Vue.use(Dialog);
22 Vue.prop('api', createApi()); 23 Vue.prop('api', createApi());
23 Vue.use(Lazy, {error: ''}); 24 Vue.use(Lazy, {error: ''});
24 25
@@ -64,7 +64,7 @@ export default { @@ -64,7 +64,7 @@ export default {
64 right: 0; 64 right: 0;
65 background-color: rgba(0, 0, 0, 0.4); 65 background-color: rgba(0, 0, 0, 0.4);
66 height: 100%; 66 height: 100%;
67 - z-index: 1000; 67 + z-index: 99;
68 68
69 &-hidden { 69 &-hidden {
70 display: none; 70 display: none;
@@ -88,7 +88,7 @@ export default { @@ -88,7 +88,7 @@ export default {
88 right: 0; 88 right: 0;
89 bottom: 0; 89 bottom: 0;
90 left: 0; 90 left: 0;
91 - z-index: 1000; 91 + z-index: 99;
92 -webkit-overflow-scrolling: touch; 92 -webkit-overflow-scrolling: touch;
93 outline: 0; 93 outline: 0;
94 } 94 }
@@ -27,6 +27,7 @@ import {debounce} from 'lodash'; @@ -27,6 +27,7 @@ import {debounce} from 'lodash';
27 import InputUfo from '../../components/input-ufo'; 27 import InputUfo from '../../components/input-ufo';
28 import Modal from '../../components/modal.vue'; 28 import Modal from '../../components/modal.vue';
29 import {createNamespacedHelpers} from 'vuex'; 29 import {createNamespacedHelpers} from 'vuex';
  30 +import {get} from 'lodash';
30 31
31 const {mapActions} = createNamespacedHelpers('ufo/order'); 32 const {mapActions} = createNamespacedHelpers('ufo/order');
32 33
@@ -52,6 +53,9 @@ export default { @@ -52,6 +53,9 @@ export default {
52 methods: { 53 methods: {
53 ...mapActions(['postCalcPrice']), 54 ...mapActions(['postCalcPrice']),
54 show({skc, product}) { 55 show({skc, product}) {
  56 + this.chgPrice = '';
  57 + this.errorTip = '';
  58 + this.prices = [];
55 this.skc = skc; 59 this.skc = skc;
56 this.product = product; 60 this.product = product;
57 this.visiable = true; 61 this.visiable = true;
@@ -71,16 +75,26 @@ export default { @@ -71,16 +75,26 @@ export default {
71 product_id: this.product.productId, 75 product_id: this.product.productId,
72 storage_id: this.skc.storageId, 76 storage_id: this.skc.storageId,
73 new_price: price, 77 new_price: price,
74 - old_price: this.skc.goodPrice, 78 + old_price: this.skc.price,
75 num: this.skc.storageNum 79 num: this.skc.storageNum
76 }); 80 });
77 81
78 if (result && result.code === 200) { 82 if (result && result.code === 200) {
  83 + this.prices = [{
  84 + label: '平台费用:',
  85 + money: get(result, 'data.platformFee.amount', '')
  86 + }, {
  87 + label: '银行转账费用:',
  88 + money: get(result, 'data.bankTransferFee', '')
  89 + }, {
  90 + label: '实际收入:',
  91 + money: get(result, 'data.income', ''),
  92 + total: true
  93 + }];
79 } else { 94 } else {
80 this.$createToast({ 95 this.$createToast({
81 txt: result.message || '计算失败', 96 txt: result.message || '计算失败',
82 type: 'warn', 97 type: 'warn',
83 - zIndex: 1000  
84 }).show(); 98 }).show();
85 } 99 }
86 }, 100 },
@@ -94,6 +108,14 @@ export default { @@ -94,6 +108,14 @@ export default {
94 this.errorTip = '价格只能为正整数'; 108 this.errorTip = '价格只能为正整数';
95 } else if (!/9$/.test(price)) { 109 } else if (!/9$/.test(price)) {
96 this.errorTip = '出售价格必须以9结尾'; 110 this.errorTip = '出售价格必须以9结尾';
  111 + } else if (price < this.skc.minPrice) {
  112 + this.errorTip = '您的出价过低';
  113 + } else if (price > this.skc.maxPrice) {
  114 + this.errorTip = '您的出价格过高';
  115 + } else if (price === this.skc.price) {
  116 + this.errorTip = '前后价格没有变化';
  117 + } else if (price === this.skc.price) {
  118 + this.errorTip = '前后价格没有变化'; //TODO
97 } else { 119 } else {
98 this.errorTip = ''; 120 this.errorTip = '';
99 valid = true; 121 valid = true;
@@ -105,7 +127,6 @@ export default { @@ -105,7 +127,6 @@ export default {
105 this.$createToast({ 127 this.$createToast({
106 txt: this.errorTip, 128 txt: this.errorTip,
107 type: 'warn', 129 type: 'warn',
108 - zIndex: 1000  
109 }).show(); 130 }).show();
110 } else { 131 } else {
111 this.$emit('on-change-price', {skc: this.skc, price: this.chgPrice}); 132 this.$emit('on-change-price', {skc: this.skc, price: this.chgPrice});
@@ -30,21 +30,42 @@ export default { @@ -30,21 +30,42 @@ export default {
30 data() { 30 data() {
31 return { 31 return {
32 visiable: false, 32 visiable: false,
  33 + skc: {},
33 unStockNum: 1, 34 unStockNum: 1,
34 storageNum: 1, 35 storageNum: 1,
35 }; 36 };
36 }, 37 },
37 methods: { 38 methods: {
38 - show({storageNum}) {  
39 - this.storageNum = storageNum; 39 + show({skc}) {
  40 + this.skc = skc;
  41 + this.unStockNum = 1;
  42 + this.storageNum = skc.storageNum;
40 this.visiable = true; 43 this.visiable = true;
41 }, 44 },
42 hide() { 45 hide() {
  46 + this.skc = {};
43 this.storageNum = 1; 47 this.storageNum = 1;
  48 + this.unStockNum = 1;
44 this.visiable = false; 49 this.visiable = false;
45 }, 50 },
46 onSure() { 51 onSure() {
47 - this.$emit('on-no-sale', this.unStockNum); 52 + this.$createDialog({
  53 + type: 'confirm',
  54 + content: '您确定不卖此商品吗?',
  55 + confirmBtn: {
  56 + text: '确定',
  57 + active: true,
  58 + disabled: false,
  59 + },
  60 + cancelBtn: {
  61 + text: '取消',
  62 + active: false,
  63 + disabled: false,
  64 + },
  65 + onConfirm: () => {
  66 + this.$emit('on-no-sale', {skc: this.skc, num: this.unStockNum});
  67 + },
  68 + }).show();
48 }, 69 },
49 onInput(val) { 70 onInput(val) {
50 this.$emit('input', val); 71 this.$emit('input', val);
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <div class="info"> 5 <div class="info">
6 <div class="left"> 6 <div class="left">
7 <span class="size">{{value.goodsInfo.sizeName}}</span> 7 <span class="size">{{value.goodsInfo.sizeName}}</span>
8 - <span class="l-size">1/3</span> 8 + <span class="l-size"></span>
9 <span class="unit">码</span> 9 <span class="unit">码</span>
10 </div> 10 </div>
11 <div class="middle"> 11 <div class="middle">
@@ -88,7 +88,7 @@ export default { @@ -88,7 +88,7 @@ export default {
88 return; 88 return;
89 } 89 }
90 90
91 - if (0 - distance > 20 && !this.move) { 91 + if (0 - distance > 20) {
92 this.$emit('on-slide', this.value); 92 this.$emit('on-slide', this.value);
93 this.move = true; 93 this.move = true;
94 } 94 }
1 <template> 1 <template>
2 <div class="product-group"> 2 <div class="product-group">
3 <ProductItem 3 <ProductItem
4 - v-for="(skc, i) in skcs"  
5 - :key="i" 4 + v-for="skc in skcs"
  5 + :key="skc.goodsInfo.storageId"
6 :value="skc" 6 :value="skc"
7 :slideValue="slideSkc" 7 :slideValue="slideSkc"
8 @on-change-price="onChangePrice" 8 @on-change-price="onChangePrice"
@@ -37,6 +37,10 @@ export default { @@ -37,6 +37,10 @@ export default {
37 }, 37 },
38 onSlide(val) { 38 onSlide(val) {
39 this.slideSkc = val; 39 this.slideSkc = val;
  40 + },
  41 + reset() {
  42 + console.log('this.slideSkc')
  43 + this.slideSkc = {};
40 } 44 }
41 }, 45 },
42 components: {ProductItem} 46 components: {ProductItem}
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 </p> 17 </p>
18 </div> 18 </div>
19 <ProductList 19 <ProductList
  20 + ref="productList"
20 :skcs="skcs" 21 :skcs="skcs"
21 @on-change-price="onChangePrice" 22 @on-change-price="onChangePrice"
22 @on-no-sale="onNoSale" 23 @on-no-sale="onNoSale"
@@ -59,6 +60,7 @@ export default { @@ -59,6 +60,7 @@ export default {
59 classes: {}, 60 classes: {},
60 page: 1, 61 page: 1,
61 modalLoad: false, 62 modalLoad: false,
  63 + pageSize: 10,
62 }; 64 };
63 }, 65 },
64 mounted() { 66 mounted() {
@@ -72,25 +74,47 @@ export default { @@ -72,25 +74,47 @@ export default {
72 }, 74 },
73 methods: { 75 methods: {
74 ...mapActions(['fetchProduct', 'postChangePrice', 'postNoSale']), 76 ...mapActions(['fetchProduct', 'postChangePrice', 'postNoSale']),
75 - onPullingUp() {  
76 - this.fetchProduct({ 77 + async onPullingUp() {
  78 + const beginCount = this.skcs.length;
  79 +
  80 + await this.fetchProduct({
77 productId: this.$route.params.orderId, 81 productId: this.$route.params.orderId,
78 - page: this.page + 1 82 + page: this.page + 1,
  83 + pageSize: this.pageSize
79 }); 84 });
  85 + const afterCount = this.skcs.length;
  86 +
  87 + if (afterCount > beginCount) {
  88 + this.page++;
  89 + }
80 this.$refs.scroll.forceUpdate(); 90 this.$refs.scroll.forceUpdate();
81 }, 91 },
82 onChangePrice(skc) { 92 onChangePrice(skc) {
83 this.$refs.modalPrice.show({skc, product: this.productInfo}); 93 this.$refs.modalPrice.show({skc, product: this.productInfo});
84 }, 94 },
85 - onNoSale(productInfo) {  
86 - this.$refs.modalUnstock.show(productInfo); 95 + onNoSale(skc) {
  96 + this.$refs.modalUnstock.show({skc});
  97 + },
  98 + refreshProduct(storageId) {
  99 + const findInx = this.skcs.findIndex(skc => skc.goodsInfo.storageId === storageId);
  100 + const findPage = parseInt(findInx / this.pageSize, 10) + ((findInx % this.pageSize) ? 1 : 0);
  101 +
  102 +console.log(findInx, findPage)
  103 + this.fetchProduct({
  104 + productId: this.$route.params.orderId,
  105 + page: findPage,
  106 + refresh: false,
  107 + storageId
  108 + });
87 }, 109 },
88 async onChangePriceSure({skc, price}) { 110 async onChangePriceSure({skc, price}) {
  111 + this.refreshProduct(skc.storageId);
  112 + return;
89 const result = await this.postChangePrice({ 113 const result = await this.postChangePrice({
90 product_id: this.productInfo.productId, 114 product_id: this.productInfo.productId,
91 storage_id: skc.storageId, 115 storage_id: skc.storageId,
92 new_price: price, 116 new_price: price,
93 - old_price: skc.goodPrice, 117 + old_price: skc.price,
94 num: skc.storageNum 118 num: skc.storageNum
95 }); 119 });
96 120
@@ -99,36 +123,35 @@ export default { @@ -99,36 +123,35 @@ export default {
99 this.$createToast({ 123 this.$createToast({
100 txt: '调价成功', 124 txt: '调价成功',
101 type: 'success', 125 type: 'success',
102 - zIndex: 1000  
103 }).show(); 126 }).show();
  127 + this.refreshProduct(skc.storageId);
104 } else { 128 } else {
105 this.$createToast({ 129 this.$createToast({
106 txt: result.message || '调价失败', 130 txt: result.message || '调价失败',
107 type: 'warn', 131 type: 'warn',
108 - zIndex: 1000  
109 }).show(); 132 }).show();
110 } 133 }
111 }, 134 },
112 - async onNoSaleSure({skc, price}) { 135 + async onNoSaleSure({skc, num}) {
113 const result = await this.postNoSale({ 136 const result = await this.postNoSale({
114 product_id: this.productInfo.productId, 137 product_id: this.productInfo.productId,
115 storage_id: skc.storageId, 138 storage_id: skc.storageId,
116 - new_price: price,  
117 - old_price: skc.goodPrice,  
118 - num: skc.storageNum 139 + old_price: skc.price,
  140 + num: num
119 }); 141 });
120 142
121 if (result.code === 200) { 143 if (result.code === 200) {
122 this.$refs.modalUnstock.hide(); 144 this.$refs.modalUnstock.hide();
  145 + this.$refs.productList.reset();
123 this.$createToast({ 146 this.$createToast({
124 txt: '下架成功', 147 txt: '下架成功',
125 type: 'correct' 148 type: 'correct'
126 }).show(); 149 }).show();
  150 + this.refreshProduct(skc.storageId);
127 } else { 151 } else {
128 this.$createToast({ 152 this.$createToast({
129 txt: result.message || '下架失败', 153 txt: result.message || '下架失败',
130 type: 'warn', 154 type: 'warn',
131 - zIndex: 1000  
132 }).show(); 155 }).show();
133 } 156 }
134 this.slideSkc = {}; 157 this.slideSkc = {};
1 @charset "utf-8"; 1 @charset "utf-8";
2 2
3 -  
4 /* stylelint-disable */ 3 /* stylelint-disable */
5 4
6 /*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */ 5 /*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
  1 +@require "~cube-ui/src/common/stylus/var/color.styl"
  2 +
  3 +// action-sheet
  4 +$action-sheet-color := $color-grey
  5 +$action-sheet-active-color := $color-orange
  6 +$action-sheet-bgc := $color-white
  7 +$action-sheet-active-bgc := $color-light-grey-opacity
  8 +$action-sheet-title-color := $color-dark-grey
  9 +$action-sheet-space-bgc := $color-mask-bg
  10 +/// picker style
  11 +$action-sheet-picker-cancel-color := $color-light-grey
  12 +$action-sheet-picker-cancel-active-color := $color-light-grey-s
  13 +
  14 +// bubble
  15 +
  16 +// button
  17 +$btn-color := $color-white
  18 +$btn-bgc := $color-regular-blue
  19 +$btn-bdc := $color-regular-blue
  20 +$btn-active-bgc := $color-blue
  21 +$btn-active-bdc := $color-blue
  22 +$btn-disabled-color := $color-white
  23 +$btn-disabled-bgc := $color-light-grey-s
  24 +$btn-disabled-bdc := $color-light-grey-s
  25 +/// primary
  26 +$btn-primary-color := $color-white
  27 +$btn-primary-bgc := $color-orange
  28 +$btn-primary-bdc := $color-orange
  29 +$btn-primary-active-bgc := $color-dark-orange
  30 +$btn-primary-active-bdc := $color-dark-orange
  31 +/// light
  32 +$btn-light-color := $color-grey
  33 +$btn-light-bgc := $color-light-grey-sss
  34 +$btn-light-bdc := $color-light-grey-sss
  35 +$btn-light-active-bgc := $color-active-grey
  36 +$btn-light-active-bdc := $color-active-grey
  37 +/// outline
  38 +$btn-outline-color := $color-grey
  39 +$btn-outline-bgc := transparent
  40 +$btn-outline-bdc := $color-grey
  41 +$btn-outline-active-bgc := $color-grey-opacity
  42 +$btn-outline-active-bdc := $color-grey
  43 +/// outline-primary
  44 +$btn-outline-primary-color := $color-orange
  45 +$btn-outline-primary-bgc := transparent
  46 +$btn-outline-primary-bdc := $color-orange
  47 +$btn-outline-primary-active-bgc := $color-orange-opacity
  48 +$btn-outline-primary-active-bdc := $color-dark-orange
  49 +
  50 +// toolbar
  51 +$toolbar-bgc := $color-light-grey-sss
  52 +$toolbar-active-bgc := $color-active-grey
  53 +
  54 +// checkbox
  55 +$checkbox-color := $color-grey
  56 +$checkbox-icon-color := $color-light-grey-s
  57 +/// checked
  58 +$checkbox-checked-icon-color := $color-orange
  59 +$checkbox-checked-icon-bgc := $color-white
  60 +/// disabled
  61 +$checkbox-disabled-icon-color := $color-light-grey-ss
  62 +$checkbox-disabled-icon-bgc := $color-light-grey-ss
  63 +// checkbox hollow
  64 +$checkbox-hollow-checked-icon-color := $color-orange
  65 +$checkbox-hollow-disabled-icon-color := $color-light-grey-ss
  66 +// checkbox-group
  67 +$checkbox-group-bgc := $color-white
  68 +$checkbox-group-horizontal-bdc := $color-light-grey-s
  69 +
  70 +// radio
  71 +$radio-group-bgc := $color-white
  72 +$radio-group-horizontal-bdc := $color-light-grey-s
  73 +$radio-color := $color-grey
  74 +$radio-icon-color := $color-light-grey-s
  75 +/// selected
  76 +$radio-selected-icon-color := $color-white
  77 +$radio-selected-icon-bgc := $color-orange
  78 +/// disabled
  79 +$radio-disabled-icon-bgc := $color-light-grey-ss
  80 +// radio hollow
  81 +$radio-hollow-selected-icon-color := $color-orange
  82 +$radio-hollow-disabled-icon-color := $color-light-grey-ss
  83 +
  84 +// dialog
  85 +$dialog-color := $color-grey
  86 +$dialog-bgc := $color-white
  87 +$dialog-icon-color := $color-regular-blue
  88 +$dialog-icon-bgc := $color-background
  89 +$dialog-title-color := $color-dark-grey
  90 +$dialog-close-color := $color-light-grey
  91 +$dialog-btn-color := $color-light-grey
  92 +$dialog-btn-bgc := $color-white
  93 +$dialog-btn-active-bgc := $color-light-grey-opacity
  94 +$dialog-btn-highlight-color := #000
  95 +$dialog-btn-highlight-active-bgc := rgba(0, 0, 0, .04)
  96 +$dialog-btn-disabled-color := $color-light-grey
  97 +$dialog-btn-disabled-active-bgc := transparent
  98 +$dialog-btns-split-color := $color-row-line
  99 +
  100 +// index-list
  101 +$index-list-bgc := $color-white
  102 +$index-list-title-color := $color-dark-grey
  103 +$index-list-anchor-color := $color-light-grey
  104 +$index-list-anchor-bgc := #f7f7f7
  105 +$index-list-item-color := $color-dark-grey
  106 +$index-list-item-active-bgc := $color-light-grey-opacity
  107 +$index-list-nav-color := $color-grey
  108 +$index-list-nav-active-color := $color-orange
  109 +
  110 +// loading
  111 +
  112 +// picker
  113 +$picker-bgc := $color-white
  114 +$picker-title-color := $color-dark-grey
  115 +$picker-subtitle-color := $color-light-grey
  116 +$picker-confirm-btn-color := $color-orange
  117 +$picker-confirm-btn-active-color := $color-light-orange
  118 +$picker-cancel-btn-color := $color-light-grey
  119 +$picker-cancel-btn-active-color := $color-light-grey-s
  120 +$picker-item-color := $color-dark-grey
  121 +
  122 +// popup
  123 +$popup-mask-bgc := rgb(37, 38, 45)
  124 +$popup-mask-opacity := .4
  125 +
  126 +//scroll
  127 +
  128 +// slide
  129 +$slide-dot-bgc := $color-light-grey-s
  130 +$slide-dot-active-bgc := $color-orange
  131 +
  132 +// time-picker
  133 +
  134 +// tip
  135 +$tip-color := $color-white
  136 +$tip-bgc := $color-dark-grey-opacity
  137 +
  138 +// toast
  139 +$toast-color := $color-light-grey-s
  140 +$toast-bgc := rgba(37, 38, 45, 0.9)
  141 +
  142 +// upload
  143 +$upload-btn-color := $color-grey
  144 +$upload-btn-bgc := $color-white
  145 +$upload-btn-active-bgc := $color-light-grey-opacity
  146 +$upload-btn-box-shadow := 0 0 6px 2px $color-grey-opacity
  147 +$upload-btn-border-color := #e5e5e5
  148 +$upload-file-bgc := $color-white
  149 +$upload-file-remove-color := rgba(0, 0, 0, .8)
  150 +$upload-file-remove-bgc := $color-white
  151 +$upload-file-state-bgc := $color-mask-bg
  152 +$upload-file-success-color := $color-orange
  153 +$upload-file-error-color := #f43530
  154 +$upload-file-status-bgc := $color-white
  155 +$upload-file-progress-color := $color-white
  156 +
  157 +// switch
  158 +$switch-on-bgc := $color-orange
  159 +$switch-off-bgc := $color-white
  160 +$switch-off-border-color := #e4e4e4
  161 +
  162 +// input
  163 +$input-color := $color-grey
  164 +$input-bgc := $color-white
  165 +$input-border-color := $color-row-line
  166 +$input-focus-border-color := $color-orange
  167 +$input-placeholder-color := $color-light-grey-s
  168 +$input-clear-icon-color := $color-light-grey
  169 +
  170 +//textarea
  171 +$textarea-color := $color-grey
  172 +$textarea-bgc := $color-white
  173 +$textarea-border-color := $color-row-line
  174 +$textarea-focus-border-color := $color-orange
  175 +$textarea-outline-color := $color-orange
  176 +$textarea-placeholder-color := $color-light-grey-s
  177 +$textarea-indicator-color := $color-light-grey-s
  178 +
  179 +// validator
  180 +$validator-msg-def-color := #e64340
  181 +
  182 +// select
  183 +$select-color := $color-grey
  184 +$select-bgc := $color-white
  185 +$select-disabled-color := #b8b8b8
  186 +$select-disabled-bgc := $color-light-grey-opacity
  187 +$select-border-color := $color-light-grey-s
  188 +$select-border-active-color := $color-orange
  189 +$select-icon-color := $color-light-grey
  190 +$select-placeholder-color := $color-light-grey-s
  191 +
  192 +// swipe
  193 +$swipe-btn-color := $color-white
  194 +
  195 +// form
  196 +$form-color := $color-grey
  197 +$form-bgc := $color-white
  198 +$form-invalid-color := #e64340
  199 +$form-group-legend-color := $color-light-grey
  200 +$form-group-legend-bgc := $color-background
  201 +$form-label-required-color := #e64340
  202 +
  203 +// drawer
  204 +$drawer-color := $color-dark-grey
  205 +$drawer-title-bdc := $color-light-grey-ss
  206 +$drawer-title-bgc := $color-white
  207 +$drawer-panel-bgc := $color-white
  208 +$drawer-item-active-bgc := $color-light-grey-opacity
  209 +
  210 +// scroll-nav
  211 +$scroll-nav-bgc := $color-white
  212 +$scroll-nav-color := $color-grey
  213 +$scroll-nav-active-color := $color-orange
  214 +
  215 +// image-preview
  216 +$image-preview-counter-color := $color-white
  217 +
  218 +// tab-bar & tab-panel
  219 +$tab-color := $color-grey
  220 +$tab-active-color := $color-dark-orange
  221 +$tab-slider-bgc := $color-dark-orange
1 import * as Types from './types'; 1 import * as Types from './types';
2 2
3 export default { 3 export default {
4 - async fetchProduct({commit}, {productId, page = 1, refresh}) { 4 + async fetchProduct({commit}, {productId, page = 1, refresh = false, storageId}) {
5 commit(Types.FETCH_ORDER_PRODUCT_REQUEST); 5 commit(Types.FETCH_ORDER_PRODUCT_REQUEST);
6 6
7 const result = await this.$api.get('/api/ufo/seller/entryGoodsSizeList', { 7 const result = await this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
@@ -12,7 +12,8 @@ export default { @@ -12,7 +12,8 @@ export default {
12 if (result && result.code === 200) { 12 if (result && result.code === 200) {
13 commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, { 13 commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, {
14 order: result.data, 14 order: result.data,
15 - refresh 15 + refresh,
  16 + storageId
16 }); 17 });
17 } else { 18 } else {
18 commit(Types.FETCH_ORDER_PRODUCT_FAILD); 19 commit(Types.FETCH_ORDER_PRODUCT_FAILD);
@@ -8,14 +8,22 @@ export default { @@ -8,14 +8,22 @@ export default {
8 [Types.FETCH_ORDER_PRODUCT_FAILD](state) { 8 [Types.FETCH_ORDER_PRODUCT_FAILD](state) {
9 state.fetchingPro = false; 9 state.fetchingPro = false;
10 }, 10 },
11 - [Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order, refresh}) { 11 + [Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order, refresh, storageId}) {
12 state.fetchingPro = false; 12 state.fetchingPro = false;
13 - if (state.productInfo.productId !== order.productInfo.productId) { 13 + if (order.productInfo && state.productInfo.productId !== order.productInfo.productId) {
14 state.productInfo = order.productInfo; 14 state.productInfo = order.productInfo;
15 } 15 }
16 if (refresh) { 16 if (refresh) {
17 state.skcs = order.data; 17 state.skcs = order.data;
18 - } else { 18 + } else if (order.data && storageId) {
  19 + const findData = order.data.find(skc => skc.goodsInfo.storageId === storageId);
  20 + const findInx = state.skcs.findIndex(skc => skc.goodsInfo.storageId === storageId);
  21 +
  22 + if (findData) {
  23 + state.skcs[findInx] = findData;
  24 + state.skcs = state.skcs.map(skc => skc);
  25 + }
  26 + } else if (order.data) {
19 state.skcs = state.skcs.concat(order.data); 27 state.skcs = state.skcs.concat(order.data);
20 } 28 }
21 }, 29 },
@@ -6,7 +6,7 @@ const webpack = require('webpack'); @@ -6,7 +6,7 @@ const webpack = require('webpack');
6 const clientConfig = require('./webpack.client.conf'); 6 const clientConfig = require('./webpack.client.conf');
7 const serverConfig = require('./webpack.server.conf'); 7 const serverConfig = require('./webpack.server.conf');
8 const pkg = require('../package.json'); 8 const pkg = require('../package.json');
9 -const distDir = path.join(__dirname, `../public/dist/${pkg.name}`); 9 +const distDir = path.join(__dirname, `../dist/${pkg.name}`);
10 10
11 11
12 rm(path.join(clientConfig.output.path), err => { 12 rm(path.join(clientConfig.output.path), err => {
@@ -25,22 +25,17 @@ rm(path.join(clientConfig.output.path), err => { @@ -25,22 +25,17 @@ rm(path.join(clientConfig.output.path), err => {
25 chunkModules: false 25 chunkModules: false
26 }) + '\n\n'); 26 }) + '\n\n');
27 27
28 - rm(path.join(distDir, './static'), rmerr => {  
29 - if (err) {  
30 - throw rmerr; 28 + webpack(serverConfig, (serverErr, serverStats) => {
  29 + if (serverErr) {
  30 + throw serverErr;
31 } 31 }
32 - webpack(serverConfig, (serverErr, serverStats) => {  
33 - if (serverErr) {  
34 - throw serverErr;  
35 - }  
36 - process.stdout.write(serverStats.toString({  
37 - colors: true,  
38 - modules: false,  
39 - children: false,  
40 - chunks: false,  
41 - chunkModules: false  
42 - }) + '\n\n');  
43 - }); 32 + process.stdout.write(serverStats.toString({
  33 + colors: true,
  34 + modules: false,
  35 + children: false,
  36 + chunks: false,
  37 + chunkModules: false
  38 + }) + '\n\n');
44 }); 39 });
45 }); 40 });
46 }); 41 });
  1 +const shelljs = require('shelljs');
  2 +const path = require('path');
  3 +const pkg = require('../package.json');
  4 +
  5 +const distDir = path.join(__dirname, '../dist/node');
  6 +
  7 +shelljs.rm('-rf', distDir);
  8 +shelljs.mkdir('-p', distDir);
  9 +
  10 +const cpPaths = [
  11 + 'favicon.ico',
  12 + '.nvmrc',
  13 + '.npmrc',
  14 + 'process.json',
  15 + 'Dockerfile',
  16 + 'yarn.lock',
  17 + 'package.json',
  18 + '*.js',
  19 + 'config',
  20 + 'doraemon',
  21 + 'utils',
  22 + 'apps/index.html',
  23 + `dist/${pkg.name}/yoho-ssr-client-${pkg.version}.json`,
  24 + `dist/${pkg.name}/yoho-ssr-server-${pkg.version}.json`
  25 +];
  26 +
  27 +new Promise(resolve => { // 加载manifest.json文件
  28 + resolve();
  29 +}).then(() => { // 拷贝node代码
  30 + cpPaths.forEach(p => {
  31 + let dist = distDir;
  32 + let file = p;
  33 +
  34 + if (typeof p === 'object') {
  35 + dist = path.join(dist, p[1]);
  36 + file = p[0];
  37 +
  38 + if (!shelljs.test('-e', dist)) {
  39 + shelljs.mkdir('-p', dist);
  40 + }
  41 + }
  42 + shelljs.cp('-R', path.join(__dirname, '../', file), dist);
  43 + });
  44 +}).then(() => { // 验证文件正确性
  45 + if (!shelljs.test('-e', path.join(distDir, `yoho-ssr-client-${pkg.version}.json`))) {
  46 + console.error('error:check yoho-ssr-client.json faild');
  47 + return process.exit(1); //eslint-disable-line
  48 + }
  49 + if (!shelljs.test('-e', path.join(distDir, `yoho-ssr-server-${pkg.version}.json`))) {
  50 + console.error('error:check yoho-ssr-server.json faild');
  51 + return process.exit(1); //eslint-disable-line
  52 + }
  53 +}).then(() => { // 安装依赖和清理node_modules
  54 + shelljs.cd(distDir);
  55 + if (shelljs.exec('yarn --production=true').code !== 0) {
  56 + throw 'yarn install faild';
  57 + }
  58 +}).catch(error => {
  59 + console.error(`error:${error}`);
  60 + return process.exit(1); //eslint-disable-line
  61 +});
  62 +
  63 +
  64 +
  65 +
  66 +
  67 +
@@ -6,13 +6,13 @@ var TransformModulesPlugin = require('webpack-transform-modules-plugin'); @@ -6,13 +6,13 @@ var TransformModulesPlugin = require('webpack-transform-modules-plugin');
6 const VueLoaderPlugin = require('vue-loader/lib/plugin'); 6 const VueLoaderPlugin = require('vue-loader/lib/plugin');
7 const pkg = require('../package.json'); 7 const pkg = require('../package.json');
8 const isProd = process.env.NODE_ENV === 'production'; 8 const isProd = process.env.NODE_ENV === 'production';
9 -const distDir = path.join(__dirname, `../dist/${pkg.name}/bundle`); 9 +const distDir = path.join(__dirname, `../dist/${pkg.name}`);
10 10
11 const webpackConfig = { 11 const webpackConfig = {
12 mode: isProd ? 'production' : 'development', 12 mode: isProd ? 'production' : 'development',
13 output: { 13 output: {
14 filename: 'static/js/[name].[chunkhash].js', 14 filename: 'static/js/[name].[chunkhash].js',
15 - path: `${distDir}`, 15 + path: distDir,
16 chunkFilename: 'static/js/[name].[chunkhash].js', 16 chunkFilename: 'static/js/[name].[chunkhash].js',
17 publicPath: '/' 17 publicPath: '/'
18 }, 18 },
1 const webpack = require('webpack'); 1 const webpack = require('webpack');
2 const merge = require('webpack-merge'); 2 const merge = require('webpack-merge');
  3 +const path = require('path');
3 const MiniCssExtractPlugin = require('mini-css-extract-plugin'); 4 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4 const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; 5 const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
5 const VueSSRClientPlugin = require('vue-server-renderer/client-plugin'); 6 const VueSSRClientPlugin = require('vue-server-renderer/client-plugin');
@@ -69,7 +70,8 @@ const webpackConfig = merge(baseConfig, { @@ -69,7 +70,8 @@ const webpackConfig = merge(baseConfig, {
69 loader: 'stylus-loader', 70 loader: 'stylus-loader',
70 options: { 71 options: {
71 sourceMap: isProd, 72 sourceMap: isProd,
72 - 'resolve url': true 73 + 'resolve url': true,
  74 + import: [path.resolve(__dirname, '../apps/statics/scss/theme.styl')]
73 } 75 }
74 }] 76 }]
75 }, { 77 }, {
@@ -18,10 +18,10 @@ let renderer; @@ -18,10 +18,10 @@ let renderer;
18 let serverBundle; 18 let serverBundle;
19 19
20 if (!isDev) { 20 if (!isDev) {
21 - const template = fs.readFileSync(path.join(__dirname, '../../apps/index.html'), 'utf-8'); 21 + const template = fs.readFileSync(path.join(__dirname, '../../index.html'), 'utf-8');
22 22
23 - serverBundle = require(`../../dist/yohoblk-wap/bundle/yoho-ssr-server-${pkg.version}.json`);  
24 - const clientManifest = require(`../../dist/yohoblk-wap/bundle/yoho-ssr-client-${pkg.version}.json`); 23 + serverBundle = require(`../../yoho-ssr-server-${pkg.version}.json`);
  24 + const clientManifest = require(`../../yoho-ssr-client-${pkg.version}.json`);
25 25
26 renderer = createBundleRenderer(serverBundle, { 26 renderer = createBundleRenderer(serverBundle, {
27 runInNewContext: false, 27 runInNewContext: false,
No preview for this file type
1 { 1 {
2 - "name": "yohoblk-wap", 2 + "name": "yoho-app",
3 "version": "2.0.50", 3 "version": "2.0.50",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
7 "type": "git", 7 "type": "git",
8 - "url": "http://git.yoho.cn/fe/yohoblk-wap.git" 8 + "url": "http://git.yoho.cn/fe/yoho-app.git"
9 }, 9 },
10 "scripts": { 10 "scripts": {
11 "start": "NODE_ENV=production node app.js", 11 "start": "NODE_ENV=production node app.js",
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 "client": "NODE_ENV=production webpack --config ./build/webpack.client.conf.js", 14 "client": "NODE_ENV=production webpack --config ./build/webpack.client.conf.js",
15 "server": "NODE_ENV=production webpack --config ./build/webpack.server.conf.js", 15 "server": "NODE_ENV=production webpack --config ./build/webpack.server.conf.js",
16 "build": "NODE_ENV=production node ./build/build.js", 16 "build": "NODE_ENV=production node ./build/build.js",
  17 + "build:node": "node ./build/node-build.js",
17 "lint-js": "eslint -c .eslintrc --cache --fix .", 18 "lint-js": "eslint -c .eslintrc --cache --fix .",
18 "lint-css": "stylelint --syntax scss --config .stylelintrc public/scss/**/*.css", 19 "lint-css": "stylelint --syntax scss --config .stylelintrc public/scss/**/*.css",
19 "lint-vue": "eslint -c .eslintrc --cache --fix public/vue/**/*.vue || stylelint --syntax scss --extract --config .stylelintrc public/vue/**/*.vue" 20 "lint-vue": "eslint -c .eslintrc --cache --fix public/vue/**/*.vue || stylelint --syntax scss --extract --config .stylelintrc public/vue/**/*.vue"
1 { 1 {
2 "apps": [ 2 "apps": [
3 { 3 {
4 - "name": "yohoblk-wap", 4 + "name": "yoho-app",
5 "script": "app.js", 5 "script": "app.js",
6 - "instances": "4",  
7 - "max_memory_restart": "300M", 6 + "instances": "1",
8 "exec_mode": "cluster", 7 "exec_mode": "cluster",
  8 + "wait_ready": true,
9 "merge_logs": true, 9 "merge_logs": true,
10 "log_date_format": "YYYY-MM-DD HH:mm:ss Z", 10 "log_date_format": "YYYY-MM-DD HH:mm:ss Z",
11 - "error_file": "/Data/logs/node/yohoblk-wap-err.log",  
12 - "out_file": "/Data/logs/node/yohoblk-wap-out.log", 11 + "error_file": "/Data/logs/node/yoho-app-node-err.log",
  12 + "out_file": "/Data/logs/node/yoho-app-node-out.log",
13 "env": { 13 "env": {
14 - "PORT": 6004 14 + "TZ": "Asia/Shanghai",
  15 + "PORT": 6001
15 } 16 }
16 } 17 }
17 ] 18 ]
18 -}  
  19 +}