From 825e2544e986be7b34b87e105a50791f323e106a Mon Sep 17 00:00:00 2001
From: 陈峰 <feng.chen@yoho.cn>
Date: Mon, 24 Dec 2018 17:44:07 +0800
Subject: [PATCH] commit

---
 apps/components/button.vue                               |   2 +-
 apps/components/img-size.vue                             |   5 -----
 apps/components/scroll-view.vue                          |   2 +-
 apps/entry-client.js                                     |   4 +++-
 apps/pages/single/order/components/input-ufo.vue         |  51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/pages/single/order/components/inputx.vue            |  93 ---------------------------------------------------------------------------------------------
 apps/pages/single/order/components/modal.vue             |  14 +++++++++++---
 apps/pages/single/order/ufo/components/modal-price.vue   | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
 apps/pages/single/order/ufo/components/modal-unstock.vue |  47 ++++++++++++++++++++++-------------------------
 apps/pages/single/order/ufo/components/product-item.vue  |   2 +-
 apps/pages/single/order/ufo/components/product-list.vue  |  58 +++++++---------------------------------------------------
 apps/pages/single/order/ufo/order.vue                    | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
 apps/store/index.js                                      |   2 +-
 apps/store/order/index.js                                |  10 ++++++++++
 apps/store/order/ufo/actions.js                          |  60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/store/order/ufo/index.js                            |  18 ++++++++++++++++++
 apps/store/order/ufo/mutations.js                        |  49 +++++++++++++++++++++++++++++++++++++++++++++++++
 apps/store/order/ufo/types.js                            |  16 ++++++++++++++++
 apps/store/ufo/index.js                                  |  10 ----------
 apps/store/ufo/order/actions.js                          |  91 -------------------------------------------------------------------------------------------
 apps/store/ufo/order/index.js                            |  15 ---------------
 apps/store/ufo/order/mutations.js                        |  33 ---------------------------------
 apps/store/ufo/order/types.js                            |  11 -----------
 23 files changed, 439 insertions(+), 400 deletions(-)
 create mode 100644 apps/pages/single/order/components/input-ufo.vue
 delete mode 100644 apps/pages/single/order/components/inputx.vue
 create mode 100644 apps/store/order/index.js
 create mode 100644 apps/store/order/ufo/actions.js
 create mode 100644 apps/store/order/ufo/index.js
 create mode 100644 apps/store/order/ufo/mutations.js
 create mode 100644 apps/store/order/ufo/types.js
 delete mode 100644 apps/store/ufo/index.js
 delete mode 100644 apps/store/ufo/order/actions.js
 delete mode 100644 apps/store/ufo/order/index.js
 delete mode 100644 apps/store/ufo/order/mutations.js
 delete mode 100644 apps/store/ufo/order/types.js

diff --git a/apps/components/button.vue b/apps/components/button.vue
index 68b93fd..5e25999 100644
--- a/apps/components/button.vue
+++ b/apps/components/button.vue
@@ -48,7 +48,7 @@ export default {
   outline: 0;
   border: none;
   color: #000;
-  transition: opacity 0.2s linear, background-color 0.2s linear, border 0.2s linear, box-shadow 0.2s linear;
+  transition: opacity 0.1s linear, background-color 0.1s linear, border 0.1s linear, box-shadow 0.1s linear;
   background-color: #eee;
   height: 60px;
   padding-left: 40px;
diff --git a/apps/components/img-size.vue b/apps/components/img-size.vue
index 5893ef5..3e1e466 100644
--- a/apps/components/img-size.vue
+++ b/apps/components/img-size.vue
@@ -17,11 +17,6 @@ export default {
         .replace('{width}', this.width)
         .replace('{height}', this.height);
     }
-  },
-  methods: {
-    onError() {
-      this.$el.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
-    }
   }
 };
 </script>
diff --git a/apps/components/scroll-view.vue b/apps/components/scroll-view.vue
index 15ffe39..14265da 100644
--- a/apps/components/scroll-view.vue
+++ b/apps/components/scroll-view.vue
@@ -27,7 +27,7 @@
     >
       <div ref="pulldown" class="pulldown-wrapper" :style="pullDownStyle" v-if="pullDownRefresh">
         <div class="before-trigger" v-if="beforePullDown">
-          <span :y="bubbleY">bubbleY</span>
+          <span>加载中</span>
         </div>
         <div class="after-trigger" v-else>
           <div v-if="isPullingDown" class="loading">
diff --git a/apps/entry-client.js b/apps/entry-client.js
index 2774c56..65f7c3c 100644
--- a/apps/entry-client.js
+++ b/apps/entry-client.js
@@ -5,6 +5,7 @@ import {
 } from 'store/yoho/types';
 import {createApp} from './app';
 import {createApi} from 'create-api';
+import {Style, Toast} from 'cube-ui'; //eslint-disable-line
 import Lazy from 'vue-lazyload';
 import 'statics/scss/common.scss';
 import 'statics/font/iconfont.css';
@@ -17,8 +18,9 @@ if (window.__INITIAL_STATE__) {
 }
 
 // Vue.prop('yoho', yoho);
+Vue.use(Toast);
 Vue.prop('api', createApi());
-Vue.use(Lazy);
+Vue.use(Lazy, {error: ''});
 
 router.onReady(() => {
   router.beforeResolve((to, from, next) => {
diff --git a/apps/pages/single/order/components/input-ufo.vue b/apps/pages/single/order/components/input-ufo.vue
new file mode 100644
index 0000000..e700260
--- /dev/null
+++ b/apps/pages/single/order/components/input-ufo.vue
@@ -0,0 +1,51 @@
+<template>
+  <CubeInput v-bind="$attrs" v-bind:value="value" v-on="inputListeners" :maxlength="8" class="input-number">
+    <span slot="prepend">
+      <slot name="prepend"></slot>
+    </span>
+    <span slot="append">
+      <slot name="append"></slot>
+    </span>
+  </CubeInput>
+</template>
+
+<script>
+import {Input} from 'cube-ui';
+
+export default {
+  name: 'InputUfo',
+  props: ['value'],
+  computed: {
+    inputListeners() {
+      return Object.assign({},
+        this.$listeners,
+        {
+          input: (value) => {
+            this.$emit('input', value);
+          }
+        }
+      );
+    }
+  },
+  components: {CubeInput: Input}
+};
+</script>
+
+<style lang="scss">
+.input-number {
+  margin-bottom: 15px;
+  background-color: #f5f5f5;
+  border-radius: 10px;
+  font-size: 40px;
+
+  &:after {
+    border-radius: 20px;
+    border-color: #f5f5f5;
+  }
+
+  /deep/ .cube-input-field {
+    font-weight: bold;
+    color: #000;
+  }
+}
+</style>
diff --git a/apps/pages/single/order/components/inputx.vue b/apps/pages/single/order/components/inputx.vue
deleted file mode 100644
index 515d1f5..0000000
--- a/apps/pages/single/order/components/inputx.vue
+++ /dev/null
@@ -1,93 +0,0 @@
-<template>
-  <div class="input-wrapper">
-    <span class="input-prefix">
-      <slot name="prefix"></slot>
-    </span>
-    <input type="text" :maxlength="maxlength" :readonly="readonly" class="input" :class="classes" :value="value" @input="onInput">
-    <span class="input-suffix">
-      <slot name="suffix"></slot>
-    </span>
-  </div>
-</template>
-
-<script>
-export default {
-  data() {
-    return {
-      classes: {}
-    };
-  },
-  props: {
-    value: [String, Number],
-    maxlength: Number,
-    readonly: Boolean
-  },
-  methods: {
-    onInput(evt) {
-      this.$emit('input', evt.target.value);
-    }
-  },
-  mounted() {
-    if (this.$slots.prefix) {
-      this.classes['input-with-prefix'] = true;
-    }
-    if (this.$slots.suffix) {
-      this.classes['input-with-suffix'] = true;
-    }
-  }
-};
-</script>
-
-<style lang="scss">
-.input-wrapper {
-  position: relative;
-  vertical-align: middle;
-  line-height: normal;
-
-  .input {
-    width: 100%;
-    height: 100px;
-    background-color: #f5f5f5;
-    border-radius: 10px;
-    padding-left: 60px;
-    padding-right: 60px;
-    font-size: 40px;
-
-    &.input-with-prefix {
-      padding-left: 60px;
-    }
-
-    &.input-with-suffix {
-      padding-right: 60px;
-    }
-  }
-
-  .input-prefix {
-    width: 60px;
-    height: 100%;
-    font-size: 40px;
-    text-align: center;
-    position: absolute;
-    left: 0;
-    top: 0;
-    z-index: 1;
-    display: flex;
-    justify-content: center;
-    align-items: center;
-  }
-
-  .input-suffix {
-    width: 60px;
-    height: 100%;
-    text-align: center;
-    position: absolute;
-    right: 0;
-    top: 0;
-    z-index: 1;
-    display: flex;
-    justify-content: center;
-    align-items: center;
-  }
-}
-
-</style>
diff --git a/apps/pages/single/order/components/modal.vue b/apps/pages/single/order/components/modal.vue
index 86a8be9..9e02443 100644
--- a/apps/pages/single/order/components/modal.vue
+++ b/apps/pages/single/order/components/modal.vue
@@ -10,8 +10,8 @@
         </div>
         <div class="modal-footer">
           <slot name="footer">
-            <Button class="btn" type="button" @click="onCancel">取消</Button>
-            <Button class="btn" type="button" @click="onSure">调整售价</Button>
+            <Button class="btn" type="button" @click="onCancel">{{cancelText}}</Button>
+            <Button class="btn" type="button" @click="onSure">{{sureText}}</Button>
           </slot>
         </div>
       </div>
@@ -27,7 +27,15 @@ export default {
   props: {
     transfer: [Boolean],
     title: String,
-    value: Boolean
+    value: Boolean,
+    sureText: {
+      type: String,
+      default: '确认'
+    },
+    cancelText: {
+      type: String,
+      default: '取消'
+    }
   },
   methods: {
     onTouchmove() {},
diff --git a/apps/pages/single/order/ufo/components/modal-price.vue b/apps/pages/single/order/ufo/components/modal-price.vue
index 579cdd8..6f8dcad 100644
--- a/apps/pages/single/order/ufo/components/modal-price.vue
+++ b/apps/pages/single/order/ufo/components/modal-price.vue
@@ -1,53 +1,121 @@
 <template>
-  <Modal class="ufo-font" :value="value" @input="onInput" ref="modal" :transfer="true" @on-sure="onSure">
+  <Modal
+    class="ufo-font"
+    v-model="visiable"
+    sure-text="调整价格"
+    cancel-text="取消"
+    :transfer="true"
+    @on-sure="onSure">
     <div class="change-price-modal">
-      <p class="modal-title">当前42码最低售价:¥1999.00</p>
-      <Inputx :maxlength="8" class="input-number">
-        <span slot="prefix">¥</span>
-      </Inputx>
+      <p class="modal-title">当前{{skc.sizeName}}码最低售价:¥{{skc.leastPrice}}</p>
+      <InputUfo type="number" :maxlength="8" class="input-number" v-model="chgPrice">
+        <span class="prepend" slot="prepend">¥</span>
+      </InputUfo>
       <transition name="tips">
-        <p class="tips" v-show="showTips">价格过高!</p>
+        <p class="tips" v-show="errorTip">{{errorTip}}</p>
       </transition>
-      <p class="price-line">
-        <span class="title">平台费用:</span>
-        <span class="price">-¥10.00</span>
-      </p>
-      <p class="price-line">
-        <span class="title">银行转账费用:</span>
-        <span class="price">-¥10.00</span>
-      </p>
-      <p class="total price-line">
-        <span class="title">实际收入:</span>
-        <span class="price">¥10.00</span>
+      <p class="price-line" v-for="(price, inx) in prices" :key="inx" :class="{total: price.total}">
+        <span class="title">{{price.label}}</span>
+        <span class="price">{{price.money}}</span>
       </p>
     </div>
   </Modal>
 </template>
 
 <script>
-import Inputx from '../../components/inputx.vue';
+import {debounce} from 'lodash';
+import InputUfo from '../../components/input-ufo';
 import Modal from '../../components/modal.vue';
+import {createNamespacedHelpers} from 'vuex';
+
+const {mapActions} = createNamespacedHelpers('ufo/order');
 
 export default {
   name: 'ModalPrice',
-  props: {
-    value: Boolean,
-  },
   data() {
     return {
-      showTips: false,
+      visiable: false,
+      skc: {},
+      prices: [],
+      errorTip: '',
+      chgPrice: '',
     };
   },
+  mounted() {
+    this.inputChange = debounce(this.onChange.bind(this), 500);
+  },
+  watch: {
+    chgPrice(newVal) {
+      this.inputChange(newVal);
+    }
+  },
   methods: {
+    ...mapActions(['postCalcPrice']),
+    show({skc, product}) {
+      this.skc = skc;
+      this.product = product;
+      this.visiable = true;
+    },
+    hide() {
+      this.skc = {};
+      this.product = {};
+      this.visiable = false;
+    },
+    onChange(price) {
+      if (this.checkPrice(price)) {
+        this.calcPrice(price);
+      }
+    },
+    async calcPrice(price) {
+      const result = await this.postCalcPrice({
+        product_id: this.product.productId,
+        storage_id: this.skc.storageId,
+        new_price: price,
+        old_price: this.skc.goodPrice,
+        num: this.skc.storageNum
+      });
+
+      if (result && result.code === 200) {
+      } else {
+        this.$createToast({
+          txt: result.message || '计算失败',
+          type: 'warn',
+          zIndex: 1000
+        }).show();
+      }
+    },
+    checkPrice(price) {
+      let valid = false;
+
+      if (!price) {
+        this.errorTip = '没有价格';
+        return false;
+      } else if (!/^\d+$/.test(price)) {
+        this.errorTip = '价格只能为正整数';
+      } else if (!/9$/.test(price)) {
+        this.errorTip = '出售价格必须以9结尾';
+      } else {
+        this.errorTip = '';
+        valid = true;
+      }
+      return valid;
+    },
     onSure() {
-      this.$emit('on-sure');
-      this.showTips = !this.showTips;
+      if (!this.checkPrice(this.chgPrice)) {
+        this.$createToast({
+          txt: this.errorTip,
+          type: 'warn',
+          zIndex: 1000
+        }).show();
+      } else {
+        this.$emit('on-change-price', {skc: this.skc, price: this.chgPrice});
+      }
     },
     onInput(val) {
       this.$emit('input', val);
     }
   },
-  components: {Modal, Inputx}
+  components: {Modal, InputUfo}
 };
 </script>
 
@@ -80,10 +148,10 @@ export default {
   }
 
   .input-number {
-    margin-bottom: 15px;
-
-    /deep/ .input {
-      font-weight: bold;
+    /deep/ .prepend {
+      width: 40px;
+      margin-left: 20px;
+      text-align: left;
     }
   }
 
diff --git a/apps/pages/single/order/ufo/components/modal-unstock.vue b/apps/pages/single/order/ufo/components/modal-unstock.vue
index 5f24954..c0c2cf4 100644
--- a/apps/pages/single/order/ufo/components/modal-unstock.vue
+++ b/apps/pages/single/order/ufo/components/modal-unstock.vue
@@ -1,11 +1,15 @@
 <template>
-  <Modal class="ufo-font" :value="visiable" @input="onInput" ref="modal" :transfer="true" @on-sure="onSure" @on-cancel="onCancel">
+  <Modal
+    class="ufo-font"
+    v-model="visiable"
+    :transfer="true"
+    @on-sure="onSure">
     <div class="change-price-modal">
       <p class="modal-title">选择你要下架的数量</p>
-      <Inputx v-model="unStockNum" :maxlength="8" :readonly="true" class="input-number">
-        <i slot="prefix" class="iconfont icon-plus-minus" @touchend="onChangeNum(-1)"></i>
-        <i slot="suffix" class="iconfont icon-i-add" @touchend="onChangeNum(1)"></i>
-      </Inputx>
+      <InputUfo v-model="unStockNum" :maxlength="8" :readonly="true" class="inp-unstock">
+        <i slot="prepend" class="iconfont icon-plus-minus" @touchend="onChangeNum(-1)"></i>
+        <i slot="append" class="iconfont icon-i-add" @touchend="onChangeNum(1)"></i>
+      </InputUfo>
       <p class="stock-txt">
         目前还有 {{storageNum}} 个库存
       </p>
@@ -17,7 +21,7 @@
 </template>
 
 <script>
-import Inputx from '../../components/inputx.vue';
+import InputUfo from '../../components/input-ufo';
 import Modal from '../../components/modal.vue';
 
 
@@ -27,7 +31,7 @@ export default {
     return {
       visiable: false,
       unStockNum: 1,
-      storageNum: 6,
+      storageNum: 1,
     };
   },
   methods: {
@@ -35,12 +39,12 @@ export default {
       this.storageNum = storageNum;
       this.visiable = true;
     },
-    onSure() {
-      this.$emit('on-sure', this.unStockNum);
+    hide() {
+      this.storageNum = 1;
       this.visiable = false;
     },
-    onCancel() {
-      this.visiable = false;
+    onSure() {
+      this.$emit('on-no-sale', this.unStockNum);
     },
     onInput(val) {
       this.$emit('input', val);
@@ -54,7 +58,7 @@ export default {
       this.unStockNum = value;
     }
   },
-  components: {Modal, Inputx}
+  components: {Modal, InputUfo}
 };
 </script>
 
@@ -69,25 +73,18 @@ export default {
     color: #999;
   }
 
-  .input-number {
+  .inp-unstock {
     margin-bottom: 10px;
 
-    /deep/ .input-prefix,
-    /deep/ .input-suffix {
+    /deep/ .iconfont {
       padding: 34px 40px;
       width: 112px;
-
-      .iconfont {
-        font-size: 32px;
-        color: #999;
-        font-weight: bold;
-      }
+      font-size: 32px;
+      color: #999;
+      font-weight: bold;
     }
 
-    /deep/ .input {
-      font-weight: bold;
-      padding-left: 112px;
-      padding-right: 112px;
+    /deep/ .cube-input-field {
       text-align: center;
     }
   }
diff --git a/apps/pages/single/order/ufo/components/product-item.vue b/apps/pages/single/order/ufo/components/product-item.vue
index 48b6a5f..f53d262 100644
--- a/apps/pages/single/order/ufo/components/product-item.vue
+++ b/apps/pages/single/order/ufo/components/product-item.vue
@@ -67,7 +67,7 @@ export default {
       this.$emit('on-no-sale', this.value.goodsInfo);
     },
     onChgPrice() {
-      this.$emit('on-chg-price', this.value.goodsInfo);
+      this.$emit('on-change-price', this.value.goodsInfo);
     },
     onTouchStart(evt) {
       const {clientX, clientY} = evt.touches[0];
diff --git a/apps/pages/single/order/ufo/components/product-list.vue b/apps/pages/single/order/ufo/components/product-list.vue
index b758b92..c07d490 100644
--- a/apps/pages/single/order/ufo/components/product-list.vue
+++ b/apps/pages/single/order/ufo/components/product-list.vue
@@ -5,84 +5,40 @@
       :key="i"
       :value="skc"
       :slideValue="slideSkc"
-      @on-chg-price="onChgPrice"
+      @on-change-price="onChangePrice"
       @on-no-sale="onNoSale"
       @on-slide="onSlide"></ProductItem>
-    <ModalPrice
-      v-if="modalLoad"
-      ref="modalPrice"
-      v-model="showModalPrice"
-      @on-sure="onPriceSure">
-    </ModalPrice>
-    <ModalUnstock
-      v-if="modalLoad"
-      ref="modalUnstock"
-      v-model="showModalUnstock"
-      @on-sure="onUnstockSure">
-    </ModalUnstock>
   </div>
 </template>
 
 <script>
-import ModalPrice from './modal-price';
-import ModalUnstock from './modal-unstock';
 import ProductItem from './product-item';
 import {createNamespacedHelpers} from 'vuex';
-import Vue from 'vue';
-import {Toast} from 'cube-ui';
 
-Vue.use(Toast);
 const {mapActions} = createNamespacedHelpers('ufo/order');
 
 export default {
   name: 'ProductList',
   props: {
-    skcs: Array
+    skcs: Array,
   },
   data() {
     return {
-      modalLoad: false,
-      showModalPrice: false,
-      showTips: false,
-      showModalUnstock: false,
       slideSkc: {}
     };
   },
-  mounted() {
-    this.modalLoad = true;
-  },
   methods: {
     ...mapActions(['postNoSale']),
-    onPriceSure() {
-      this.showTips = !this.showTips;
-    },
-    async onUnstockSure(product) {
-      const result = await this.postNoSale(product);
-
-      if (result.code === 200) {
-        this.$createToast({
-          txt: '下架成功',
-          time: 5000,
-          type: 'correct'
-        }).show();
-      } else {
-        this.$createToast({
-          txt: result.message || '下架失败',
-          type: 'warn'
-        }).show();
-      }
-      this.slideSkc = {};
-    },
-    onChgPrice() {
-      this.showModalPrice = true;
+    onChangePrice(params) {
+      this.$emit('on-change-price', params);
     },
-    onNoSale(productInfo) {
-      this.$refs.modalUnstock.show(productInfo);
+    onNoSale(params) {
+      this.$emit('on-no-sale', params);
     },
     onSlide(val) {
       this.slideSkc = val;
     }
   },
-  components: {ModalPrice, ModalUnstock, ProductItem}
+  components: {ProductItem}
 };
 </script>
diff --git a/apps/pages/single/order/ufo/order.vue b/apps/pages/single/order/ufo/order.vue
index 82c36f7..62689c1 100644
--- a/apps/pages/single/order/ufo/order.vue
+++ b/apps/pages/single/order/ufo/order.vue
@@ -1,25 +1,44 @@
 <template>
   <LayoutApp class="ufo-font" :class="classes">
-    <ScrollView ref="scroll" :observe-dom="false" :pull-up-load="true" :pull-down-refresh="true" @pullingUp="onPullingUp" @pullingDown="onPullingDown">
+    <ScrollView ref="scroll" :observe-dom="false" :pull-up-load="true" @pullingUp="onPullingUp">
       <div class="order-page">
-        <div class="title">{{productInfo.statuStr}}</div>
+        <div class="title">出售中</div>
         <div class="product">
-          <ImgSize class="pro-img" :src="productInfo.goodsImg"></ImgSize>
+          <ImgSize class="pro-img" :src="productInfo.imageUrl" :width="200" :height="200"></ImgSize>
           <div class="pro-info">
             <p class="pro-name">{{productInfo.productName}}</p>
-            <p class="stock-info">{{productInfo.sizeNum}}个尺码,{{productInfo.storageNum}}个商品库存</p>
+            <p class="stock-info">{{productInfo.colorName}},{{productInfo.sizeNum}}个尺码,{{productInfo.storageNum}}个商品库存</p>
           </div>
         </div>
         <div class="arrival">
-          <p class="arrival-time"><i class="iconfont icon-info"></i><span>尺码列表左滑选择 不卖了 ,下架当前尺码商品</span></p>
+          <p class="arrival-time">
+            <i class="iconfont icon-info"></i>
+            <span>尺码列表左滑选择 不卖了 ,下架当前尺码商品</span>
+          </p>
         </div>
-        <ProductList :skcs="sizes"></ProductList>
+        <ProductList
+          :skcs="skcs"
+          @on-change-price="onChangePrice"
+          @on-no-sale="onNoSale"
+          ></ProductList>
       </div>
     </ScrollView>
+    <ModalPrice
+      v-if="modalLoad"
+      ref="modalPrice"
+      @on-change-price="onChangePriceSure">
+    </ModalPrice>
+    <ModalUnstock
+      v-if="modalLoad"
+      ref="modalUnstock"
+      @on-no-sale="onNoSaleSure">
+    </ModalUnstock>
   </LayoutApp>
 </template>
 
 <script>
+import ModalPrice from './components/modal-price';
+import ModalUnstock from './components/modal-unstock';
 import ImgSize from 'components/img-size';
 import {Button} from 'cube-ui';
 import ScrollView from 'components/scroll-view';
@@ -28,51 +47,94 @@ import Vue from 'vue';
 import {Toast} from 'cube-ui';
 import {createNamespacedHelpers} from 'vuex';
 
-import {Style} from 'cube-ui';
 
 Vue.use(Toast);
 
-const {mapState} = createNamespacedHelpers('ufo/order');
+const {mapState, mapActions} = createNamespacedHelpers('ufo/order');
 
 export default {
   name: 'OrderPage',
   data() {
     return {
-      tick: 1,
       classes: {},
+      page: 1,
       modalLoad: false,
-      showModalPrice: false,
-      showModalUnstock: false,
     };
   },
+  mounted() {
+    this.modalLoad = true;
+  },
   computed: {
-    ...mapState(['orderInfo']),
-    productInfo() {
-      return this.orderInfo.productInfo || {};
-    },
-    sizes() {
-      return this.orderInfo.data || [];
-    }
+    ...mapState(['productInfo', 'skcs']),
   },
   asyncData({store, router}) {
-    return store.dispatch('ufo/order/fetchProduct', {orderId: router.params.orderId});
+    return store.dispatch('ufo/order/fetchProduct', {productId: router.params.orderId});
   },
   methods: {
+    ...mapActions(['fetchProduct', 'postChangePrice', 'postNoSale']),
     onPullingUp() {
-      setTimeout(() => {
-        this.$refs.scroll.forceUpdate();
-      }, 500);
+      this.fetchProduct({
+        productId: this.$route.params.orderId,
+        page: this.page + 1
+      });
+      this.$refs.scroll.forceUpdate();
     },
-    onPullingDown() {
-      setTimeout(() => {
-        this.$refs.scroll.forceUpdate();
-      }, 500);
+    onChangePrice(skc) {
+      this.$refs.modalPrice.show({skc, product: this.productInfo});
     },
-    onClick() {
-      this.showModalUnstock = true;
+    onNoSale(productInfo) {
+      this.$refs.modalUnstock.show(productInfo);
+    },
+    async onChangePriceSure({skc, price}) {
+      const result = await this.postChangePrice({
+        product_id: this.productInfo.productId,
+        storage_id: skc.storageId,
+        new_price: price,
+        old_price: skc.goodPrice,
+        num: skc.storageNum
+      });
+
+      if (result && result.code === 200) {
+        this.$refs.modalPrice.hide();
+        this.$createToast({
+          txt: '调价成功',
+          type: 'success',
+          zIndex: 1000
+        }).show();
+      } else {
+        this.$createToast({
+          txt: result.message || '调价失败',
+          type: 'warn',
+          zIndex: 1000
+        }).show();
+      }
+    },
+    async onNoSaleSure({skc, price}) {
+      const result = await this.postNoSale({
+        product_id: this.productInfo.productId,
+        storage_id: skc.storageId,
+        new_price: price,
+        old_price: skc.goodPrice,
+        num: skc.storageNum
+      });
+
+      if (result.code === 200) {
+        this.$refs.modalUnstock.hide();
+        this.$createToast({
+          txt: '下架成功',
+          type: 'correct'
+        }).show();
+      } else {
+        this.$createToast({
+          txt: result.message || '下架失败',
+          type: 'warn',
+          zIndex: 1000
+        }).show();
+      }
+      this.slideSkc = {};
     },
   },
-  components: {Button, ScrollView, ProductList, ImgSize}
+  components: {Button, ScrollView, ProductList, ImgSize, ModalPrice, ModalUnstock}
 };
 </script>
 
diff --git a/apps/store/index.js b/apps/store/index.js
index 78203f8..baa1928 100644
--- a/apps/store/index.js
+++ b/apps/store/index.js
@@ -2,7 +2,7 @@ import Vue from 'vue';
 import Vuex from 'vuex';
 import {createApi} from 'create-api';
 import storeYoho from './yoho';
-import storeUfo from './ufo';
+import storeUfo from './order';
 import storeCoupon from './coupon';
 
 Vue.use(Vuex);
diff --git a/apps/store/order/index.js b/apps/store/order/index.js
new file mode 100644
index 0000000..1b3b21e
--- /dev/null
+++ b/apps/store/order/index.js
@@ -0,0 +1,10 @@
+import storeOrder from './ufo';
+
+export default function() {
+  return {
+    namespaced: true,
+    modules: {
+      order: storeOrder()
+    }
+  };
+}
diff --git a/apps/store/order/ufo/actions.js b/apps/store/order/ufo/actions.js
new file mode 100644
index 0000000..ac16016
--- /dev/null
+++ b/apps/store/order/ufo/actions.js
@@ -0,0 +1,60 @@
+import * as Types from './types';
+
+export default {
+  async fetchProduct({commit}, {productId, page = 1, refresh}) {
+    commit(Types.FETCH_ORDER_PRODUCT_REQUEST);
+
+    const result = await this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
+      productId,
+      page
+    });
+
+    if (result && result.code === 200) {
+      commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, {
+        order: result.data,
+        refresh
+      });
+    } else {
+      commit(Types.FETCH_ORDER_PRODUCT_FAILD);
+    }
+  },
+  async postNoSale({commit}, payload) {
+    commit(Types.POST_NOSALE_REQUEST);
+    const result = await this.$api.get('/api/ufo/sellerOrder/batchDownShelf', payload);
+
+    if (result && result.code === 200) {
+      commit(Types.POST_NOSALE_SUCCESS, {
+        order: result.data
+      });
+    } else {
+      commit(Types.POST_NOSALE_FAILD);
+    }
+    return result || {};
+  },
+  async postCalcPrice({commit}, payload) {
+    commit(Types.POST_CALCPRICE_REQUEST);
+    const result = await this.$api.get('/api/ufo/sellerOrder/computeAdjustPrice', payload);
+
+    if (result && result.code === 200) {
+      commit(Types.POST_CALCPRICE_SUCCESS, {
+        order: result.data
+      });
+    } else {
+      commit(Types.POST_CALCPRICE_FAILD);
+    }
+    return result || {};
+  },
+  async postChangePrice({commit}, payload) {
+    commit(Types.POST_CHANGEPRICE_REQUEST);
+    const result = await this.$api.get('/api/ufo/sellerOrder/batchAdjustPrice', payload);
+
+    if (result && result.code === 200) {
+      commit(Types.POST_CHANGEPRICE_SUCCESS, {
+        order: result.data
+      });
+    } else {
+      commit(Types.POST_CHANGEPRICE_FAILD);
+    }
+    return result || {};
+  }
+};
diff --git a/apps/store/order/ufo/index.js b/apps/store/order/ufo/index.js
new file mode 100644
index 0000000..d9148dc
--- /dev/null
+++ b/apps/store/order/ufo/index.js
@@ -0,0 +1,18 @@
+import actions from './actions';
+import mutations from './mutations';
+
+export default function() {
+  return {
+    namespaced: true,
+    state: {
+      fetchingPro: false,
+      fetchingNoSale: false,
+      fetchingChangePrice: false,
+      fetchingCalcPrice: false,
+      productInfo: {},
+      skcs: []
+    },
+    actions,
+    mutations
+  };
+}
diff --git a/apps/store/order/ufo/mutations.js b/apps/store/order/ufo/mutations.js
new file mode 100644
index 0000000..eec9636
--- /dev/null
+++ b/apps/store/order/ufo/mutations.js
@@ -0,0 +1,49 @@
+import * as Types from './types';
+
+export default {
+  [Types.FETCH_ORDER_PRODUCT_REQUEST](state) {
+    state.orderInfo = {};
+    state.fetchingPro = true;
+  },
+  [Types.FETCH_ORDER_PRODUCT_FAILD](state) {
+    state.fetchingPro = false;
+  },
+  [Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order, refresh}) {
+    state.fetchingPro = false;
+    if (state.productInfo.productId !== order.productInfo.productId) {
+      state.productInfo = order.productInfo;
+    }
+    if (refresh) {
+      state.skcs = order.data;
+    } else {
+      state.skcs = state.skcs.concat(order.data);
+    }
+  },
+  [Types.POST_NOSALE_REQUEST](state) {
+    state.fetchingNoSale = true;
+  },
+  [Types.POST_NOSALE_FAILD](state) {
+    state.fetchingNoSale = false;
+  },
+  [Types.POST_NOSALE_SUCCESS](state) {
+    state.fetchingNoSale = false;
+  },
+  [Types.POST_CHANGEPRICE_REQUEST](state) {
+    state.fetchingChangePrice = true;
+  },
+  [Types.POST_CHANGEPRICE_FAILD](state) {
+    state.fetchingChangePrice = false;
+  },
+  [Types.POST_CHANGEPRICE_SUCCESS](state) {
+    state.fetchingChangePrice = false;
+  },
+  [Types.POST_CALCPRICE_REQUEST](state) {
+    state.fetchingCalcPrice = true;
+  },
+  [Types.POST_CALCPRICE_FAILD](state) {
+    state.fetchingCalcPrice = false;
+  },
+  [Types.POST_CALCPRICE_SUCCESS](state) {
+    state.fetchingCalcPrice = false;
+  },
+};
diff --git a/apps/store/order/ufo/types.js b/apps/store/order/ufo/types.js
new file mode 100644
index 0000000..f044881
--- /dev/null
+++ b/apps/store/order/ufo/types.js
@@ -0,0 +1,16 @@
+export const FETCH_ORDER_PRODUCT_REQUEST = 'FETCH_ORDER_PRODUCT_REQUEST';
+export const FETCH_ORDER_PRODUCT_FAILD = 'FETCH_ORDER_PRODUCT_FAILD';
+export const FETCH_ORDER_PRODUCT_SUCCESS = 'FETCH_ORDER_PRODUCT_SUCCESS';
+
+export const POST_NOSALE_REQUEST = 'POST_NOSALE_REQUEST';
+export const POST_NOSALE_FAILD = 'POST_NOSALE_FAILD';
+export const POST_NOSALE_SUCCESS = 'POST_NOSALE_SUCCESS';
+
+export const POST_CHANGEPRICE_REQUEST = 'POST_CHANGEPRICE_REQUEST';
+export const POST_CHANGEPRICE_FAILD = 'POST_CHANGEPRICE_FAILD';
+export const POST_CHANGEPRICE_SUCCESS = 'POST_CHANGEPRICE_SUCCESS';
+
+export const POST_CALCPRICE_REQUEST = 'POST_CALCPRICE_REQUEST';
+export const POST_CALCPRICE_FAILD = 'POST_CALCPRICE_FAILD';
+export const POST_CALCPRICE_SUCCESS = 'POST_CALCPRICE_SUCCESS';
+
diff --git a/apps/store/ufo/index.js b/apps/store/ufo/index.js
deleted file mode 100644
index 6f27493..0000000
--- a/apps/store/ufo/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import storeOrder from './order';
-
-export default function() {
-  return {
-    namespaced: true,
-    modules: {
-      order: storeOrder()
-    }
-  };
-}
diff --git a/apps/store/ufo/order/actions.js b/apps/store/ufo/order/actions.js
deleted file mode 100644
index e134d0c..0000000
--- a/apps/store/ufo/order/actions.js
+++ /dev/null
@@ -1,91 +0,0 @@
-import * as Types from './types';
-
-export default {
-  async fetchProduct({commit}, {productId}) {
-    commit(Types.FETCH_ORDER_PRODUCT_REQUEST);
-
-    // const result = await this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
-    //   productId,
-    // });
-    const result = {
-      "alg": "SALT_MD5",
-      "code": 200,
-      "data": {
-      productInfo:{
-        "productId": 10000078,
-              "productName": "Air Jordan XX9 Low “Chicago Bulls”",
-        "colorName":"红色",
-        "goodsImg" : "http://img11.static.yhbimg.com/goodsimg/2018/10/18/17/01699014e8981a532f27abc74730e40bbd.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
-        "sizeNum":5,
-        "storageNum":100,
-        "statuStr": "出售中",
-              "status": 1,
-      },
-          "data": [
-              {
-                  "buttons": [
-                      {
-                          "code": "batch_cancel_sold",
-                          "name": "BATCH_CANCEL_SOLD",
-                          "text": "不卖了"
-                      },
-            {
-                          "code": "change_price",
-                          "name": "CHANGE_PRICE",
-                          "text": "调价"
-                      }
-                  ],
-                  
-                  "createTime": "2018-11-05 15:03:27",
-                  "goodsInfo": {
-                      "colorName": "",
-                      "goodImg": "",
-                      "goodPrice": "9.00",
-                      "storageNum":100,
-                      "sizeName": "L",
-                      "storageId": 10000162,
-                      "leastPrice": 1119
-                  },
-                  "secendLevelCreateTime": 1541401407,
-                  "uid": 500031152
-              }
-              
-          ],
-          "page": 1,
-          "pageSize": 20,
-          "pagetotal": 1,
-          "total": 2
-      },
-      "md5": "42a616d78633c19d80eb410da1ae4644",
-      "message": "列表"
-  }
-    
-
-    if (result && result.code === 200) {
-      commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, {
-        order: result.data
-      });
-    } else {
-      commit(Types.FETCH_ORDER_PRODUCT_FAILD);
-    }
-  },
-  async postNoSale({commit}, {product}) {
-    commit(Types.POST_NOSALE_REQUEST);
-    // const result = await this.$api.get('/api/ufo/sellerOrder/batchDownShelf', product);
-    const result = {
-      "alg": "SALT_MD5",
-      "code": 200,
-      "data": true,
-      "md5": "40f3824dd1e55b340dc5357dd7ccab72",
-      "message": "批量取消成功"
-    };
-    if (result && result.code === 200) {
-      commit(Types.POST_NOSALE_SUCCESS, {
-        order: result.data
-      });
-    } else {
-      commit(Types.POST_NOSALE_FAILD);
-    }
-    return result || {};
-  }
-};
diff --git a/apps/store/ufo/order/index.js b/apps/store/ufo/order/index.js
deleted file mode 100644
index 7cd19d7..0000000
--- a/apps/store/ufo/order/index.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import actions from './actions';
-import mutations from './mutations';
-
-export default function() {
-  return {
-    namespaced: true,
-    state: {
-      fetchingPro: false,
-      fetchingNoSale: false,
-      orderInfo: {},
-    },
-    actions,
-    mutations
-  };
-}
diff --git a/apps/store/ufo/order/mutations.js b/apps/store/ufo/order/mutations.js
deleted file mode 100644
index 1b19b0f..0000000
--- a/apps/store/ufo/order/mutations.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import * as Types from './types';
-
-export default {
-  [Types.FETCH_ORDER_PRODUCT_REQUEST](state) {
-    state.orderInfo = {};
-    state.fetchingPro = true;
-  },
-  [Types.FETCH_ORDER_PRODUCT_FAILD](state) {
-    state.fetchingPro = false;
-  },
-  [Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order}) {
-    state.fetchingPro = false;
-    state.orderInfo = order;
-  },
-  [Types.POST_NOSALE_REQUEST](state) {
-    state.fetchingNoSale = true;
-  },
-  [Types.POST_NOSALE_FAILD](state) {
-    state.fetchingNoSale = false;
-  },
-  [Types.POST_NOSALE_SUCCESS](state) {
-    state.fetchingNoSale = false;
-  },
-  [Types.POST_CHANGEPRICE_REQUEST](state) {
-    state.fetchingNoSale = true;
-  },
-  [Types.POST_CHANGEPRICE_FAILD](state) {
-    state.fetchingNoSale = false;
-  },
-  [Types.POST_NOSALE_SUCCESS](state) {
-    state.fetchingNoSale = false;
-  },
-};
diff --git a/apps/store/ufo/order/types.js b/apps/store/ufo/order/types.js
deleted file mode 100644
index 0a92c16..0000000
--- a/apps/store/ufo/order/types.js
+++ /dev/null
@@ -1,11 +0,0 @@
-export const FETCH_ORDER_PRODUCT_REQUEST = 'FETCH_ORDER_PRODUCT_REQUEST';
-export const FETCH_ORDER_PRODUCT_FAILD = 'FETCH_ORDER_PRODUCT_FAILD';
-export const FETCH_ORDER_PRODUCT_SUCCESS = 'FETCH_ORDER_PRODUCT_SUCCESS';
-
-export const POST_NOSALE_REQUEST = 'POST_NOSALE_REQUEST';
-export const POST_NOSALE_FAILD = 'POST_NOSALE_FAILD';
-export const POST_NOSALE_SUCCESS = 'POST_NOSALE_SUCCESS';
-
-export const POST_CHANGEPRICE_REQUEST = 'POST_CHANGEPRICE_REQUEST';
-export const POST_CHANGEPRICE_FAILD = 'POST_CHANGEPRICE_FAILD';
-export const POST_CHANGEPRICE_SUCCESS = 'POST_CHANGEPRICE_SUCCESS';
--
libgit2 0.24.0