!79 完善拼团的剩余 TODO

Merge pull request !79 from puhui999/master
pull/78/MERGE
芋道源码 2024-08-14 16:12:22 +00:00 committed by Gitee
commit ed7258b577
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 255 additions and 259 deletions

View File

@ -1,36 +1,36 @@
{ {
"name": "芋道商城", "name" : "芋道商城",
"appid": "__UNI__460BC4C", "appid" : "__UNI__460BC4C",
"description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。", "description" : "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。",
"versionName": "2.1.0", "versionName" : "2.1.0",
"versionCode": 183, "versionCode" : 183,
"transformPx": false, "transformPx" : false,
"app-plus": { "app-plus" : {
"usingComponents": true, "usingComponents" : true,
"nvueCompiler": "uni-app", "nvueCompiler" : "uni-app",
"nvueStyleCompiler": "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion": 3, "compilerVersion" : 3,
"nvueLaunchMode": "fast", "nvueLaunchMode" : "fast",
"splashscreen": { "splashscreen" : {
"alwaysShowBeforeRender": true, "alwaysShowBeforeRender" : true,
"waiting": true, "waiting" : true,
"autoclose": true, "autoclose" : true,
"delay": 0 "delay" : 0
}, },
"safearea": { "safearea" : {
"bottom": { "bottom" : {
"offset": "none" "offset" : "none"
} }
}, },
"modules": { "modules" : {
"Payment": {}, "Payment" : {},
"Share": {}, "Share" : {},
"VideoPlayer": {}, "VideoPlayer" : {},
"OAuth": {} "OAuth" : {}
}, },
"distribute": { "distribute" : {
"android": { "android" : {
"permissions": [ "permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
@ -64,176 +64,161 @@
"<uses-permission android:name=\"android.permission.WRITE_SMS\"/>", "<uses-permission android:name=\"android.permission.WRITE_SMS\"/>",
"<uses-permission android:name=\"android.permission.RECEIVE_USER_PRESENT\"/>" "<uses-permission android:name=\"android.permission.RECEIVE_USER_PRESENT\"/>"
], ],
"minSdkVersion": 21, "minSdkVersion" : 21,
"schemes": "shopro" "schemes" : "shopro"
}, },
"ios": { "ios" : {
"urlschemewhitelist": [ "urlschemewhitelist" : [ "baidumap", "iosamap" ],
"baidumap", "dSYMs" : false,
"iosamap" "privacyDescription" : {
], "NSPhotoLibraryUsageDescription" : "需要同意访问您的相册选取图片才能完善该条目",
"dSYMs": false, "NSPhotoLibraryAddUsageDescription" : "需要同意访问您的相册才能保存该图片",
"privacyDescription": { "NSCameraUsageDescription" : "需要同意访问您的摄像头拍摄照片才能完善该条目",
"NSPhotoLibraryUsageDescription": "需要同意访问您的相册选取图片才能完善该条目", "NSUserTrackingUsageDescription" : "开启追踪并不会获取您在其它站点的隐私信息,该行为仅用于标识设备,保障服务安全和提升浏览体验"
"NSPhotoLibraryAddUsageDescription": "需要同意访问您的相册才能保存该图片",
"NSCameraUsageDescription": "需要同意访问您的摄像头拍摄照片才能完善该条目",
"NSUserTrackingUsageDescription": "开启追踪并不会获取您在其它站点的隐私信息,该行为仅用于标识设备,保障服务安全和提升浏览体验"
}, },
"urltypes": "shopro", "urltypes" : "shopro",
"capabilities": { "capabilities" : {
"entitlements": { "entitlements" : {
"com.apple.developer.associated-domains": [ "com.apple.developer.associated-domains" : [ "applinks:shopro.sheepjs.com" ]
"applinks:shopro.sheepjs.com"
]
} }
}, },
"idfa": true "idfa" : true
}, },
"sdkConfigs": { "sdkConfigs" : {
"speech": { "speech" : {
"ifly": {} "ifly" : {}
}, },
"ad": {}, "ad" : {},
"oauth": { "oauth" : {
"apple": {}, "apple" : {},
"weixin": { "weixin" : {
"appid": "wxae7a0c156da9383b", "appid" : "wxae7a0c156da9383b",
"UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" "UniversalLinks" : "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
} }
}, },
"payment": { "payment" : {
"weixin": { "weixin" : {
"__platform__": [ "__platform__" : [ "ios", "android" ],
"ios", "appid" : "wxae7a0c156da9383b",
"android" "UniversalLinks" : "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
],
"appid": "wxae7a0c156da9383b",
"UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
}, },
"alipay": { "alipay" : {
"__platform__": [ "__platform__" : [ "ios", "android" ]
"ios",
"android"
]
} }
}, },
"share": { "share" : {
"weixin": { "weixin" : {
"appid": "wxae7a0c156da9383b", "appid" : "wxae7a0c156da9383b",
"UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" "UniversalLinks" : "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
} }
} }
}, },
"orientation": [ "orientation" : [ "portrait-primary" ],
"portrait-primary" "splashscreen" : {
], "androidStyle" : "common",
"splashscreen": { "iosStyle" : "common",
"androidStyle": "common", "useOriginalMsgbox" : true
"iosStyle": "common",
"useOriginalMsgbox": true
}, },
"icons": { "icons" : {
"android": { "android" : {
"hdpi": "unpackage/res/icons/72x72.png", "hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png", "xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png", "xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png" "xxxhdpi" : "unpackage/res/icons/192x192.png"
}, },
"ios": { "ios" : {
"appstore": "unpackage/res/icons/1024x1024.png", "appstore" : "unpackage/res/icons/1024x1024.png",
"ipad": { "ipad" : {
"app": "unpackage/res/icons/76x76.png", "app" : "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png", "app@2x" : "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png", "notification" : "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png", "proapp@2x" : "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png", "settings" : "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png", "spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png" "spotlight@2x" : "unpackage/res/icons/80x80.png"
}, },
"iphone": { "iphone" : {
"app@2x": "unpackage/res/icons/120x120.png", "app@2x" : "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png", "app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png", "notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png", "settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png", "spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png" "spotlight@3x" : "unpackage/res/icons/120x120.png"
} }
} }
} }
} }
}, },
"quickapp": {}, "quickapp" : {},
"quickapp-native": { "quickapp-native" : {
"icon": "/static/logo.png", "icon" : "/static/logo.png",
"package": "com.example.demo", "package" : "com.example.demo",
"features": [ "features" : [
{ {
"name": "system.clipboard" "name" : "system.clipboard"
} }
] ]
}, },
"quickapp-webview": { "quickapp-webview" : {
"icon": "/static/logo.png", "icon" : "/static/logo.png",
"package": "com.example.demo", "package" : "com.example.demo",
"minPlatformVersion": 1070, "minPlatformVersion" : 1070,
"versionName": "1.0.0", "versionName" : "1.0.0",
"versionCode": 100 "versionCode" : 100
}, },
"mp-weixin": { "mp-weixin" : {
"appid": "wx66186af0759f47c9", "appid" : "wx66186af0759f47c9",
"setting": { "setting" : {
"urlCheck": false, "urlCheck" : false,
"minified": true, "minified" : true,
"postcss": true "postcss" : true
}, },
"optimization": { "optimization" : {
"subPackages": true "subPackages" : true
}, },
"plugins": {}, "plugins" : {},
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading" : "requiredComponents",
"usingComponents": {}, "usingComponents" : {},
"permission": {}, "permission" : {},
"requiredPrivateInfos": [ "requiredPrivateInfos" : [ "chooseAddress" ]
"chooseAddress"
]
}, },
"mp-alipay": { "mp-alipay" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-baidu": { "mp-baidu" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-toutiao": { "mp-toutiao" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-jd": { "mp-jd" : {
"usingComponents": true "usingComponents" : true
}, },
"h5": { "h5" : {
"template": "index.html", "template" : "index.html",
"router": { "router" : {
"mode": "hash", "mode" : "history",
"base": "./" "base" : "./"
}, },
"sdkConfigs": { "sdkConfigs" : {
"maps": {} "maps" : {}
}, },
"async": { "async" : {
"timeout": 20000 "timeout" : 20000
}, },
"title": "芋道商城", "title" : "芋道商城",
"optimization": { "optimization" : {
"treeShaking": { "treeShaking" : {
"enable": true "enable" : true
} }
} }
}, },
"vueVersion": "3", "vueVersion" : "3",
"_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639", "_spaceID" : "192b4892-5452-4e1d-9f09-eee1ece40639",
"locale": "zh-Hans", "locale" : "zh-Hans",
"fallbackLocale": "zh-Hans" "fallbackLocale" : "zh-Hans"
} }

View File

@ -181,11 +181,11 @@
</view> </view>
</view> </view>
<!-- TODO 芋艿这里暂时没接入 --> <view v-if="!isEmpty(state.goodsInfo)">
<view v-if="state.data.goods"> <!-- 规格与数量弹框 -->
<s-select-groupon-sku <s-select-groupon-sku
:show="state.showSelectSku" :show="state.showSelectSku"
:goodsInfo="state.data.goods" :goodsInfo="state.goodsInfo"
:grouponAction="state.grouponAction" :grouponAction="state.grouponAction"
:grouponNum="state.grouponNum" :grouponNum="state.grouponNum"
@buy="onBuy" @buy="onBuy"
@ -193,6 +193,7 @@
@close="state.showSelectSku = false" @close="state.showSelectSku = false"
/> />
</view> </view>
</view> </view>
<s-empty v-if="!state.data && !state.loading" icon="/static/goods-empty.png" /> <s-empty v-if="!state.data && !state.loading" icon="/static/goods-empty.png" />
@ -203,25 +204,28 @@
import { computed, reactive } from 'vue'; import { computed, reactive } from 'vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { useDurationTime } from '@/sheep/hooks/useGoods'; import { fen2yuan, useDurationTime } from '@/sheep/hooks/useGoods';
import { showShareModal } from '@/sheep/hooks/useModal'; import { showShareModal } from '@/sheep/hooks/useModal';
import { isEmpty } from 'lodash-es'; import { isEmpty } from 'lodash-es';
import CombinationApi from '@/sheep/api/promotion/combination'; import CombinationApi from '@/sheep/api/promotion/combination';
import SpuApi from '@/sheep/api/product/spu';
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png'); const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2; const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const state = reactive({ const state = reactive({
data: {}, // data: {}, //
loading: true, goodsId: 0, // ID
grouponAction: 'create', goodsInfo: {}, //
showSelectSku: false, showSelectSku: false, //
grouponNum: 0, selectedSkuPrice: {}, //
number: 0, activity: {}, //
activity: {}, grouponId: 0, // ID
grouponNum: 0, //
grouponAction: 'create', //
combinationHeadId: null, // combinationHeadId: null, //
loading: true,
}); });
// todo
const shareInfo = computed(() => { const shareInfo = computed(() => {
if (isEmpty(state.data)) return {}; if (isEmpty(state.data)) return {};
return sheep.$platform.share.getShareInfo( return sheep.$platform.share.getShareInfo(
@ -231,15 +235,14 @@
desc: state.data.goods?.subtitle, desc: state.data.goods?.subtitle,
params: { params: {
page: '5', page: '5',
query: state.data.id, query: state.data.headRecord.id,
}, },
}, },
{ {
type: 'groupon', // type: 'groupon', //
title: state.data.headRecord.spuName, // title: state.data.headRecord.spuName, //
image: sheep.$url.cdn(state.data.headRecord.picUrl), // image: sheep.$url.cdn(state.data.headRecord.picUrl), //
price: state.data.goods?.price, // price: fen2yuan(state.data.headRecord.combinationPrice), //
original_price: state.data.goods?.original_price, //
}, },
); );
}); });
@ -251,33 +254,33 @@
}); });
} }
// TODO //
function onCreateGroupon() { function onCreateGroupon() {
state.grouponAction = 'create'; state.grouponAction = 'create';
state.grouponId = 0; state.grouponId = 0;
state.showSelectSku = true; state.showSelectSku = true;
} }
// TODO //
function onSkuChange(e) { function onSkuChange(e) {
state.selectedSkuPrice = e; state.selectedSkuPrice = e;
} }
// TODO //
function onJoinGroupon() { function onJoinGroupon() {
state.grouponAction = 'join'; state.grouponAction = 'join';
state.grouponId = state.data.activityId; state.grouponId = state.data.headRecord.activityId;
state.combinationHeadId = state.data.id; state.combinationHeadId = state.data.headRecord.id;
state.grouponNum = state.data.num; state.grouponNum = state.data.headRecord.userSize;
state.showSelectSku = true; state.showSelectSku = true;
} }
// TODO //
function onBuy(sku) { function onBuy(sku) {
sheep.$router.go('/pages/order/confirm', { sheep.$router.go('/pages/order/confirm', {
data: JSON.stringify({ data: JSON.stringify({
order_type: 'goods', order_type: 'goods',
combinationActivityId: state.data.activity.id, combinationActivityId: state.activity.id,
combinationHeadId: state.combinationHeadId, combinationHeadId: state.combinationHeadId,
items: [ items: [
{ {
@ -306,6 +309,14 @@
data.headRecord.activityId, data.headRecord.activityId,
); );
state.activity = activity; state.activity = activity;
state.grouponNum = activity.userSize;
//
const { data: spu } = await SpuApi.getSpuDetail(activity.spuId);
state.goodsId = spu.id;
activity.products.forEach((product) => {
spu.price = Math.min(spu.price, product.combinationPrice); // SPU
});
state.goodsInfo = spu;
} else { } else {
state.data = null; state.data = null;
} }

View File

@ -66,7 +66,7 @@
css: { css: {
// //
width: sheep.$platform.device.windowWidth * 0.9, width: sheep.$platform.device.windowWidth * 0.9,
height: 550, height: 600,
}, },
views: [], views: [],
}); });

View File

@ -82,12 +82,12 @@ const groupon = async (poster) => {
type: 'text', type: 'text',
text: '2人团', text: '2人团',
css: { css: {
color: '#ff0000', color: '#fff',
fontSize: 30, fontSize: 12,
fontFamily: 'OPPOSANS', fontFamily: 'OPPOSANS',
position: 'fixed', position: 'fixed',
left: width * 0.3, left: width * 0.84,
top: width * 1.32, top: width * 1.3,
}, },
}, },
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
@ -96,7 +96,7 @@ const groupon = async (poster) => {
text: poster.shareInfo.link, text: poster.shareInfo.link,
css: { css: {
position: 'fixed', position: 'fixed',
left: width * 0.75, left: width * 0.5,
top: width * 1.3, top: width * 1.3,
width: width * 0.2, width: width * 0.2,
height: width * 0.2, height: width * 0.2,