diff --git a/pages.json b/pages.json index 78d7c31..0b90b88 100644 --- a/pages.json +++ b/pages.json @@ -1,667 +1,695 @@ { - "easycom": { - "autoscan": true, - "custom": { - "^s-(.*)": "@/sheep/components/s-$1/s-$1.vue", - "^su-(.*)": "@/sheep/ui/su-$1/su-$1.vue" - } - }, - "pages": [{ - "path": "pages/index/index", - "aliasPath": "/", - "style": { - "navigationBarTitleText": "首页", - "enablePullDownRefresh": true - }, - "meta": { - "auth": false, - "sync": true, - "title": "首页", - "group": "商城" - } - }, - { - "path": "pages/index/user", - "style": { - "navigationBarTitleText": "个人中心", - "enablePullDownRefresh": true - }, - "meta": { - "sync": true, - "title": "个人中心", - "group": "商城" - } - }, - { - "path": "pages/index/category", - "style": { - "navigationBarTitleText": "商品分类" - }, - "meta": { - "sync": true, - "title": "商品分类", - "group": "商城" - } - }, - { - "path": "pages/index/cart", - "style": { - "navigationBarTitleText": "购物车" - }, - "meta": { - "sync": true, - "title": "购物车", - "group": "商城" - } - }, - { - "path": "pages/index/login", - "style": { - "navigationBarTitleText": "登录" - } - }, - { - "path": "pages/index/search", - "style": { - "navigationBarTitleText": "搜索" - }, - "meta": { - "sync": true, - "title": "搜索", - "group": "商城" - } - }, - { - "path": "pages/index/page", - "style": { - "navigationBarTitleText": "" - }, - "meta": { - "auth": false, - "sync": true, - "title": "自定义页面", - "group": "商城" - } - } - ], - "subPackages": [{ - "root": "pages/goods", - "pages": [{ - "path": "index", - "style": { - "navigationBarTitleText": "商品详情" - }, - "meta": { - "sync": true, - "title": "普通商品", - "group": "商品" - } - }, - { - "path": "groupon", - "style": { - "navigationBarTitleText": "拼团商品" - }, - "meta": { - "sync": true, - "title": "拼团商品", - "group": "商品" - } - }, - - { - "path": "seckill", - "style": { - "navigationBarTitleText": "秒杀商品" - }, - "meta": { - "sync": true, - "title": "秒杀商品", - "group": "商品" - } - }, - { - "path": "list", - "style": { - "navigationBarTitleText": "商品列表" - }, - "meta": { - "sync": true, - "title": "商品列表", - "group": "商品" - } - }, - { - "path": "comment/add", - "style": { - "navigationBarTitleText": "评价商品" - }, - "meta": { - "auth": true - } - }, - { - "path": "comment/list", - "style": { - "navigationBarTitleText": "商品评价" - } - } - ] - }, - { - "root": "pages/order", - "pages": [{ - "path": "detail", - "style": { - "navigationBarTitleText": "订单详情" - }, - "meta": { - "auth": true, - "title": "订单详情" - } - }, - { - "path": "confirm", - "style": { - "navigationBarTitleText": "确认订单" - }, - "meta": { - "auth": true, - "title": "确认订单" - } - }, - { - "path": "list", - "style": { - "navigationBarTitleText": "我的订单", - "enablePullDownRefresh": true - }, - "meta": { - "auth": true, - "sync": true, - "title": "用户订单", - "group": "订单中心" - } - }, - { - "path": "aftersale/apply", - "style": { - "navigationBarTitleText": "申请售后" - }, - "meta": { - "auth": true, - "title": "申请售后" - } - }, - { - "path": "aftersale/return-delivery", - "style": { - "navigationBarTitleText": "退货物流" - }, - "meta": { - "auth": true, - "title": "退货物流" - } - }, - { - "path": "aftersale/list", - "style": { - "navigationBarTitleText": "售后列表" - }, - "meta": { - "auth": true, - "sync": true, - "title": "售后订单", - "group": "订单中心" - } - }, - { - "path": "aftersale/detail", - "style": { - "navigationBarTitleText": "售后详情" - }, - "meta": { - "auth": true, - "title": "售后详情" - } - }, - { - "path": "aftersale/log", - "style": { - "navigationBarTitleText": "售后进度" - }, - "meta": { - "auth": true, - "title": "售后进度" - } - }, - { - "path": "express/log", - "style": { - "navigationBarTitleText": "物流轨迹" - }, - "meta": { - "auth": true, - "title": "物流轨迹" - } - } - ] - }, - { - "root": "pages/user", - "pages": [{ - "path": "info", - "style": { - "navigationBarTitleText": "我的信息" - }, - "meta": { - "auth": true, - "sync": true, - "title": "用户信息", - "group": "用户中心" - } - }, - { - "path": "goods-collect", - "style": { - "navigationBarTitleText": "我的收藏" - }, - "meta": { - "auth": true, - "sync": true, - "title": "商品收藏", - "group": "用户中心" - } - }, - { - "path": "goods-log", - "style": { - "navigationBarTitleText": "我的足迹" - }, - "meta": { - "auth": true, - "sync": true, - "title": "浏览记录", - "group": "用户中心" - } - }, - { - "path": "address/list", - "style": { - "navigationBarTitleText": "收货地址" - }, - "meta": { - "auth": true, - "sync": true, - "title": "地址管理", - "group": "用户中心" - } - }, - { - "path": "address/edit", - "style": { - "navigationBarTitleText": "编辑地址" - }, - "meta": { - "auth": true, - "title": "编辑地址" - } - }, - { - "path": "goods_details_store/index", - "style": { - "navigationBarTitleText": "自提门店" - }, - "meta": { - "auth": true, - "sync": true, - "title": "地址管理", - "group": "用户中心" - } - }, - { - "path": "wallet/money", - "style": { - "navigationBarTitleText": "我的余额" - }, - "meta": { - "auth": true, - "sync": true, - "title": "用户余额", - "group": "用户中心" - } - }, - { - "path": "wallet/score", - "style": { - "navigationBarTitleText": "我的积分" - }, - "meta": { - "auth": true, - "sync": true, - "title": "用户积分", - "group": "用户中心" - } - } - ] - }, - { - "root": "pages/commission", - "pages": [{ - "path": "index", - "style": { - "navigationBarTitleText": "分销" - }, - "meta": { - "auth": true, - "sync": true, - "title": "分销中心", - "group": "分销商城" - } - }, - { - "path": "wallet", - "style": { - "navigationBarTitleText": "我的佣金" - }, - "meta": { - "auth": true, - "sync": true, - "title": "用户佣金", - "group": "分销中心" - } - }, - { - "path": "goods", - "style": { - "navigationBarTitleText": "推广商品" - }, - "meta": { - "auth": true, - "sync": true, - "title": "推广商品", - "group": "分销商城" - } - }, - { - "path": "order", - "style": { - "navigationBarTitleText": "分销订单" - }, - "meta": { - "auth": true, - "sync": true, - "title": "分销订单", - "group": "分销商城" - } - }, - { - "path": "team", - "style": { - "navigationBarTitleText": "我的团队" - }, - "meta": { - "auth": true, - "sync": true, - "title": "我的团队", - "group": "分销商城" - } - }, { - "path": "promoter", - "style": { - "navigationBarTitleText": "推广人排行榜" - }, - "meta": { - "auth": true, - "sync": true, - "title": "推广人排行榜", - "group": "分销商城" - } - }, { - "path": "commission-ranking", - "style": { - "navigationBarTitleText": "佣金排行榜" - }, - "meta": { - "auth": true, - "sync": true, - "title": "佣金排行榜", - "group": "分销商城" - } - }, { - "path": "withdraw", - "style": { - "navigationBarTitleText": "申请提现" - }, - "meta": { - "auth": true, - "sync": true, - "title": "申请提现", - "group": "分销商城" - } - } - ] - }, - { - "root": "pages/app", - "pages": [{ - "path": "sign", - "style": { - "navigationBarTitleText": "签到中心" - }, - "meta": { - "auth": true, - "sync": true, - "title": "签到中心", - "group": "应用" - } - }] - }, - { - "root": "pages/public", - "pages": [{ - "path": "setting", - "style": { - "navigationBarTitleText": "系统设置" - }, - "meta": { - "sync": true, - "title": "系统设置", - "group": "通用" - } - }, - { - "path": "richtext", - "style": { - "navigationBarTitleText": "富文本" - }, - "meta": { - "sync": true, - "title": "富文本", - "group": "通用" - } - }, - { - "path": "faq", - "style": { - "navigationBarTitleText": "常见问题" - }, - "meta": { - "sync": true, - "title": "常见问题", - "group": "通用" - } - }, - { - "path": "error", - "style": { - "navigationBarTitleText": "错误页面" - } - }, - { - "path": "webview", - "style": { - "navigationBarTitleText": "" - } - } - ] - }, - { - "root": "pages/coupon", - "pages": [{ - "path": "list", - "style": { - "navigationBarTitleText": "领券中心" - }, - "meta": { - "sync": true, - "title": "领券中心", - "group": "优惠券" - } - }, - { - "path": "detail", - "style": { - "navigationBarTitleText": "优惠券" - }, - "meta": { - "auth": false, - "sync": true, - "title": "优惠券详情", - "group": "优惠券" - } - } - ] - }, - { - "root": "pages/chat", - "pages": [{ - "path": "index", - "style": { - "navigationBarTitleText": "客服" - }, - "meta": { - "auth": true, - "sync": true, - "title": "客服", - "group": "客服" - } - }] - }, - { - "root": "pages/pay", - "pages": [{ - "path": "index", - "style": { - "navigationBarTitleText": "收银台" - } - }, - { - "path": "result", - "style": { - "navigationBarTitleText": "支付结果" - } - }, - { - "path": "recharge", - "style": { - "navigationBarTitleText": "充值余额" - }, - "meta": { - "auth": true, - "sync": true, - "title": "充值余额", - "group": "支付" - } - }, - { - "path": "recharge-log", - "style": { - "navigationBarTitleText": "充值记录" - }, - "meta": { - "auth": true, - "sync": true, - "title": "充值记录", - "group": "支付" - } - } - ] - }, - { - "root": "pages/activity", - "pages": [{ - "path": "groupon/detail", - "style": { - "navigationBarTitleText": "拼团详情" - } - }, - { - "path": "groupon/order", - "style": { - "navigationBarTitleText": "我的拼团", - "enablePullDownRefresh": true - }, - "meta": { - "auth": true, - "sync": true, - "title": "拼团订单", - "group": "营销活动" - } - }, - { - "path": "index", - "style": { - "navigationBarTitleText": "营销商品" - }, - "meta": { - "sync": true, - "title": "营销商品", - "group": "营销活动" - } - }, - { - "path": "groupon/list", - "style": { - "navigationBarTitleText": "拼团活动" - }, - "meta": { - "sync": true, - "title": "拼团活动", - "group": "营销活动" - } - }, - { - "path": "seckill/list", - "style": { - "navigationBarTitleText": "秒杀活动" - }, - "meta": { - "sync": true, - "title": "秒杀活动", - "group": "营销活动" - } - } - ] - } - ], - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "芋道商城", - "navigationBarBackgroundColor": "#FFFFFF", - "backgroundColor": "#FFFFFF", - "navigationStyle": "custom" - }, - "tabBar": { - "list": [{ - "pagePath": "pages/index/index" - }, - { - "pagePath": "pages/index/cart" - }, - { - "pagePath": "pages/index/user" - } - ] - } + "easycom": { + "autoscan": true, + "custom": { + "^s-(.*)": "@/sheep/components/s-$1/s-$1.vue", + "^su-(.*)": "@/sheep/ui/su-$1/su-$1.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "aliasPath": "/", + "style": { + "navigationBarTitleText": "首页", + "enablePullDownRefresh": true + }, + "meta": { + "auth": false, + "sync": true, + "title": "首页", + "group": "商城" + } + }, + { + "path": "pages/index/user", + "style": { + "navigationBarTitleText": "个人中心", + "enablePullDownRefresh": true + }, + "meta": { + "sync": true, + "title": "个人中心", + "group": "商城" + } + }, + { + "path": "pages/index/category", + "style": { + "navigationBarTitleText": "商品分类" + }, + "meta": { + "sync": true, + "title": "商品分类", + "group": "商城" + } + }, + { + "path": "pages/index/cart", + "style": { + "navigationBarTitleText": "购物车" + }, + "meta": { + "sync": true, + "title": "购物车", + "group": "商城" + } + }, + { + "path": "pages/index/login", + "style": { + "navigationBarTitleText": "登录" + } + }, + { + "path": "pages/index/search", + "style": { + "navigationBarTitleText": "搜索" + }, + "meta": { + "sync": true, + "title": "搜索", + "group": "商城" + } + }, + { + "path": "pages/index/page", + "style": { + "navigationBarTitleText": "" + }, + "meta": { + "auth": false, + "sync": true, + "title": "自定义页面", + "group": "商城" + } + } + ], + "subPackages": [ + { + "root": "pages/goods", + "pages": [ + { + "path": "index", + "style": { + "navigationBarTitleText": "商品详情" + }, + "meta": { + "sync": true, + "title": "普通商品", + "group": "商品" + } + }, + { + "path": "groupon", + "style": { + "navigationBarTitleText": "拼团商品" + }, + "meta": { + "sync": true, + "title": "拼团商品", + "group": "商品" + } + }, + { + "path": "seckill", + "style": { + "navigationBarTitleText": "秒杀商品" + }, + "meta": { + "sync": true, + "title": "秒杀商品", + "group": "商品" + } + }, + { + "path": "point", + "style": { + "navigationBarTitleText": "积分商品" + }, + "meta": { + "sync": true, + "title": "积分商品", + "group": "商品" + } + }, + { + "path": "list", + "style": { + "navigationBarTitleText": "商品列表" + }, + "meta": { + "sync": true, + "title": "商品列表", + "group": "商品" + } + }, + { + "path": "comment/add", + "style": { + "navigationBarTitleText": "评价商品" + }, + "meta": { + "auth": true + } + }, + { + "path": "comment/list", + "style": { + "navigationBarTitleText": "商品评价" + } + } + ] + }, + { + "root": "pages/order", + "pages": [ + { + "path": "detail", + "style": { + "navigationBarTitleText": "订单详情" + }, + "meta": { + "auth": true, + "title": "订单详情" + } + }, + { + "path": "confirm", + "style": { + "navigationBarTitleText": "确认订单" + }, + "meta": { + "auth": true, + "title": "确认订单" + } + }, + { + "path": "list", + "style": { + "navigationBarTitleText": "我的订单", + "enablePullDownRefresh": true + }, + "meta": { + "auth": true, + "sync": true, + "title": "用户订单", + "group": "订单中心" + } + }, + { + "path": "aftersale/apply", + "style": { + "navigationBarTitleText": "申请售后" + }, + "meta": { + "auth": true, + "title": "申请售后" + } + }, + { + "path": "aftersale/return-delivery", + "style": { + "navigationBarTitleText": "退货物流" + }, + "meta": { + "auth": true, + "title": "退货物流" + } + }, + { + "path": "aftersale/list", + "style": { + "navigationBarTitleText": "售后列表" + }, + "meta": { + "auth": true, + "sync": true, + "title": "售后订单", + "group": "订单中心" + } + }, + { + "path": "aftersale/detail", + "style": { + "navigationBarTitleText": "售后详情" + }, + "meta": { + "auth": true, + "title": "售后详情" + } + }, + { + "path": "aftersale/log", + "style": { + "navigationBarTitleText": "售后进度" + }, + "meta": { + "auth": true, + "title": "售后进度" + } + }, + { + "path": "express/log", + "style": { + "navigationBarTitleText": "物流轨迹" + }, + "meta": { + "auth": true, + "title": "物流轨迹" + } + } + ] + }, + { + "root": "pages/user", + "pages": [ + { + "path": "info", + "style": { + "navigationBarTitleText": "我的信息" + }, + "meta": { + "auth": true, + "sync": true, + "title": "用户信息", + "group": "用户中心" + } + }, + { + "path": "goods-collect", + "style": { + "navigationBarTitleText": "我的收藏" + }, + "meta": { + "auth": true, + "sync": true, + "title": "商品收藏", + "group": "用户中心" + } + }, + { + "path": "goods-log", + "style": { + "navigationBarTitleText": "我的足迹" + }, + "meta": { + "auth": true, + "sync": true, + "title": "浏览记录", + "group": "用户中心" + } + }, + { + "path": "address/list", + "style": { + "navigationBarTitleText": "收货地址" + }, + "meta": { + "auth": true, + "sync": true, + "title": "地址管理", + "group": "用户中心" + } + }, + { + "path": "address/edit", + "style": { + "navigationBarTitleText": "编辑地址" + }, + "meta": { + "auth": true, + "title": "编辑地址" + } + }, + { + "path": "goods_details_store/index", + "style": { + "navigationBarTitleText": "自提门店" + }, + "meta": { + "auth": true, + "sync": true, + "title": "地址管理", + "group": "用户中心" + } + }, + { + "path": "wallet/money", + "style": { + "navigationBarTitleText": "我的余额" + }, + "meta": { + "auth": true, + "sync": true, + "title": "用户余额", + "group": "用户中心" + } + }, + { + "path": "wallet/score", + "style": { + "navigationBarTitleText": "我的积分" + }, + "meta": { + "auth": true, + "sync": true, + "title": "用户积分", + "group": "用户中心" + } + } + ] + }, + { + "root": "pages/commission", + "pages": [ + { + "path": "index", + "style": { + "navigationBarTitleText": "分销" + }, + "meta": { + "auth": true, + "sync": true, + "title": "分销中心", + "group": "分销商城" + } + }, + { + "path": "wallet", + "style": { + "navigationBarTitleText": "我的佣金" + }, + "meta": { + "auth": true, + "sync": true, + "title": "用户佣金", + "group": "分销中心" + } + }, + { + "path": "goods", + "style": { + "navigationBarTitleText": "推广商品" + }, + "meta": { + "auth": true, + "sync": true, + "title": "推广商品", + "group": "分销商城" + } + }, + { + "path": "order", + "style": { + "navigationBarTitleText": "分销订单" + }, + "meta": { + "auth": true, + "sync": true, + "title": "分销订单", + "group": "分销商城" + } + }, + { + "path": "team", + "style": { + "navigationBarTitleText": "我的团队" + }, + "meta": { + "auth": true, + "sync": true, + "title": "我的团队", + "group": "分销商城" + } + }, + { + "path": "promoter", + "style": { + "navigationBarTitleText": "推广人排行榜" + }, + "meta": { + "auth": true, + "sync": true, + "title": "推广人排行榜", + "group": "分销商城" + } + }, + { + "path": "commission-ranking", + "style": { + "navigationBarTitleText": "佣金排行榜" + }, + "meta": { + "auth": true, + "sync": true, + "title": "佣金排行榜", + "group": "分销商城" + } + }, + { + "path": "withdraw", + "style": { + "navigationBarTitleText": "申请提现" + }, + "meta": { + "auth": true, + "sync": true, + "title": "申请提现", + "group": "分销商城" + } + } + ] + }, + { + "root": "pages/app", + "pages": [ + { + "path": "sign", + "style": { + "navigationBarTitleText": "签到中心" + }, + "meta": { + "auth": true, + "sync": true, + "title": "签到中心", + "group": "应用" + } + } + ] + }, + { + "root": "pages/public", + "pages": [ + { + "path": "setting", + "style": { + "navigationBarTitleText": "系统设置" + }, + "meta": { + "sync": true, + "title": "系统设置", + "group": "通用" + } + }, + { + "path": "richtext", + "style": { + "navigationBarTitleText": "富文本" + }, + "meta": { + "sync": true, + "title": "富文本", + "group": "通用" + } + }, + { + "path": "faq", + "style": { + "navigationBarTitleText": "常见问题" + }, + "meta": { + "sync": true, + "title": "常见问题", + "group": "通用" + } + }, + { + "path": "error", + "style": { + "navigationBarTitleText": "错误页面" + } + }, + { + "path": "webview", + "style": { + "navigationBarTitleText": "" + } + } + ] + }, + { + "root": "pages/coupon", + "pages": [ + { + "path": "list", + "style": { + "navigationBarTitleText": "领券中心" + }, + "meta": { + "sync": true, + "title": "领券中心", + "group": "优惠券" + } + }, + { + "path": "detail", + "style": { + "navigationBarTitleText": "优惠券" + }, + "meta": { + "auth": false, + "sync": true, + "title": "优惠券详情", + "group": "优惠券" + } + } + ] + }, + { + "root": "pages/chat", + "pages": [ + { + "path": "index", + "style": { + "navigationBarTitleText": "客服" + }, + "meta": { + "auth": true, + "sync": true, + "title": "客服", + "group": "客服" + } + } + ] + }, + { + "root": "pages/pay", + "pages": [ + { + "path": "index", + "style": { + "navigationBarTitleText": "收银台" + } + }, + { + "path": "result", + "style": { + "navigationBarTitleText": "支付结果" + } + }, + { + "path": "recharge", + "style": { + "navigationBarTitleText": "充值余额" + }, + "meta": { + "auth": true, + "sync": true, + "title": "充值余额", + "group": "支付" + } + }, + { + "path": "recharge-log", + "style": { + "navigationBarTitleText": "充值记录" + }, + "meta": { + "auth": true, + "sync": true, + "title": "充值记录", + "group": "支付" + } + } + ] + }, + { + "root": "pages/activity", + "pages": [ + { + "path": "groupon/detail", + "style": { + "navigationBarTitleText": "拼团详情" + } + }, + { + "path": "groupon/order", + "style": { + "navigationBarTitleText": "我的拼团", + "enablePullDownRefresh": true + }, + "meta": { + "auth": true, + "sync": true, + "title": "拼团订单", + "group": "营销活动" + } + }, + { + "path": "index", + "style": { + "navigationBarTitleText": "营销商品" + }, + "meta": { + "sync": true, + "title": "营销商品", + "group": "营销活动" + } + }, + { + "path": "groupon/list", + "style": { + "navigationBarTitleText": "拼团活动" + }, + "meta": { + "sync": true, + "title": "拼团活动", + "group": "营销活动" + } + }, + { + "path": "seckill/list", + "style": { + "navigationBarTitleText": "秒杀活动" + }, + "meta": { + "sync": true, + "title": "秒杀活动", + "group": "营销活动" + } + } + ] + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "芋道商城", + "navigationBarBackgroundColor": "#FFFFFF", + "backgroundColor": "#FFFFFF", + "navigationStyle": "custom" + }, + "tabBar": { + "list": [ + { + "pagePath": "pages/index/index" + }, + { + "pagePath": "pages/index/cart" + }, + { + "pagePath": "pages/index/user" + } + ] + } } diff --git a/pages/activity/index.vue b/pages/activity/index.vue index 56417ed..9573915 100644 --- a/pages/activity/index.vue +++ b/pages/activity/index.vue @@ -7,7 +7,7 @@ 满减: - {{ formatRewardActivityRule(state.activityInfo, item) }} + {{ item.description }} @@ -65,8 +65,9 @@ import sheep from '@/sheep'; import _ from 'lodash-es'; import RewardActivityApi from '@/sheep/api/promotion/rewardActivity'; - import { formatRewardActivityRule } from '@/sheep/hooks/useGoods'; import SpuApi from '@/sheep/api/product/spu'; + import { appendSettlementProduct } from '@/sheep/hooks/useGoods'; + import OrderApi from '@/sheep/api/trade/order'; const state = reactive({ activityId: 0, // 获得编号 @@ -123,6 +124,13 @@ if (code !== 0) { return; } + // 拼接结算信息(营销) + await OrderApi.getSettlementProduct(data.list.map((item) => item.id).join(',')).then((res) => { + if (res.code !== 0) { + return; + } + appendSettlementProduct(data.list, res.data); + }); state.pagination.list = _.concat(state.pagination.list, data.list); state.pagination.total = data.total; state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore'; diff --git a/pages/activity/point/list.vue b/pages/activity/point/list.vue new file mode 100644 index 0000000..5774175 --- /dev/null +++ b/pages/activity/point/list.vue @@ -0,0 +1,78 @@ + + + diff --git a/pages/activity/seckill/list.vue b/pages/activity/seckill/list.vue index a1714bb..8d3e371 100644 --- a/pages/activity/seckill/list.vue +++ b/pages/activity/seckill/list.vue @@ -3,13 +3,20 @@ - + @@ -22,17 +29,28 @@ - + - - + + {{ config.startTime }} - {{ config.status }} + {{ config?.status }} @@ -42,7 +60,10 @@ - + 距结束 {{ countDown.h }} @@ -70,19 +91,44 @@ :data="{ ...activity, price: activity.seckillPrice }" :goodsFields="goodsFields" :seckillTag="true" - @click="sheep.$router.go('/pages/goods/seckill', { id: activity.id })" > @@ -100,40 +146,51 @@ diff --git a/pages/goods/list.vue b/pages/goods/list.vue index 1fdf559..dd5754b 100644 --- a/pages/goods/list.vue +++ b/pages/goods/list.vue @@ -118,12 +118,14 @@ + + diff --git a/pages/goods/seckill.vue b/pages/goods/seckill.vue index 34708d6..004efc7 100644 --- a/pages/goods/seckill.vue +++ b/pages/goods/seckill.vue @@ -225,8 +225,8 @@ const getActivity = async (id) => { const { data } = await SeckillApi.getSeckillActivity(id); activity.value = data; - timeStatusEnum.value = getTimeStatusEnum(activity.startTime, activity.endTime); - + timeStatusEnum.value = getTimeStatusEnum(activity.value.startTime, activity.value.endTime); + state.percent = 100 - (data.stock / data.totalStock) * 100; // 查询商品 await getSpu(data.spuId); }; @@ -284,6 +284,7 @@ .disabled-btn-box[disabled] { background-color: transparent; } + .detail-card { background-color: $white; margin: 14rpx 20rpx; @@ -374,6 +375,7 @@ font-size: 26rpx; font-weight: 500; color: #ffffff; + .countdown-h { font-size: 24rpx; font-family: OPPOSANS; @@ -384,6 +386,7 @@ background: rgba(#000000, 0.1); border-radius: 6rpx; } + .countdown-num { font-size: 24rpx; font-family: OPPOSANS; @@ -467,6 +470,7 @@ line-height: normal; border-radius: 0px 40rpx 40rpx 0px; } + .btn-price { font-family: OPPOSANS; @@ -484,6 +488,7 @@ line-height: normal; font-size: 24rpx; font-weight: 500; + .no-original { font-size: 28rpx; } diff --git a/pages/order/aftersale/apply.vue b/pages/order/aftersale/apply.vue index 805ea94..bd69a90 100644 --- a/pages/order/aftersale/apply.vue +++ b/pages/order/aftersale/apply.vue @@ -208,7 +208,7 @@ state.itemId = parseInt(options.itemId); // 读取订单信息 - const { code, data } = await OrderApi.getOrder(state.orderId); + const { code, data } = await OrderApi.getOrderDetail(state.orderId); if (code !== 0) { return; } diff --git a/pages/order/confirm.vue b/pages/order/confirm.vue index 70393b2..697f6b1 100644 --- a/pages/order/confirm.vue +++ b/pages/order/confirm.vue @@ -143,8 +143,7 @@ v-if="state.orderInfo.price.discountPrice > 0" > 活动优惠 - - + -¥{{ fen2yuan(state.orderInfo.price.discountPrice) }} @@ -295,6 +294,7 @@ combinationActivityId: state.orderPayload.combinationActivityId, combinationHeadId: state.orderPayload.combinationHeadId, seckillActivityId: state.orderPayload.seckillActivityId, + pointActivityId: state.orderPayload.pointActivityId, }); if (code !== 0) { return; @@ -325,6 +325,7 @@ combinationActivityId: state.orderPayload.combinationActivityId, combinationHeadId: state.orderPayload.combinationHeadId, seckillActivityId: state.orderPayload.seckillActivityId, + pointActivityId: state.orderPayload.pointActivityId, }); if (code !== 0) { return; diff --git a/pages/order/detail.vue b/pages/order/detail.vue index ed0119f..b276d35 100644 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -127,7 +127,11 @@ - + @@ -305,7 +309,7 @@ uni.showModal({ title: '提示', content: '确定要取消订单吗?', - success: async function(res) { + success: async function (res) { if (!res.confirm) { return; } @@ -394,11 +398,11 @@ let res; if (state.comeinType === 'wechat') { // TODO 芋艿:微信场景下 - res = await OrderApi.getOrder(id, { + res = await OrderApi.getOrderDetail(id, { merchant_trade_no: state.merchantTradeNo, }); } else { - res = await OrderApi.getOrder(id); + res = await OrderApi.getOrderDetail(id); } if (res.code === 0) { state.orderInfo = res.data; @@ -451,7 +455,7 @@ color: rgba(#fff, 0.9); width: 100%; background: v-bind(headerBg) no-repeat, - linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); + linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); background-size: 750rpx 100%; box-sizing: border-box; diff --git a/pages/order/express/log.vue b/pages/order/express/log.vue index eb992a5..c852edc 100644 --- a/pages/order/express/log.vue +++ b/pages/order/express/log.vue @@ -13,10 +13,10 @@ - - - - + + + + 快递单号:{{ state.info.logisticsNo }} 快递公司:{{ state.info.logisticsName }} @@ -35,9 +35,9 @@ - - - + + + {{ item.content }} {{ sheep.$helper.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss') }} @@ -78,7 +78,7 @@ } async function getOrderDetail(id) { - const { data } = await OrderApi.getOrder(id) + const { data } = await OrderApi.getOrderDetail(id); state.info = data; } diff --git a/pages/order/pickUpVerify.vue b/pages/order/pickUpVerify.vue index 1e8bb6e..4b4db37 100644 --- a/pages/order/pickUpVerify.vue +++ b/pages/order/pickUpVerify.vue @@ -19,15 +19,15 @@ {{ orderInfo.pickUpVerifyCode }} - - - - - - - - - + + + 核销时间 + + + 每日: + 2020-2-+52 + + @@ -138,7 +138,6 @@ diff --git a/sheep/components/s-activity-pop/s-activity-pop.vue b/sheep/components/s-activity-pop/s-activity-pop.vue index 432dc45..44a028a 100644 --- a/sheep/components/s-activity-pop/s-activity-pop.vue +++ b/sheep/components/s-activity-pop/s-activity-pop.vue @@ -2,34 +2,81 @@ diff --git a/sheep/components/s-goods-item/s-goods-item.vue b/sheep/components/s-goods-item/s-goods-item.vue index 456bb16..a29bd1a 100644 --- a/sheep/components/s-goods-item/s-goods-item.vue +++ b/sheep/components/s-goods-item/s-goods-item.vue @@ -28,6 +28,14 @@ > ¥{{ fen2yuan(price) }} + + + + + {{ point }} + x {{ num }} @@ -88,7 +96,7 @@ type: [String, Number], default: 0, }, - score: { + point: { type: [String, Number], default: '', }, @@ -113,7 +121,7 @@ diff --git a/sheep/components/s-point-card/s-point-card.vue b/sheep/components/s-point-card/s-point-card.vue new file mode 100644 index 0000000..c7380de --- /dev/null +++ b/sheep/components/s-point-card/s-point-card.vue @@ -0,0 +1,458 @@ + + + + diff --git a/sheep/components/s-select-seckill-sku/s-select-seckill-sku.vue b/sheep/components/s-select-seckill-sku/s-select-seckill-sku.vue index 99b28a5..dfaf875 100644 --- a/sheep/components/s-select-seckill-sku/s-select-seckill-sku.vue +++ b/sheep/components/s-select-seckill-sku/s-select-seckill-sku.vue @@ -19,8 +19,11 @@ {{ state.goodsInfo.name }} - - {{ fen2yuan(state.selectedSku.price || state.goodsInfo.price) }} + + {{ getShowPriceText }} + + + ¥{{ fen2yuan(state.selectedSku.price || state.goodsInfo.price) }} @@ -92,12 +95,15 @@ import { computed, reactive, watch } from 'vue'; import sheep from '@/sheep'; import { convertProductPropertyList, fen2yuan } from '@/sheep/hooks/useGoods'; - import { min } from 'lodash-es'; + import { isEmpty, min } from 'lodash-es'; + import { PromotionActivityTypeEnum } from '@/sheep/util/const'; + const emits = defineEmits(['change', 'addCart', 'buy', 'close']); const props = defineProps({ modelValue: { type: Object, - default() {}, + default() { + }, }, show: { type: Boolean, @@ -114,7 +120,14 @@ selectedSku: {}, currentPropertyArray: [], }); - + const getShowPriceText = computed(() => { + let priceText = `¥${fen2yuan(state.goodsInfo.price)}`; + if (!isEmpty(state.selectedSku)) { + const sku = state.selectedSku; + priceText = `${sku.point}积分${!sku.pointPrice ? '' : `+¥${fen2yuan(sku.pointPrice)}`}`; + } + return priceText; + }); const propertyList = convertProductPropertyList(state.goodsInfo.skus); // SKU 列表 const skuList = computed(() => { @@ -344,11 +357,6 @@ font-weight: 500; color: $red; font-family: OPPOSANS; - - &::before { - content: '¥'; - font-size: 24rpx; - } } .stock-text { diff --git a/sheep/components/s-select-sku/s-select-sku.vue b/sheep/components/s-select-sku/s-select-sku.vue index b339d4a..23b1b43 100644 --- a/sheep/components/s-select-sku/s-select-sku.vue +++ b/sheep/components/s-select-sku/s-select-sku.vue @@ -1,106 +1,139 @@ \ No newline at end of file + .disabled-btn { + font-weight: 400; + color: #c6c6c6; + background: #f8f8f8; + } + } + } + } + + .iconBox { + width: fit-content; + height: fit-content; + padding: 2rpx 10rpx; + background-color: rgb(255, 242, 241); + color: #ff2621; + font-size: 24rpx; + margin-left: 5rpx; + } + + .origin-price-text { + font-size: 26rpx; + font-weight: 400; + text-decoration: line-through; + color: $gray-c; + font-family: OPPOSANS; + + &::before { + content: '¥'; + } + } + diff --git a/sheep/hooks/useGoods.js b/sheep/hooks/useGoods.js index 5627447..9bab54b 100644 --- a/sheep/hooks/useGoods.js +++ b/sheep/hooks/useGoods.js @@ -11,7 +11,7 @@ import { formatDate } from '@/sheep/util'; */ export function formatSales(type, num) { let prefix = type !== 'exact' && num < 10 ? '销量' : '已售'; - return formatNum(prefix, type, num) + return formatNum(prefix, type, num); } /** @@ -21,10 +21,9 @@ export function formatSales(type, num) { * @return {string} 格式化后的销量字符串 */ export function formatExchange(type, num) { - return formatNum('已兑换', type, num) + return formatNum('已兑换', type, num); } - /** * 格式化库存 * @param {'exact' | any} type 格式类型:exact=精确值,其它=大致数量 @@ -32,7 +31,7 @@ export function formatExchange(type, num) { * @return {string} 格式化后的销量字符串 */ export function formatStock(type, num) { - return formatNum('库存', type, num) + return formatNum('库存', type, num); } /** @@ -43,7 +42,7 @@ export function formatStock(type, num) { * @return {string} 格式化后的销量字符串 */ export function formatNum(prefix, type, num) { - num = (num || 0); + num = num || 0; // 情况一:精确数值 if (type === 'exact') { return prefix + num; @@ -67,7 +66,7 @@ export function formatPrice(e) { } // 视频格式后缀列表 -const VIDEO_SUFFIX_LIST = ['.avi', '.mp4'] +const VIDEO_SUFFIX_LIST = ['.avi', '.mp4']; /** * 转换商品轮播的链接列表:根据链接的后缀,判断是视频链接还是图片链接 @@ -76,12 +75,19 @@ const VIDEO_SUFFIX_LIST = ['.avi', '.mp4'] * @return {{src: string, type: 'video' | 'image' }[]} 转换后的链接列表 */ export function formatGoodsSwiper(urlList) { - return urlList?.filter(url => url).map((url, key) => { - const isVideo = VIDEO_SUFFIX_LIST.some(suffix => url.includes(suffix)); - const type = isVideo ? 'video' : 'image' - const src = $url.cdn(url); - return { type, src } - }) || []; + return ( + urlList + ?.filter((url) => url) + .map((url, key) => { + const isVideo = VIDEO_SUFFIX_LIST.some((suffix) => url.includes(suffix)); + const type = isVideo ? 'video' : 'image'; + const src = $url.cdn(url); + return { + type, + src, + }; + }) || [] + ); } /** @@ -94,9 +100,7 @@ export function formatOrderColor(order) { if (order.status === 0) { return 'info-color'; } - if (order.status === 10 - || order.status === 20 - || (order.status === 30 && !order.commentStatus)) { + if (order.status === 10 || order.status === 20 || (order.status === 30 && !order.commentStatus)) { return 'warning-color'; } if (order.status === 30 && order.commentStatus) { @@ -139,7 +143,7 @@ export function formatOrderStatus(order) { */ export function formatOrderStatusDescription(order) { if (order.status === 0) { - return `请在 ${ formatDate(order.payExpireTime) } 前完成支付`; + return `请在 ${formatDate(order.payExpireTime)} 前完成支付`; } if (order.status === 10) { return '商家未发货,请耐心等待'; @@ -162,24 +166,30 @@ export function formatOrderStatusDescription(order) { * @param order 订单 */ export function handleOrderButtons(order) { - order.buttons = [] - if (order.type === 3) { // 查看拼团 + order.buttons = []; + if (order.type === 3) { + // 查看拼团 order.buttons.push('combination'); } - if (order.status === 20) { // 确认收货 + if (order.status === 20) { + // 确认收货 order.buttons.push('confirm'); } - if (order.logisticsId > 0) { // 查看物流 + if (order.logisticsId > 0) { + // 查看物流 order.buttons.push('express'); } - if (order.status === 0) { // 取消订单 / 发起支付 + if (order.status === 0) { + // 取消订单 / 发起支付 order.buttons.push('cancel'); order.buttons.push('pay'); } - if (order.status === 30 && !order.commentStatus) { // 发起评价 + if (order.status === 30 && !order.commentStatus) { + // 发起评价 order.buttons.push('comment'); } - if (order.status === 40) { // 删除订单 + if (order.status === 40) { + // 删除订单 order.buttons.push('delete'); } } @@ -257,10 +267,12 @@ export function formatAfterSaleStatusDescription(afterSale) { */ export function handleAfterSaleButtons(afterSale) { afterSale.buttons = []; - if ([10, 20, 30].includes(afterSale.status)) { // 取消订单 + if ([10, 20, 30].includes(afterSale.status)) { + // 取消订单 afterSale.buttons.push('cancel'); } - if (afterSale.status === 20) { // 退货信息 + if (afterSale.status === 20) { + // 退货信息 afterSale.buttons.push('delivery'); } } @@ -324,7 +336,28 @@ function getDayjsTime(time) { * @returns {string} 元,例如说 1.00 元 */ export function fen2yuan(price) { - return (price / 100.0).toFixed(2) + return (price / 100.0).toFixed(2); +} + +/** + * 将分转成元 + * + * 如果没有小数点,则不展示小数点部分 + * + * @param price 分,例如说 100 分 + * @returns {string} 元,例如说 1 元 + */ +export function fen2yuanSimple(price) { + return fen2yuan(price).replace(/\.?0+$/, ''); +} + +/** + * 将折扣百分比转化为“打x者”的 x 部分 + * + * @param discountPercent + */ +export function formatDiscountPercent(discountPercent) { + return (discountPercent / 10.0).toFixed(1).replace(/\.?0+$/, ''); } /** @@ -345,45 +378,122 @@ export function convertProductPropertyList(skus) { let result = []; for (const sku of skus) { if (!sku.properties) { - continue + continue; } for (const property of sku.properties) { // ① 先处理属性 - let resultProperty = result.find(item => item.id === property.propertyId) + let resultProperty = result.find((item) => item.id === property.propertyId); if (!resultProperty) { resultProperty = { id: property.propertyId, name: property.propertyName, - values: [] - } - result.push(resultProperty) + values: [], + }; + result.push(resultProperty); } // ② 再处理属性值 - let resultValue = resultProperty.values.find(item => item.id === property.valueId) + let resultValue = resultProperty.values.find((item) => item.id === property.valueId); if (!resultValue) { resultProperty.values.push({ id: property.valueId, - name: property.valueName - }) + name: property.valueName, + }); } } } return result; } -/** - * 格式化满减送活动的规则 - * - * @param activity 活动信息 - * @param rule 优惠规格 - * @returns {string} 规格字符串 - */ -export function formatRewardActivityRule(activity, rule) { - if (activity.conditionType === 10) { - return `满 ${fen2yuan(rule.limit)} 元减 ${fen2yuan(rule.discountPrice)} 元`; +export function appendSettlementProduct(spus, settlementInfos) { + if (!settlementInfos || settlementInfos.length === 0) { + return; } - if (activity.conditionType === 20) { - return `满 ${rule.limit} 件减 ${fen2yuan(rule.discountPrice)} 元`; + for (const spu of spus) { + const settlementInfo = settlementInfos.find((info) => info.spuId === spu.id); + if (!settlementInfo) { + return; + } + // 选择价格最小的 SKU 设置到 SPU 上 + const settlementSku = settlementInfo.skus + .filter((sku) => sku.promotionPrice > 0) + .reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr)); + if (settlementSku) { + spu.promotionType = settlementSku.promotionType; + spu.promotionPrice = settlementSku.promotionPrice; + } + // 设置【满减送】活动 + if (settlementInfo.rewardActivity) { + spu.rewardActivity = settlementInfo.rewardActivity; + } } - return ''; +} + +// 获得满减送活动的规则描述(group) +export function getRewardActivityRuleGroupDescriptions(activity) { + if (!activity || !activity.rules || activity.rules.length === 0) { + return []; + } + const result = [ + { name: '满减', values: [] }, + { name: '赠品', values: [] }, + { name: '包邮', values: [] }, + ]; + activity.rules.forEach((rule) => { + const conditionTypeStr = + activity.conditionType === 10 ? `满 ${fen2yuanSimple(rule.limit)} 元` : `满 ${rule.limit} 件`; + // 满减 + if (rule.limit) { + result[0].values.push(`${conditionTypeStr} 减 ${fen2yuanSimple(rule.discountPrice)} 元`); + } + // 赠品 + if (rule.point || (rule.giveCouponTemplateCounts && rule.giveCouponTemplateCounts.length > 0)) { + let tips = []; + if (rule.point) { + tips.push(`送 ${rule.point} 积分`); + } + if (rule.giveCouponTemplateCounts && rule.giveCouponTemplateCounts.length > 0) { + tips.push(`送 ${rule.giveCouponTemplateCounts.length} 张优惠券`); + } + result[1].values.push(`${conditionTypeStr} ${tips.join('、')}`); + } + // 包邮 + if (rule.freeDelivery) { + result[2].values.push(`${conditionTypeStr} 包邮`); + } + }); + // 移除 values 为空的元素 + result.forEach((item) => { + if (item.values.length === 0) { + result.splice(result.indexOf(item), 1); + } + }); + return result; +} + +// 获得满减送活动的规则描述(item) +export function getRewardActivityRuleItemDescriptions(activity) { + if (!activity || !activity.rules || activity.rules.length === 0) { + return []; + } + const result = []; + activity.rules.forEach((rule) => { + const conditionTypeStr = + activity.conditionType === 10 ? `满${fen2yuanSimple(rule.limit)}元` : `满${rule.limit}件`; + // 满减 + if (rule.limit) { + result.push(`${conditionTypeStr}减${fen2yuanSimple(rule.discountPrice)}元`); + } + // 赠品 + if (rule.point) { + result.push(`${conditionTypeStr}送${rule.point}积分`); + } + if (rule.giveCouponTemplateCounts && rule.giveCouponTemplateCounts.length > 0) { + result.push(`${conditionTypeStr}送${rule.giveCouponTemplateCounts.length}张优惠券`); + } + // 包邮 + if (rule.freeDelivery) { + result.push(`${conditionTypeStr}包邮`); + } + }); + return result; } diff --git a/sheep/platform/pay.js b/sheep/platform/pay.js index 89e70d4..ced3aa0 100644 --- a/sheep/platform/pay.js +++ b/sheep/platform/pay.js @@ -35,7 +35,7 @@ export default class SheepPay { }, mock: () => { this.mockPay(); - } + }, }, WechatMiniProgram: { wechat: () => { @@ -49,7 +49,7 @@ export default class SheepPay { }, mock: () => { this.mockPay(); - } + }, }, App: { wechat: () => { @@ -63,7 +63,7 @@ export default class SheepPay { }, mock: () => { this.mockPay(); - } + }, }, H5: { wechat: () => { @@ -77,7 +77,7 @@ export default class SheepPay { }, mock: () => { this.mockPay(); - } + }, }, }; return payAction[sheep.$platform.name][this.payment](); @@ -89,7 +89,7 @@ export default class SheepPay { let data = { id: this.id, channelCode: channel, - channelExtras: {} + channelExtras: {}, }; // 特殊逻辑:微信公众号、小程序支付时,必须传入 openid if (['wx_pub', 'wx_lite'].includes(channel)) { @@ -108,8 +108,11 @@ export default class SheepPay { // 失败时 if (res.code !== 0 && res.msg.indexOf('无效的openid') >= 0) { // 特殊逻辑:微信公众号、小程序支付时,必须传入 openid 不正确的情况 - if (res.msg.indexOf('无效的openid') >= 0 // 获取的 openid 不正确时,或者随便输入了个 openid - || res.msg.indexOf('下单账号与支付账号不一致') >= 0) { // https://developers.weixin.qq.com/community/develop/doc/00008c53c347804beec82aed051c00 + if ( + res.msg.indexOf('无效的openid') >= 0 || // 获取的 openid 不正确时,或者随便输入了个 openid + res.msg.indexOf('下单账号与支付账号不一致') >= 0 + ) { + // https://developers.weixin.qq.com/community/develop/doc/00008c53c347804beec82aed051c00 this.bindWeixin(); } } @@ -133,30 +136,34 @@ export default class SheepPay { }, fail: (error) => { if (error.errMsg.indexOf('chooseWXPay:没有此SDK或暂不支持此SDK模拟') >= 0) { - sheep.$helper.toast('发起微信支付失败,原因:可能是微信开发者工具不支持,建议使用微信打开网页后支付'); - return + sheep.$helper.toast( + '发起微信支付失败,原因:可能是微信开发者工具不支持,建议使用微信打开网页后支付', + ); + return; } this.payResult('fail'); }, }); } - // 浏览器微信 H5 支付 TODO 芋艿:待接入 + // 浏览器微信 H5 支付 TODO 芋艿:待接入(注意:H5 支付是给普通浏览器,不是微信公众号的支付,绝大多数人用不到,可以忽略) async wechatWapPay() { const { error, data } = await this.prepay(); if (error === 0) { - const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${this.payment}&orderType=${this.orderType}`; + const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${ + this.payment + }&orderType=${this.orderType}`; location.href = `${data.pay_data.h5_url}&redirect_url=${encodeURIComponent(redirect_url)}`; } } - // 支付链接 TODO 芋艿:待接入 + // 支付链接(支付宝 wap 支付) async redirectPay() { - let { error, data } = await this.prepay(); - if (error === 0) { - const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${this.payment}&orderType=${this.orderType}`; - location.href = data.pay_data + encodeURIComponent(redirect_url); + let { code, data } = await this.prepay('alipay_wap'); + if (code !== 0) { + return; } + location.href = data.displayContent; } // #endif @@ -202,26 +209,26 @@ export default class SheepPay { code === 0 && this.payResult('success'); } - // 支付宝复制链接支付 TODO 芋艿:待接入 + // 支付宝复制链接支付(通过支付宝 wap 支付实现) async copyPayLink() { - let that = this; - let { error, data } = await this.prepay(); - if (error === 0) { - // 引入showModal 点击确认 复制链接; - uni.showModal({ - title: '支付宝支付', - content: '复制链接到外部浏览器', - confirmText: '复制链接', - success: (res) => { - if (res.confirm) { - sheep.$helper.copyText(data.pay_data); - } - }, - }); + let { code, data } = await this.prepay('alipay_wap'); + if (code !== 0) { + return; } + // 引入 showModal 点击确认:复制链接; + uni.showModal({ + title: '支付宝支付', + content: '复制链接到外部浏览器', + confirmText: '复制链接', + success: (res) => { + if (res.confirm) { + sheep.$helper.copyText(data.displayContent); + } + }, + }); } - // 支付宝支付 TODO 芋艿:待接入 + // 支付宝支付(App) TODO 芋艿:待接入【暂时没打包 app,所以没接入,一般人用不到】 async alipay() { let that = this; const { error, data } = await this.prepay(); @@ -243,7 +250,7 @@ export default class SheepPay { } } - // 微信支付 TODO 芋艿:待接入 + // 微信支付(App) TODO 芋艿:待接入:待接入【暂时没打包 app,所以没接入,一般人用不到】 async wechatAppPay() { let that = this; let { error, data } = await this.prepay(); @@ -263,11 +270,7 @@ export default class SheepPay { // 支付结果跳转,success:成功,fail:失败 payResult(resultType) { - sheep.$router.redirect('/pages/pay/result', { - id: this.id, - orderType: this.orderType, - payState: resultType - }); + goPayResult(this.id, this.orderType, resultType); } // 引导绑定微信 @@ -282,7 +285,6 @@ export default class SheepPay { }, }); } - } export function getPayMethods(channels) { @@ -316,23 +318,28 @@ export function getPayMethods(channels) { title: '模拟支付', value: 'mock', disabled: true, - } + }, ]; - const platform = sheep.$platform.name + const platform = sheep.$platform.name; // 1. 处理【微信支付】 const wechatMethod = payMethods[0]; - if ((platform === 'WechatOfficialAccount' && channels.includes('wx_pub')) - || (platform === 'WechatMiniProgram' && channels.includes('wx_lite')) - || (platform === 'App' && channels.includes('wx_app'))) { + if ( + (platform === 'WechatOfficialAccount' && channels.includes('wx_pub')) || + (platform === 'WechatMiniProgram' && channels.includes('wx_lite')) || + (platform === 'App' && channels.includes('wx_app')) + ) { wechatMethod.disabled = false; } // 2. 处理【支付宝支付】 const alipayMethod = payMethods[1]; - if ((platform === 'WechatOfficialAccount' && channels.includes('alipay_wap')) - || platform === 'WechatMiniProgram' && channels.includes('alipay_wap') - || platform === 'App' && channels.includes('alipay_app')) { + if ( + (platform === 'H5' && channels.includes('alipay_wap')) || + (platform === 'WechatOfficialAccount' && channels.includes('alipay_wap')) || + (platform === 'WechatMiniProgram' && channels.includes('alipay_wap')) || + (platform === 'App' && channels.includes('alipay_app')) + ) { alipayMethod.disabled = false; } // 3. 处理【余额支付】 @@ -347,4 +354,13 @@ export function getPayMethods(channels) { mockMethod.disabled = false; } return payMethods; -} \ No newline at end of file +} + +// 支付结果跳转,success:成功,fail:失败 +export function goPayResult(id, orderType, resultType) { + sheep.$router.redirect('/pages/pay/result', { + id, + orderType, + payState: resultType, + }); +} diff --git a/sheep/util/const.js b/sheep/util/const.js index 9cf98bf..ec6078d 100644 --- a/sheep/util/const.js +++ b/sheep/util/const.js @@ -33,78 +33,100 @@ export const getTerminal = () => { // ========== MALL - 营销模块 ========== -import dayjs from "dayjs"; +import dayjs from 'dayjs'; /** * 优惠类型枚举 */ export const PromotionDiscountTypeEnum = { - PRICE: { - type: 1, - name: '满减' - }, - PERCENT: { - type: 2, - name: '折扣' - } -} + PRICE: { + type: 1, + name: '满减', + }, + PERCENT: { + type: 2, + name: '折扣', + }, +}; /** * 优惠劵模板的有限期类型的枚举 */ export const CouponTemplateValidityTypeEnum = { - DATE: { - type: 1, - name: '固定日期可用' - }, - TERM: { - type: 2, - name: '领取之后可用' - } -} + DATE: { + type: 1, + name: '固定日期可用', + }, + TERM: { + type: 2, + name: '领取之后可用', + }, +}; /** * 营销的商品范围枚举 */ export const PromotionProductScopeEnum = { - ALL: { - scope: 1, - name: '通用劵' - }, - SPU: { - scope: 2, - name: '商品劵' - }, - CATEGORY: { - scope: 3, - name: '品类劵' - } -} + ALL: { + scope: 1, + name: '通用劵', + }, + SPU: { + scope: 2, + name: '商品劵', + }, + CATEGORY: { + scope: 3, + name: '品类劵', + }, +}; // 时间段的状态枚举 export const TimeStatusEnum = { - WAIT_START: '即将开始', - STARTED: '进行中', - END: '已结束', -} + WAIT_START: '即将开始', + STARTED: '进行中', + END: '已结束', +}; /** * 微信小程序的订阅模版 */ export const WxaSubscribeTemplate = { - TRADE_ORDER_DELIVERY: "订单发货通知", - PROMOTION_COMBINATION_SUCCESS: "拼团结果通知", - PAY_WALLET_RECHARGER_SUCCESS: "充值成功通知", -} + TRADE_ORDER_DELIVERY: '订单发货通知', + PROMOTION_COMBINATION_SUCCESS: '拼团结果通知', + PAY_WALLET_RECHARGER_SUCCESS: '充值成功通知', +}; +export const PromotionActivityTypeEnum = { + NORMAL: { + type: 0, + name: '普通', + }, + SECKILL: { + type: 1, + name: '秒杀', + }, + BARGAIN: { + type: 2, + name: '砍价', + }, + COMBINATION: { + type: 3, + name: '拼团', + }, + POINT: { + type: 4, + name: '积分商城', + }, +}; export const getTimeStatusEnum = (startTime, endTime) => { - const now = dayjs(); - if (now.isBefore(startTime)) { - return TimeStatusEnum.WAIT_START; - } else if (now.isAfter(endTime)) { - return TimeStatusEnum.END; - } else { - return TimeStatusEnum.STARTED; - } -} + const now = dayjs(); + if (now.isBefore(startTime)) { + return TimeStatusEnum.WAIT_START; + } else if (now.isAfter(endTime)) { + return TimeStatusEnum.END; + } else { + return TimeStatusEnum.STARTED; + } +};