actions.js 2.71 KB
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 || {};
  }
};