1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

通过微信开发者工具 商城模板 创建新小程序

This commit is contained in:
2023-03-06 23:52:24 +08:00
parent ada464a8cc
commit c21ff901d5
393 changed files with 52952 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
import { getActivity } from './activity';
export function getActivityList(baseID = 0, length = 10) {
return new Array(length).fill(0).map((_, idx) => getActivity(idx + baseID));
}
export const activityList = getActivityList();

View File

@@ -0,0 +1,18 @@
/**
* @param {string|number} key 唯一值
*/
export function getActivity(key) {
return {
promotionId: `${key}`,
title: `满减满折回归${key}`,
description: null,
promotionCode: 'MERCHANT',
promotionSubCode: key % 2 === 0 ? 'MYJ' : 'MYG',
tag: '满减',
timeType: 1,
startTime: '1588737710000',
endTime: '1601467070000',
teasingStartTime: null,
activityLadder: [{ label: '满100元减99.9元' }],
};
}

View File

@@ -0,0 +1,31 @@
/** 地址 */
export function genAddress(id) {
return {
saasId: '88888888',
uid: `8888888820550${id}`,
authToken: null,
id: `${id}`,
addressId: `${id}`,
phone: '17612345678',
name: `测试用户${id}`,
countryName: '中国',
countryCode: 'chn',
provinceName: '甘肃省',
provinceCode: '620000',
cityName: '甘南藏族自治州',
cityCode: '623000',
districtName: '碌曲县',
districtCode: '623026',
detailAddress: `松日鼎盛大厦${id}${id}`,
isDefault: `${id}` === '0' ? 1 : 0,
addressTag: id === 0 ? '' : '公司',
latitude: '34.59103',
longitude: '102.48699',
storeId: null,
};
}
/** 地址列表 */
export function genAddressList(len = 10) {
return new Array(len).fill(0).map((_, idx) => genAddress(idx));
}

324
mini-program/model/cart.js Normal file
View File

@@ -0,0 +1,324 @@
import { mockIp, mockReqId } from '../utils/mock';
export function genCartGroupData() {
const resp = {
data: {
isNotEmpty: true,
storeGoods: [
{
storeId: '1000',
storeName: '云Mall深圳旗舰店',
storeStatus: 1,
totalDiscountSalePrice: '9990',
promotionGoodsList: [
{
title: '满减满折回归',
promotionCode: 'MERCHANT',
promotionSubCode: 'MYJ',
promotionId: '159174555838121985',
tagText: ['满100元减99.9元'],
promotionStatus: 3,
tag: '满减',
description: '满100元减99.9元,已减99.9元',
doorSillRemain: null,
isNeedAddOnShop: 0,
goodsPromotionList: [
{
uid: '88888888205468',
saasId: '88888888',
storeId: '1000',
spuId: '12',
skuId: '135691622',
isSelected: 1,
thumb:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/dz-3a.png',
title:
'腾讯极光盒子4智能网络电视机顶盒6K千兆网络机顶盒4K高分辨率',
primaryImage:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/dz-3a.png',
quantity: 1,
stockStatus: true,
stockQuantity: 3,
price: '9900',
originPrice: '16900',
tagPrice: null,
titlePrefixTags: [{ text: '新品' }, { text: '火爆' }],
roomId: null,
specInfo: [
{
specTitle: '颜色',
specValue: '经典白',
},
{
specTitle: '类型',
specValue: '经典套装',
},
],
joinCartTime: '2020-06-29T07:55:40.000+0000',
available: 1,
putOnSale: 1,
etitle: null,
},
{
uid: '88888888205468',
saasId: '88888888',
storeId: '1000',
spuId: '18',
skuId: '135681631',
isSelected: 1,
thumb:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-09a.png',
title:
'白色短袖连衣裙荷叶边裙摆宽松韩版休闲纯白清爽优雅连衣裙',
primaryImage:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-09a.png',
quantity: 1,
stockStatus: true,
stockQuantity: 177,
price: '29800',
originPrice: '40000',
tagPrice: null,
titlePrefixTags: null,
roomId: null,
specInfo: [
{
specTitle: '颜色',
specValue: '米色荷叶边',
},
{
specTitle: '尺码',
specValue: 'M',
},
],
joinCartTime: '2020-06-29T07:55:27.000+0000',
available: 1,
putOnSale: 1,
etitle: null,
},
{
uid: '88888888205468',
saasId: '88888888',
storeId: '1000',
spuId: '13',
skuId: '135698362',
isSelected: 1,
thumb:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/muy-3a.png',
title:
'带帽午休毯虎年款多功能加厚加大加绒简约多功能午休毯连帽披肩',
primaryImage:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/muy-3a.png',
quantity: 13,
stockStatus: true,
stockQuantity: 9,
price: '29900',
originPrice: '0',
tagPrice: null,
titlePrefixTags: [{ text: '火爆' }],
roomId: null,
specInfo: [
{
specTitle: '颜色',
specValue: '浅灰色',
},
{
specTitle: '尺码',
specValue: 'M',
},
],
joinCartTime: '2020-06-29T07:54:43.000+0000',
available: 1,
putOnSale: 1,
etitle: null,
},
{
uid: '88888888205468',
saasId: '88888888',
storeId: '1000',
spuId: '7',
skuId: '135681625',
isSelected: 1,
thumb:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/gh-2b.png',
title:
'不锈钢刀叉勺套装家用西餐餐具ins简约耐用不锈钢金色银色可选',
primaryImage:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/gh-2b.png',
quantity: 1,
stockStatus: true,
stockQuantity: 0,
price: '29900',
originPrice: '29900',
tagPrice: null,
titlePrefixTags: null,
roomId: null,
specInfo: [
{
specTitle: '颜色',
specValue: '奶黄色',
},
{
specTitle: '数量',
specValue: '六件套',
},
],
joinCartTime: '2020-06-29T07:55:00.000+0000',
available: 1,
putOnSale: 1,
etitle: null,
},
],
lastJoinTime: '2020-06-29T07:55:40.000+0000',
},
{
title: null,
promotionCode: 'EMPTY_PROMOTION',
promotionSubCode: null,
promotionId: null,
tagText: null,
promotionStatus: null,
tag: null,
description: null,
doorSillRemain: null,
isNeedAddOnShop: 0,
goodsPromotionList: [
{
uid: '88888888205468',
saasId: '88888888',
storeId: '1000',
spuId: '11',
skuId: '135691629',
isSelected: 0,
thumb:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-17a.png',
title: '运动连帽拉链卫衣休闲开衫长袖多色运动细绒面料运动上衣',
primaryImage:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-17a.png',
quantity: 1,
stockStatus: false,
stockQuantity: 0,
price: '25900',
originPrice: '39900',
tagPrice: null,
tagText: null,
roomId: null,
specInfo: [
{
specTitle: '颜色',
specValue: '军绿色',
},
{
specTitle: '尺码',
specValue: 'S',
},
],
joinCartTime: '2020-04-24T06:26:48.000+0000',
available: 1,
putOnSale: 1,
etitle: null,
},
{
uid: '88888888205468',
saasId: '88888888',
storeId: '1000',
spuId: '5',
skuId: '135691635',
isSelected: 0,
thumb:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/dz-2a.png',
title:
'迷你便携高颜值蓝牙无线耳机立体声只能触控式操作简约立体声耳机',
primaryImage:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/dz-2a.png',
quantity: 1,
stockStatus: true,
stockQuantity: 96,
price: '29000',
originPrice: '29900',
tagPrice: null,
tagText: null,
roomId: null,
specInfo: [
{
specTitle: '颜色',
specValue: '黑色',
},
{
specTitle: '类型',
specValue: '简约款',
},
],
joinCartTime: '2020-06-29T07:55:17.000+0000',
available: 1,
putOnSale: 1,
etitle: null,
},
],
lastJoinTime: null,
},
],
lastJoinTime: '2020-06-29T07:55:40.000+0000',
postageFreePromotionVo: {
title: null,
promotionCode: null,
promotionSubCode: null,
promotionId: null,
tagText: null,
promotionStatus: null,
tag: null,
description: null,
doorSillRemain: null,
isNeedAddOnShop: 0,
},
},
],
invalidGoodItems: [
{
uid: '88888888205468',
saasId: '88888888',
storeId: '1000',
spuId: '1',
skuId: '135691631',
isSelected: 1,
thumb: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
title: '纯色纯棉休闲圆领短袖T恤纯白亲肤厚柔软细腻面料纯白短袖套头T恤',
primaryImage:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
quantity: 8,
stockStatus: true,
stockQuantity: 177,
price: '26900',
originPrice: '31900',
tagPrice: null,
tagText: null,
roomId: null,
specInfo: [
{
specTitle: '颜色',
specValue: '白色',
},
{
specTitle: '尺码',
specValue: 'S',
},
],
joinCartTime: '2020-04-28T04:03:59.000+0000',
available: 1,
putOnSale: 1,
etitle: null,
},
],
isAllSelected: false,
selectedGoodsCount: 16,
totalAmount: '179997',
totalDiscountAmount: '110000',
},
code: 'Success',
msg: null,
requestId: mockReqId(),
clientIp: mockIp(),
rt: 269,
success: true,
};
return resp;
}

View File

@@ -0,0 +1,206 @@
export function getCategoryList() {
return [
{
groupId: '24948',
name: '女装',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/miniapp/category/category-default.png',
children: [
{
groupId: '249481',
name: '女装',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/miniapp/category/category-default.png',
children: [
{
groupId: '249480',
name: '卫衣',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-1.png',
},
{
groupId: '249480',
name: '毛呢外套',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-2.png',
},
{
groupId: '249480',
name: '雪纺衫',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-3.png',
},
{
groupId: '249480',
name: '羽绒服',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-4.png',
},
{
groupId: '249480',
name: '毛衣',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-5.png',
},
{
groupId: '249480',
name: '棉衣',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-6.png',
},
{
groupId: '249480',
name: '西装',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-7.png',
},
{
groupId: '249480',
name: '马甲',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-8.png',
},
{
groupId: '249480',
name: '连衣裙',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-9.png',
},
{
groupId: '249480',
name: '半身裙',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-10.png',
},
{
groupId: '249480',
name: '裤子',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-11.png',
},
],
},
],
},
{
groupId: '24948',
name: '男装',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/miniapp/category/category-default.png',
children: [
{
groupId: '249481',
name: '男装',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/miniapp/category/category-default.png',
children: [
{
groupId: '249480',
name: '卫衣',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-1.png',
},
{
groupId: '249480',
name: '裤子',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-11.png',
},
{
groupId: '249480',
name: '西装',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-7.png',
},
{
groupId: '249480',
name: '羽绒服',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-4.png',
},
{
groupId: '249480',
name: '马甲',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-8.png',
},
],
},
],
},
{
groupId: '24948',
name: '儿童装',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/miniapp/category/category-default.png',
children: [
{
groupId: '249481',
name: '儿童装',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/miniapp/category/category-default.png',
children: [
{
groupId: '249480',
name: '马甲',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-8.png',
},
{
groupId: '249480',
name: '裤子',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-11.png',
},
{
groupId: '249480',
name: '连衣裙',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/classify/img-9.png',
},
{
groupId: '249480',
name: '其他',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/muy-3b.png',
},
],
},
],
},
{
groupId: '24948',
name: '美妆',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/miniapp/category/category-default.png',
children: [
{
groupId: '249481',
name: '美妆',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/miniapp/category/category-default.png',
children: [
{
groupId: '249480',
name: '唇釉',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/mz-20a1.png',
},
{
groupId: '249480',
name: '美妆蛋',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/mz-11a1.png',
},
{
groupId: '249480',
name: '眼影',
thumbnail:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/mz-12b.png',
},
],
},
],
},
];
}

View File

@@ -0,0 +1,338 @@
/**
* * @param {number} spuId
* @param {number} pageNum
* @param {number} pageSize
* @param {number} commentsLevel
* @param {boolean} hasImage
*/
export function getGoodsAllComments(params) {
const { hasImage } = params.queryParameter;
if (hasImage) {
return {
pageNum: 1,
pageSize: 10,
totalCount: '1',
pageList: [
{
spuId: '1722045',
skuId: '0',
specInfo: '',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentResources: [
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
type: 'image',
},
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/comment-video.mp4',
type: 'video',
coverSrc:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
},
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/comment-video.mp4',
type: 'video',
coverSrc:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
},
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/comment-video.mp4',
type: 'video',
coverSrc:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
},
],
commentScore: 4,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1591953561000',
isAutoComment: false,
sellerReply:
'亲,你好,我们会联系商家和厂商给您一个满意的答复请一定妥善保管好发票',
goodsDetailInfo: '颜色:纯净白 尺码:S码',
},
{
spuId: '1722045',
skuId: '0',
specInfo: '',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentResources: [
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
type: 'image',
},
],
commentScore: 4,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1591953561000',
isAutoComment: false,
sellerReply:
'亲,你好,我们会联系商家和厂商给您一个满意的答复请一定妥善保管好发票',
goodsDetailInfo: '颜色:纯净白 尺码:S码',
},
{
spuId: '1722045',
skuId: '0',
specInfo: '',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentResources: [
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
type: 'image',
},
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/comment-video.mp4',
type: 'video',
coverSrc:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
},
],
commentScore: 4,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1591953561000',
isAutoComment: false,
sellerReply:
'亲,你好,我们会联系商家和厂商给您一个满意的答复请一定妥善保管好发票',
goodsDetailInfo: '颜色:纯净白 尺码:S码',
},
{
spuId: '1722045',
skuId: '0',
specInfo: '',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentResources: [
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
type: 'image',
},
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/comment-video.mp4',
type: 'video',
coverSrc:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
},
{
src: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/comment-video.mp4',
type: 'video',
coverSrc:
'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-08b.png',
},
],
commentScore: 4,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1591953561000',
isAutoComment: false,
sellerReply:
'亲,你好,我们会联系商家和厂商给您一个满意的答复请一定妥善保管好发票',
goodsDetailInfo: '颜色:纯净白 尺码:S码',
},
],
};
}
return {
pageNum: 1,
pageSize: 10,
totalCount: '47',
pageList: [
{
spuId: '1722045',
skuId: '1697694',
specInfo: '很不错',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentImageUrls: null,
commentScore: 1,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1592224320000',
isAutoComment: false,
sellerReply:
'亲,你好,我们会联系商家和厂商给您一个满意的答复请一定妥善保管好发票',
goodsDetailInfo: '颜色:纯净白 尺码:S码',
},
{
spuId: '1722045',
skuId: '1697693',
specInfo: '很适合',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentImageUrls: null,
commentScore: 1,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1592224320000',
isAutoComment: false,
sellerReply:
'亲,你好,我们会联系商家和厂商给您一个满意的答复请一定妥善保管好发票',
goodsDetailInfo: '颜色:纯净白 尺码:S码',
},
{
spuId: '1722045',
skuId: '1697694',
specInfo: 'NICE',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentImageUrls: null,
commentScore: 5,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1592218074000',
isAutoComment: true,
sellerReply:
'亲,你好,我们会联系商家和厂商给您一个满意的答复请一定妥善保管好发票',
},
{
spuId: '1722045',
skuId: '0',
specInfo: '',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentImageUrls: null,
commentScore: 5,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1592218074000',
isAutoComment: false,
goodsDetailInfo: '颜色:纯净白 尺码:S码',
},
{
spuId: '1722045',
skuId: '1697694',
specInfo: '测试dr超长:dr专用超长;bwtgg01:fff',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentImageUrls: null,
commentScore: 5,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1592217607000',
isAutoComment: false,
},
{
spuId: '1722045',
skuId: '1697693',
specInfo: '测试dr超长:超长测试超长测试1;bwtgg01:bbb',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentImageUrls: null,
commentScore: 4,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1592217607000',
isAutoComment: false,
},
{
spuId: '1722045',
skuId: '1697694',
specInfo: '测试dr超长:dr专用超长;bwtgg01:fff',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentImageUrls: null,
commentScore: 5,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1592205599000',
isAutoComment: false,
},
{
spuId: '1722045',
skuId: '1697694',
specInfo: '测试dr超长:dr专用超长;bwtgg01:fff',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentImageUrls: null,
commentScore: 5,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1592188822000',
isAutoComment: false,
},
{
spuId: '1722045',
skuId: '1697694',
specInfo: '测试dr超长:dr专用超长;bwtgg01:fff',
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentImageUrls: null,
commentScore: 5,
uid: '88881055835',
userName: 'Max',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1593792002000',
isAutoComment: true,
},
{
spuId: '1722045',
skuId: '1697694',
specInfo: '测试dr超长:dr专用超长;bwtgg01:fff',
commentContent: '',
commentImageUrls: null,
commentScore: 5,
uid: '88881055835',
userName: 'Max',
userHeadUrl:
'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png',
isAnonymity: false,
commentTime: '1593792001000',
isAutoComment: true,
},
],
};
}
export function getGoodsCommentsCount() {
return {
commentCount: '47',
badCount: '0',
middleCount: '2',
goodCount: '45',
hasImageCount: '1',
goodRate: 95.7,
uidCount: '0',
};
}

View File

@@ -0,0 +1,50 @@
const queryDetail = {
commentInfos: [
{
id: '647984992708380600',
uid: '',
userName: 'Dean Cheng',
userHeadUrl:
'https://bizmid-material-qa-1302115263.cos.ap-guangzhou.myqcloud.com/comment/default_head.png',
commentId: '1937712',
commentIdName: '小鹿商品',
commentIdImageUrl:
'https://bizmid-material-qa-1302115263.file.myqcloud.com/persist/4bf2ded7-1759-4821-919c-cc4960e14120/1078823925183295617/100000114727/material/1/cdbeb389be64427b8c165627895ff0bc-1610425563793-%E5%A4%B4%E5%83%8F.png',
commentStage: 1,
commentCheckStatus: 2,
commentIdType: 1,
content: '',
commentInfo: {
score: null,
content: '',
medias: [],
commentTime: '1617872404000',
},
isAgainComment: 0,
commentHasAgainComment: 0,
isAnonymous: 0,
replyList: [],
specification: '颜色:白色 ',
specificationJson: '{"颜色":"白色"}',
commentExtendId: '1937713',
commentTime: '1617872404000',
score: 0,
goodsScore: null,
freightScore: null,
serviceScore: null,
medias: [],
againCommentList: null,
},
],
logisticsScore: null,
serviceScore: null,
};
/**
* @param {string} skuId
* @param {string} spuId
* @param {string} orderNo
*/
export function queryCommentDetail() {
return queryDetail;
}

View File

@@ -0,0 +1,39 @@
/**
* 优惠券
*
* @typedef {'default'|'useless'|'disabled'} CouponCardStatus
* @typedef {'discount'|'price'} CouponCardType
*
* @param {number} [id]
* @param {CouponCardStatus} [status]
* @param {CouponCardType} [type]
*/
export function getCoupon(id = 0, status = 'default', type = (id % 2) + 1) {
return {
/** key */
key: `${id}`,
/** 优惠券状态 */
status,
/** 优惠券类型 */
type,
/** 折扣或者满减值 */
value: type === 2 ? 5.5 : 1800,
/** 标签 */
tag: '',
/** 描述 */
desc: parseInt(id) > 0 ? `${parseInt(id) * 100}元可用` : '无门槛使用',
/** 订单底价,满n元 */
base: 10000 * (parseInt(id) || 0),
/** 标题 */
title: type === 2 ? `生鲜折扣券 - ${id}` : `生鲜满减券 - ${id}`,
/** 有效时间限制 */
timeLimit: '2019.11.18-2023.12.18',
/** 货币符号 */
currency: '¥',
};
}
/** 优惠券列表 */
export function getCouponList(status = 'default', length = 10) {
return new Array(length).fill(0).map((_, idx) => getCoupon(idx, status));
}

View File

@@ -0,0 +1,30 @@
export function getGoodsDetailsComments() {
return {
homePageComments: [
{
spuId: '1722045',
skuId: null,
specInfo: null,
commentContent:
'收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!',
commentScore: 4,
uid: '88881048075',
userName: 'Dean',
userHeadUrl:
'https://wx.qlogo.cn/mmopen/vi_32/5mKrvn3ibyDNaDZSZics3aoKlz1cv0icqn4EruVm6gKjsK0xvZZhC2hkUkRWGxlIzOEc4600JkzKn9icOLE6zjgsxw/132',
},
],
};
}
export function getGoodsDetailsCommentsCount() {
return {
commentCount: '47',
badCount: '0',
middleCount: '2',
goodCount: '45',
hasImageCount: '1',
goodRate: 95.7,
uidCount: '0',
};
}

1916
mini-program/model/good.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
import { genGood } from './good';
export function getGoodsList(baseID = 0, length = 10) {
return new Array(length).fill(0).map((_, idx) => genGood(idx + baseID));
}
export const goodsList = getGoodsList();

View 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;
}

View 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;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
import { getGoodsList } from './goods';
export function getPromotion(baseID = 0, length = 10) {
return {
list: getGoodsList(baseID, length).map((item) => {
return {
spuId: item.spuId,
thumb: item.primaryImage,
title: item.title,
price: item.minSalePrice,
originPrice: item.maxLinePrice,
tags: item.spuTagList.map((tag) => ({ title: tag.title })),
};
}),
banner:
'https://cdn-we-retail.ym.tencent.com/tsr/promotion/banner-promotion.png',
time: 1000 * 60 * 60 * 20,
showBannerDesc: true,
statusTag: 'running',
};
}

View File

@@ -0,0 +1,60 @@
import { getGoodsList } from './goods';
/**
* @param {number} sort
* @param {number} pageNum
* @param {number} pageSize
* @param {number} minPrice
* @param {number} maxPrice
* @param {string} keyword
*/
export function getSearchHistory() {
return {
historyWords: [
'鸡',
'电脑',
'iPhone12',
'车载手机支架',
'自然堂',
'小米10',
'原浆古井贡酒',
'欧米伽',
'华为',
'针织半身裙',
'氢跑鞋',
'三盒处理器',
],
};
}
export function getSearchPopular() {
return {
popularWords: [
'鸡',
'电脑',
'iPhone12',
'车载手机支架',
'自然堂',
'小米10',
'原浆古井贡酒',
'欧米伽',
'华为',
'针织半身裙',
'氢跑鞋',
'三盒处理器',
],
};
}
export function getSearchResult() {
return {
saasId: null,
storeId: null,
pageNum: 1,
pageSize: 30,
totalCount: 1,
spuList: getGoodsList(7),
algId: 0,
};
}

View File

@@ -0,0 +1,58 @@
export function getGoods() {
return {
goods: [
{
squid: '1',
checkItems: [
{
name: '匿名评价',
value: 'anonymous',
checked: false,
},
],
detail: {
image:
'https://wx.qlogo.cn/mmopen/vi_32/51VSMNuy1CyHiaAhAjLJ00kMZVqqnCqXeZduCLXHUBr52zFHRGxwL7kGia3fHj8GSNzFcqFDInQmRGM1eWjtQgqA/132',
title: '',
},
goodComment: {
/** 商品评价 */
rate: 0,
/** 评价内容 */
label: '123',
/** 上传图片 */
images: [],
},
},
{
squid: '2',
checkItems: [
{
name: '匿名评价',
value: 'anonymous',
checked: false,
},
],
detail: {
image:
'https://wx.qlogo.cn/mmopen/vi_32/51VSMNuy1CyHiaAhAjLJ00kMZVqqnCqXeZduCLXHUBr52zFHRGxwL7kGia3fHj8GSNzFcqFDInQmRGM1eWjtQgqA/132',
title: '评价内容 山姆智利进口',
},
goodComment: {
/** 商品评价 */
rate: 0,
/** 评价内容 */
label: '山姆智利进口',
/** 上传图片 */
images: [],
},
},
],
storeComment: {
/** 物流评价 */
logisticsRate: 0,
/** 服务评价 */
servicesRate: 0,
},
};
}

View File

@@ -0,0 +1,39 @@
// const images = [
// {
// img: 'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner1.png',
// text: '1',
// },
// {
// img: 'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner2.png',
// text: '2',
// },
// {
// img: 'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner3.png',
// text: '3',
// },
// {
// img: 'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner4.png',
// text: '4',
// },
// {
// img: 'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner5.png',
// text: '5',
// },
// {
// img: 'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner6.png',
// text: '6',
// },
// ];
const images = [
'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner1.png',
'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner2.png',
'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner3.png',
'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner4.png',
'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner5.png',
'https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner6.png',
];
export function genSwiperImageList() {
return images;
}

View File

@@ -0,0 +1,52 @@
const userInfo = {
avatarUrl:
'https://we-retail-static-1300977798.cos.ap-guangzhou.myqcloud.com/retail-ui/components-exp/avatar/avatar-1.jpg',
nickName: 'TDesign 🌟',
phoneNumber: '13438358888',
gender: 2,
};
const countsData = [
{
num: 2,
name: '积分',
type: 'point',
},
{
num: 10,
name: '优惠券',
type: 'coupon',
},
];
const orderTagInfos = [
{
orderNum: 1,
tabType: 5,
},
{
orderNum: 1,
tabType: 10,
},
{
orderNum: 1,
tabType: 40,
},
{
orderNum: 0,
tabType: 0,
},
];
const customerServiceInfo = {
servicePhone: '4006336868',
serviceTimeDuration: '每周三至周五 9:00-12:00 13:00-15:00',
};
export const genSimpleUserInfo = () => ({ ...userInfo });
export const genUsercenter = () => ({
userInfo,
countsData,
orderTagInfos,
customerServiceInfo,
});