通过微信开发者工具 商城模板 创建新小程序
This commit is contained in:
		
							
								
								
									
										295
									
								
								mini-program/model/order/applyService.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										295
									
								
								mini-program/model/order/applyService.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,295 @@
 | 
			
		||||
import { mockIp, mockReqId } from '../../utils/mock';
 | 
			
		||||
 | 
			
		||||
const orderResps = [
 | 
			
		||||
  {
 | 
			
		||||
    data: {
 | 
			
		||||
      saasId: '88888888',
 | 
			
		||||
      uid: '88888888205468',
 | 
			
		||||
      storeId: '1000',
 | 
			
		||||
      skuId: '135691625',
 | 
			
		||||
      numOfSku: 1,
 | 
			
		||||
      numOfSkuAvailable: 1,
 | 
			
		||||
      refundableAmount: '26900',
 | 
			
		||||
      refundableDiscountAmount: '0',
 | 
			
		||||
      shippingFeeIncluded: '0',
 | 
			
		||||
      paidAmountEach: '26900',
 | 
			
		||||
      boughtQuantity: 1,
 | 
			
		||||
      orderNo: '132222623132329291',
 | 
			
		||||
      goodsInfo: {
 | 
			
		||||
        goodsName:
 | 
			
		||||
          '迷你便携高颜值蓝牙无线耳机立体声只能触控式操作简约立体声耳机',
 | 
			
		||||
        skuImage: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/dz-2a.png',
 | 
			
		||||
        specInfo: [
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50456',
 | 
			
		||||
            specTitle: '颜色',
 | 
			
		||||
            specValue: '黑色',
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50459',
 | 
			
		||||
            specTitle: '尺码',
 | 
			
		||||
            specValue: '简约款',
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    code: 'Success',
 | 
			
		||||
    msg: null,
 | 
			
		||||
    requestId: mockReqId(),
 | 
			
		||||
    clientIp: mockIp(),
 | 
			
		||||
    rt: 36,
 | 
			
		||||
    success: true,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    data: {
 | 
			
		||||
      saasId: '88888888',
 | 
			
		||||
      uid: '88888888205468',
 | 
			
		||||
      storeId: '1000',
 | 
			
		||||
      skuId: '135676631',
 | 
			
		||||
      numOfSku: 1,
 | 
			
		||||
      numOfSkuAvailable: 1,
 | 
			
		||||
      refundableAmount: '26900',
 | 
			
		||||
      refundableDiscountAmount: '0',
 | 
			
		||||
      shippingFeeIncluded: '0',
 | 
			
		||||
      paidAmountEach: '26900',
 | 
			
		||||
      boughtQuantity: 1,
 | 
			
		||||
      orderNo: '132222623132329291',
 | 
			
		||||
      goodsInfo: {
 | 
			
		||||
        goodsName: '白色短袖连衣裙荷叶边裙摆宽松韩版休闲纯白清爽优雅连衣裙',
 | 
			
		||||
        skuImage: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-09a.png',
 | 
			
		||||
        specInfo: [
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50456',
 | 
			
		||||
            specTitle: '颜色',
 | 
			
		||||
            specValue: '米色荷叶边',
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50459',
 | 
			
		||||
            specTitle: '尺码',
 | 
			
		||||
            specValue: 'S',
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    code: 'Success',
 | 
			
		||||
    msg: null,
 | 
			
		||||
    requestId: mockReqId(),
 | 
			
		||||
    clientIp: mockIp(),
 | 
			
		||||
    rt: 36,
 | 
			
		||||
    success: true,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    data: {
 | 
			
		||||
      saasId: '88888888',
 | 
			
		||||
      uid: '88888888205468',
 | 
			
		||||
      storeId: '1000',
 | 
			
		||||
      skuId: '135691622',
 | 
			
		||||
      numOfSku: 1,
 | 
			
		||||
      numOfSkuAvailable: 1,
 | 
			
		||||
      refundableAmount: '26900',
 | 
			
		||||
      refundableDiscountAmount: '0',
 | 
			
		||||
      shippingFeeIncluded: '0',
 | 
			
		||||
      paidAmountEach: '26900',
 | 
			
		||||
      boughtQuantity: 1,
 | 
			
		||||
      orderNo: '132222623132329291',
 | 
			
		||||
      goodsInfo: {
 | 
			
		||||
        goodsName: '腾讯极光盒子4智能网络电视机顶盒6K千兆网络机顶盒4K高分辨率',
 | 
			
		||||
        skuImage: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/dz-3a.png',
 | 
			
		||||
        specInfo: [
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50456',
 | 
			
		||||
            specTitle: '颜色',
 | 
			
		||||
            specValue: '经典白',
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50459',
 | 
			
		||||
            specTitle: '类型',
 | 
			
		||||
            specValue: '经典套装',
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    code: 'Success',
 | 
			
		||||
    msg: null,
 | 
			
		||||
    requestId: mockReqId(),
 | 
			
		||||
    clientIp: mockIp(),
 | 
			
		||||
    rt: 36,
 | 
			
		||||
    success: true,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    data: {
 | 
			
		||||
      saasId: '88888888',
 | 
			
		||||
      uid: '88888888205468',
 | 
			
		||||
      storeId: '1000',
 | 
			
		||||
      skuId: '135676629',
 | 
			
		||||
      numOfSku: 1,
 | 
			
		||||
      numOfSkuAvailable: 1,
 | 
			
		||||
      refundableAmount: '26900',
 | 
			
		||||
      refundableDiscountAmount: '0',
 | 
			
		||||
      shippingFeeIncluded: '0',
 | 
			
		||||
      paidAmountEach: '26900',
 | 
			
		||||
      boughtQuantity: 1,
 | 
			
		||||
      orderNo: '132222623132329291',
 | 
			
		||||
      goodsInfo: {
 | 
			
		||||
        goodsName: '带帽午休毯虎年款多功能加厚加大加绒简约多功能午休毯连帽披肩',
 | 
			
		||||
        skuImage: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/muy-3a.png',
 | 
			
		||||
        specInfo: [
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50456',
 | 
			
		||||
            specTitle: '颜色',
 | 
			
		||||
            specValue: '浅灰色',
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50459',
 | 
			
		||||
            specTitle: '尺码',
 | 
			
		||||
            specValue: 'S',
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    code: 'Success',
 | 
			
		||||
    msg: null,
 | 
			
		||||
    requestId: mockReqId(),
 | 
			
		||||
    clientIp: mockIp(),
 | 
			
		||||
    rt: 36,
 | 
			
		||||
    success: true,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    data: {
 | 
			
		||||
      saasId: '88888888',
 | 
			
		||||
      uid: '88888888205468',
 | 
			
		||||
      storeId: '1000',
 | 
			
		||||
      skuId: '135686631',
 | 
			
		||||
      numOfSku: 1,
 | 
			
		||||
      numOfSkuAvailable: 1,
 | 
			
		||||
      refundableAmount: '26900',
 | 
			
		||||
      refundableDiscountAmount: '0',
 | 
			
		||||
      shippingFeeIncluded: '0',
 | 
			
		||||
      paidAmountEach: '26900',
 | 
			
		||||
      boughtQuantity: 1,
 | 
			
		||||
      orderNo: '132222623132329291',
 | 
			
		||||
      goodsInfo: {
 | 
			
		||||
        goodsName: '运动连帽拉链卫衣休闲开衫长袖多色运动细绒面料运动上衣',
 | 
			
		||||
        skuImage: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-17a.png',
 | 
			
		||||
        specInfo: [
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50456',
 | 
			
		||||
            specTitle: '颜色',
 | 
			
		||||
            specValue: '军绿色',
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50459',
 | 
			
		||||
            specTitle: '尺码',
 | 
			
		||||
            specValue: 'XS',
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    code: 'Success',
 | 
			
		||||
    msg: null,
 | 
			
		||||
    requestId: mockReqId(),
 | 
			
		||||
    clientIp: mockIp(),
 | 
			
		||||
    rt: 36,
 | 
			
		||||
    success: true,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    data: {
 | 
			
		||||
      saasId: '88888888',
 | 
			
		||||
      uid: '88888888205468',
 | 
			
		||||
      storeId: '1000',
 | 
			
		||||
      skuId: '19384938948343',
 | 
			
		||||
      numOfSku: 1,
 | 
			
		||||
      numOfSkuAvailable: 1,
 | 
			
		||||
      refundableAmount: '26900',
 | 
			
		||||
      refundableDiscountAmount: '0',
 | 
			
		||||
      shippingFeeIncluded: '0',
 | 
			
		||||
      paidAmountEach: '26900',
 | 
			
		||||
      boughtQuantity: 1,
 | 
			
		||||
      orderNo: '130169571554503755',
 | 
			
		||||
      goodsInfo: {
 | 
			
		||||
        goodsName:
 | 
			
		||||
          '纯色纯棉休闲圆领短袖T恤纯白亲肤厚柔软细腻面料纯白短袖套头T恤',
 | 
			
		||||
        skuImage: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
 | 
			
		||||
        specInfo: [
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50456',
 | 
			
		||||
            specTitle: '颜色',
 | 
			
		||||
            specValue: '军绿色',
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            specId: '50459',
 | 
			
		||||
            specTitle: '尺码',
 | 
			
		||||
            specValue: 'XS',
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    code: 'Success',
 | 
			
		||||
    msg: null,
 | 
			
		||||
    requestId: mockReqId(),
 | 
			
		||||
    clientIp: mockIp(),
 | 
			
		||||
    rt: 36,
 | 
			
		||||
    success: true,
 | 
			
		||||
  },
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export function genRightsPreview(params) {
 | 
			
		||||
  const { orderNo, skuId } = params;
 | 
			
		||||
  const resp = orderResps.find(
 | 
			
		||||
    (r) => r.data.orderNo === orderNo && r.data.skuId === skuId,
 | 
			
		||||
  );
 | 
			
		||||
  return resp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function genApplyReasonList(params) {
 | 
			
		||||
  const resp = {
 | 
			
		||||
    data: {
 | 
			
		||||
      saasId: '70000001',
 | 
			
		||||
      rightsReasonList: [
 | 
			
		||||
        { id: '1', desc: '实际商品与描述不符' },
 | 
			
		||||
        { id: '2', desc: '质量问题' },
 | 
			
		||||
        { id: '3', desc: '少件/漏发' },
 | 
			
		||||
        { id: '4', desc: '包装/商品/污迹/裂痕/变形' },
 | 
			
		||||
        { id: '5', desc: '发货太慢' },
 | 
			
		||||
        { id: '6', desc: '物流配送太慢' },
 | 
			
		||||
        { id: '7', desc: '商家发错货' },
 | 
			
		||||
        { id: '8', desc: '不喜欢' },
 | 
			
		||||
      ],
 | 
			
		||||
    },
 | 
			
		||||
    code: 'Success',
 | 
			
		||||
    msg: null,
 | 
			
		||||
    requestId: mockReqId(),
 | 
			
		||||
    clientIp: mockIp(),
 | 
			
		||||
    rt: 6,
 | 
			
		||||
    success: true,
 | 
			
		||||
  };
 | 
			
		||||
  // 未收货对应的原因列表
 | 
			
		||||
  if (params.rightsReasonType === 'REFUND_MONEY') {
 | 
			
		||||
    resp.data.rightsReasonList = [
 | 
			
		||||
      { id: '9', desc: '空包裹' },
 | 
			
		||||
      { id: '10', desc: '快递/物流一直未送到' },
 | 
			
		||||
      { id: '11', desc: '货物破损已拒签' },
 | 
			
		||||
      { id: '12', desc: '不喜欢' },
 | 
			
		||||
    ];
 | 
			
		||||
  }
 | 
			
		||||
  return resp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function applyService() {
 | 
			
		||||
  const resp = {
 | 
			
		||||
    data: {
 | 
			
		||||
      rightsNo: '123123423',
 | 
			
		||||
      saasId: '70000001',
 | 
			
		||||
      uid: '700000011070005',
 | 
			
		||||
      storeId: '542',
 | 
			
		||||
      result: null,
 | 
			
		||||
    },
 | 
			
		||||
    code: 'Success',
 | 
			
		||||
    msg: null,
 | 
			
		||||
    requestId: mockReqId(),
 | 
			
		||||
    clientIp: mockIp(),
 | 
			
		||||
    rt: 269,
 | 
			
		||||
    success: true,
 | 
			
		||||
  };
 | 
			
		||||
  return resp;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										147
									
								
								mini-program/model/order/orderConfirm.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										147
									
								
								mini-program/model/order/orderConfirm.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,147 @@
 | 
			
		||||
import { mockIp, mockReqId } from '../../utils/mock';
 | 
			
		||||
 | 
			
		||||
export const transformGoodsDataToConfirmData = (goodsDataList) => {
 | 
			
		||||
  const list = [];
 | 
			
		||||
 | 
			
		||||
  goodsDataList.forEach((goodsData) => {
 | 
			
		||||
    list.push({
 | 
			
		||||
      storeId: goodsData.storeId,
 | 
			
		||||
      spuId: goodsData.spuId,
 | 
			
		||||
      skuId: goodsData.skuId,
 | 
			
		||||
      goodsName: goodsData.title,
 | 
			
		||||
      image: goodsData.primaryImage,
 | 
			
		||||
      reminderStock: 119,
 | 
			
		||||
      quantity: goodsData.quantity,
 | 
			
		||||
      payPrice: goodsData.price,
 | 
			
		||||
      totalSkuPrice: goodsData.price,
 | 
			
		||||
      discountSettlePrice: goodsData.price,
 | 
			
		||||
      realSettlePrice: goodsData.price,
 | 
			
		||||
      settlePrice: goodsData.price,
 | 
			
		||||
      oriPrice: goodsData.originPrice,
 | 
			
		||||
      tagPrice: null,
 | 
			
		||||
      tagText: null,
 | 
			
		||||
      skuSpecLst: goodsData.specInfo,
 | 
			
		||||
      promotionIds: null,
 | 
			
		||||
      weight: 0.0,
 | 
			
		||||
      unit: 'KG',
 | 
			
		||||
      volume: null,
 | 
			
		||||
      masterGoodsType: 0,
 | 
			
		||||
      viceGoodsType: 0,
 | 
			
		||||
      roomId: goodsData.roomId,
 | 
			
		||||
      egoodsName: null,
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  return list;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** 生成结算数据 */
 | 
			
		||||
export function genSettleDetail(params) {
 | 
			
		||||
  const { userAddressReq, couponList, goodsRequestList } = params;
 | 
			
		||||
 | 
			
		||||
  const resp = {
 | 
			
		||||
    data: {
 | 
			
		||||
      settleType: 0,
 | 
			
		||||
      userAddress: null,
 | 
			
		||||
      totalGoodsCount: 3,
 | 
			
		||||
      packageCount: 1,
 | 
			
		||||
      totalAmount: '289997',
 | 
			
		||||
      totalPayAmount: '',
 | 
			
		||||
      totalDiscountAmount: '110000',
 | 
			
		||||
      totalPromotionAmount: '1100',
 | 
			
		||||
      totalCouponAmount: '0',
 | 
			
		||||
      totalSalePrice: '289997',
 | 
			
		||||
      totalGoodsAmount: '289997',
 | 
			
		||||
      totalDeliveryFee: '0',
 | 
			
		||||
      invoiceRequest: null,
 | 
			
		||||
      skuImages: null,
 | 
			
		||||
      deliveryFeeList: null,
 | 
			
		||||
      storeGoodsList: [
 | 
			
		||||
        {
 | 
			
		||||
          storeId: '1000',
 | 
			
		||||
          storeName: '云Mall深圳旗舰店',
 | 
			
		||||
          remark: null,
 | 
			
		||||
          goodsCount: 1,
 | 
			
		||||
          deliveryFee: '0',
 | 
			
		||||
          deliveryWords: null,
 | 
			
		||||
          storeTotalAmount: '0',
 | 
			
		||||
          storeTotalPayAmount: '179997',
 | 
			
		||||
          storeTotalDiscountAmount: '110000',
 | 
			
		||||
          storeTotalCouponAmount: '0',
 | 
			
		||||
          skuDetailVos: [],
 | 
			
		||||
          couponList: [
 | 
			
		||||
            {
 | 
			
		||||
              couponId: 11,
 | 
			
		||||
              storeId: '1000',
 | 
			
		||||
            },
 | 
			
		||||
          ],
 | 
			
		||||
        },
 | 
			
		||||
      ],
 | 
			
		||||
      inValidGoodsList: null,
 | 
			
		||||
      outOfStockGoodsList: null,
 | 
			
		||||
      limitGoodsList: null,
 | 
			
		||||
      abnormalDeliveryGoodsList: null,
 | 
			
		||||
      invoiceSupport: 1,
 | 
			
		||||
    },
 | 
			
		||||
    code: 'Success',
 | 
			
		||||
    msg: null,
 | 
			
		||||
    requestId: mockReqId(),
 | 
			
		||||
    clientIp: mockIp(),
 | 
			
		||||
    rt: 244,
 | 
			
		||||
    success: true,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const list = transformGoodsDataToConfirmData(goodsRequestList);
 | 
			
		||||
 | 
			
		||||
  // 获取购物车传递的商品数据
 | 
			
		||||
  resp.data.storeGoodsList[0].skuDetailVos = list;
 | 
			
		||||
 | 
			
		||||
  // 判断是否携带优惠券数据
 | 
			
		||||
  const discountPrice = [];
 | 
			
		||||
 | 
			
		||||
  if (couponList && couponList.length > 0) {
 | 
			
		||||
    couponList.forEach((coupon) => {
 | 
			
		||||
      if (coupon.status === 'default') {
 | 
			
		||||
        discountPrice.push({
 | 
			
		||||
          type: coupon.type,
 | 
			
		||||
          value: coupon.value,
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 模拟计算场景
 | 
			
		||||
 | 
			
		||||
  // 计算总价
 | 
			
		||||
  const totalPrice = list.reduce((pre, cur) => {
 | 
			
		||||
    return pre + cur.quantity * Number(cur.settlePrice);
 | 
			
		||||
  }, 0);
 | 
			
		||||
 | 
			
		||||
  // 计算折扣
 | 
			
		||||
  const totalDiscountPrice =
 | 
			
		||||
    discountPrice.length > 0
 | 
			
		||||
      ? discountPrice.reduce((pre, cur) => {
 | 
			
		||||
          if (cur.type === 1) {
 | 
			
		||||
            return pre + cur.value;
 | 
			
		||||
          }
 | 
			
		||||
          if (cur.type === 2) {
 | 
			
		||||
            return pre + (Number(totalPrice) * cur.value) / 10;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          return pre + cur;
 | 
			
		||||
        }, 0)
 | 
			
		||||
      : 0;
 | 
			
		||||
 | 
			
		||||
  resp.data.totalSalePrice = totalPrice;
 | 
			
		||||
 | 
			
		||||
  resp.data.totalCouponAmount = totalDiscountPrice;
 | 
			
		||||
 | 
			
		||||
  resp.data.totalPayAmount =
 | 
			
		||||
    totalPrice - totalDiscountPrice - Number(resp.data.totalPromotionAmount);
 | 
			
		||||
 | 
			
		||||
  if (userAddressReq) {
 | 
			
		||||
    resp.data.settleType = 1;
 | 
			
		||||
    resp.data.userAddress = userAddressReq;
 | 
			
		||||
  }
 | 
			
		||||
  return resp;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1212
									
								
								mini-program/model/order/orderDetail.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1212
									
								
								mini-program/model/order/orderDetail.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1054
									
								
								mini-program/model/order/orderList.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1054
									
								
								mini-program/model/order/orderList.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user