Compare commits
35 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
b6b0ca3dbd | |
|
|
0d0017eac7 | |
|
|
5c2377b482 | |
|
|
1346f8bf3b | |
|
|
d18d67dd62 | |
|
|
f2bfb2d79b | |
|
|
3c3ee616fd | |
|
|
beca206592 | |
|
|
becfc58eca | |
|
|
d2f29362a0 | |
|
|
a5aae8480b | |
|
|
1d2e9bcdb5 | |
|
|
1cadcaac5e | |
|
|
18802f863c | |
|
|
a6a5117b0c | |
|
|
aa83e4aa51 | |
|
|
ecf74aa8f8 | |
|
|
f95432918c | |
|
|
ee25d77d58 | |
|
|
5724bc61b0 | |
|
|
8e6ed9d63b | |
|
|
9896f776d3 | |
|
|
e6e24f9935 | |
|
|
9c509c6f15 | |
|
|
44eec40775 | |
|
|
9c1fddb7b7 | |
|
|
7a3be392d6 | |
|
|
50549b8064 | |
|
|
adf8e0c004 | |
|
|
59c34db03f | |
|
|
32c0b6a490 | |
|
|
ee07df3c7b | |
|
|
ea38216ce7 | |
|
|
3280fee02a | |
|
|
d78afe311c |
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "芋道商城",
|
"name": "芋道商城",
|
||||||
"appid": "__UNI__460BC4C",
|
"appid": "__UNI__460BC4C",
|
||||||
"description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。",
|
"description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。",
|
||||||
"versionName": "2025.10",
|
"versionName": "2026.03",
|
||||||
"versionCode": "183",
|
"versionCode": "183",
|
||||||
"transformPx": false,
|
"transformPx": false,
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
|
|
@ -185,7 +185,9 @@
|
||||||
"requiredPrivateInfos": ["chooseAddress"]
|
"requiredPrivateInfos": ["chooseAddress"]
|
||||||
},
|
},
|
||||||
"mp-alipay": {
|
"mp-alipay": {
|
||||||
"usingComponents": true
|
"usingComponents": true,
|
||||||
|
"styleIsolation": "shared",
|
||||||
|
"mergeVirtualHostAttributes": true
|
||||||
},
|
},
|
||||||
"mp-baidu": {
|
"mp-baidu": {
|
||||||
"usingComponents": true
|
"usingComponents": true
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"format": 2,
|
||||||
|
"compileOptions": {
|
||||||
|
"component2": true,
|
||||||
|
"enableNodeModuleBabelTransform": true,
|
||||||
|
"transpile": {},
|
||||||
|
"globalObjectMode": "enable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "shopro",
|
"id": "shopro",
|
||||||
"name": "shopro",
|
"name": "shopro",
|
||||||
"displayName": "芋道商城",
|
"displayName": "芋道商城",
|
||||||
"version": "2025.10",
|
"version": "2026.03",
|
||||||
"description": "芋道商城,一套代码,同时发行到iOS、Android、H5、微信小程序多个平台,请使用手机扫码快速体验强大功能",
|
"description": "芋道商城,一套代码,同时发行到iOS、Android、H5、微信小程序多个平台,请使用手机扫码快速体验强大功能",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
|
"prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
|
||||||
|
|
|
||||||
10
pages.json
10
pages.json
|
|
@ -675,7 +675,15 @@
|
||||||
"navigationBarTitleText": "芋道商城",
|
"navigationBarTitleText": "芋道商城",
|
||||||
"navigationBarBackgroundColor": "#FFFFFF",
|
"navigationBarBackgroundColor": "#FFFFFF",
|
||||||
"backgroundColor": "#FFFFFF",
|
"backgroundColor": "#FFFFFF",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom",
|
||||||
|
"mp-alipay": {
|
||||||
|
"titleImage": "",
|
||||||
|
"gestureBack": "YES",
|
||||||
|
"allowsBounceVertical": "NO",
|
||||||
|
"transparentTitle": "always",
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"titlePenetrate": "YES"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"list": [{
|
"list": [{
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import { formatOrderColor } from '@/sheep/hooks/useGoods';
|
import { formatOrderColor } from '@/sheep/hooks/useGoods';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { resetPagination } from '@/sheep/helper/utils';
|
||||||
import CombinationApi from '@/sheep/api/promotion/combination';
|
import CombinationApi from '@/sheep/api/promotion/combination';
|
||||||
|
|
@ -121,7 +121,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import RewardActivityApi from '@/sheep/api/promotion/rewardActivity';
|
import RewardActivityApi from '@/sheep/api/promotion/rewardActivity';
|
||||||
import SpuApi from '@/sheep/api/product/spu';
|
import SpuApi from '@/sheep/api/product/spu';
|
||||||
import { appendSettlementProduct } from '@/sheep/hooks/useGoods';
|
import { appendSettlementProduct } from '@/sheep/hooks/useGoods';
|
||||||
|
|
@ -131,7 +131,7 @@
|
||||||
}
|
}
|
||||||
appendSettlementProduct(data.list, res.data);
|
appendSettlementProduct(data.list, res.data);
|
||||||
});
|
});
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
mountMasonry();
|
mountMasonry();
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, watch } from 'vue';
|
import { reactive, watch } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import GoodsItem from './goods.vue';
|
import GoodsItem from './goods.vue';
|
||||||
import OrderItem from './order.vue';
|
import OrderItem from './order.vue';
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
page,
|
page,
|
||||||
list_rows,
|
list_rows,
|
||||||
});
|
});
|
||||||
let orderList = _.concat(state.pagination.data, res.data.list);
|
let orderList = concat(state.pagination.data, res.data.list);
|
||||||
state.pagination = {
|
state.pagination = {
|
||||||
...res.data,
|
...res.data,
|
||||||
data: orderList,
|
data: orderList,
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import { resetPagination, getWeekTimes, getMonthTimes } from '@/sheep/helper/utils';
|
import { resetPagination, getWeekTimes, getMonthTimes } from '@/sheep/helper/utils';
|
||||||
|
|
||||||
const tabMaps = ['周排行', '月排行'];
|
const tabMaps = ['周排行', '月排行'];
|
||||||
|
|
@ -93,7 +93,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
if (state.pagination.pageNo === 1) {
|
if (state.pagination.pageNo === 1) {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
import { fen2yuan } from '../../../sheep/hooks/useGoods';
|
import { fen2yuan } from '../../../sheep/hooks/useGoods';
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
import $share from '@/sheep/platform/share';
|
import $share from '@/sheep/platform/share';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import { showShareModal } from '@/sheep/hooks/useModal';
|
import { showShareModal } from '@/sheep/hooks/useModal';
|
||||||
import SpuApi from '@/sheep/api/product/spu';
|
import SpuApi from '@/sheep/api/product/spu';
|
||||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
// 在所有请求完成后合并列表和更新状态
|
// 在所有请求完成后合并列表和更新状态
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad, onPageScroll, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onPageScroll, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { resetPagination } from '@/sheep/helper/utils';
|
||||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
||||||
|
|
@ -139,7 +139,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
if (state.currentTab === 0) {
|
if (state.currentTab === 0) {
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
import { resetPagination, getWeekTimes, getMonthTimes } from '@/sheep/helper/utils';
|
import { resetPagination, getWeekTimes, getMonthTimes } from '@/sheep/helper/utils';
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@
|
||||||
<text class="num font-color">{{ item.brokerageUserCount || 0 }} </text>人
|
<text class="num font-color">{{ item.brokerageUserCount || 0 }} </text>人
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<text class="num">{{ item.orderCount || 0 }}</text
|
<text class="num">{{ item.brokerageOrderCount || 0 }}</text
|
||||||
>单</view
|
>单</view
|
||||||
>
|
>
|
||||||
<view>
|
<view>
|
||||||
|
|
@ -257,7 +257,7 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { computed, reactive, ref } from 'vue';
|
import { computed, reactive, ref } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { isNil, concat } from 'lodash-es';
|
||||||
import { onPageScroll } from '@dcloudio/uni-app';
|
import { onPageScroll } from '@dcloudio/uni-app';
|
||||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
||||||
|
|
@ -289,7 +289,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
function filterUserNum(num) {
|
function filterUserNum(num) {
|
||||||
if (_.isNil(num)) {
|
if (isNil(num)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return `下级团队${num}人`;
|
return `下级团队${num}人`;
|
||||||
|
|
@ -313,13 +313,14 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
||||||
function setType(e) {
|
function setType(e) {
|
||||||
state.pagination.list = [];
|
state.pagination.list = [];
|
||||||
|
state.pagination.pageNo = 1;
|
||||||
state.level = e + '';
|
state.level = e + '';
|
||||||
getTeamList();
|
getTeamList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { resetPagination } from '@/sheep/helper/utils';
|
||||||
|
|
@ -254,7 +254,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@
|
||||||
>
|
>
|
||||||
<uni-easyinput
|
<uni-easyinput
|
||||||
:inputBorder="false"
|
:inputBorder="false"
|
||||||
:value="state.accountInfo.bankName"
|
:value="bankNameLabel"
|
||||||
placeholder="请选择银行"
|
placeholder="请选择银行"
|
||||||
suffixIcon="right"
|
suffixIcon="right"
|
||||||
disabled
|
disabled
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount, reactive } from 'vue';
|
import { onBeforeMount, reactive, computed } from 'vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import accountTypeSelect from './components/account-type-select.vue';
|
import accountTypeSelect from './components/account-type-select.vue';
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
|
|
@ -199,6 +199,14 @@
|
||||||
bankListSelectedIndex: '', // 选中银行 bankList 的 index
|
bankListSelectedIndex: '', // 选中银行 bankList 的 index
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const bankNameLabel = computed(() => {
|
||||||
|
if (!state.accountInfo.bankName || !state.bankList || state.bankList.length === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const item = state.bankList.find((it) => it.value === state.accountInfo.bankName);
|
||||||
|
return item ? item.label : '';
|
||||||
|
});
|
||||||
|
|
||||||
// 打开提现方式的弹窗
|
// 打开提现方式的弹窗
|
||||||
const onAccountSelect = (e) => {
|
const onAccountSelect = (e) => {
|
||||||
state.accountSelect = e;
|
state.accountSelect = e;
|
||||||
|
|
@ -300,7 +308,8 @@
|
||||||
function bankChange(e) {
|
function bankChange(e) {
|
||||||
const value = e.detail.value;
|
const value = e.detail.value;
|
||||||
state.bankListSelectedIndex = value;
|
state.bankListSelectedIndex = value;
|
||||||
state.accountInfo.bankName = state.bankList[value].label;
|
const item = state.bankList[value];
|
||||||
|
state.accountInfo.bankName = item ? item.value : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
import SpuApi from '@/sheep/api/product/spu';
|
import SpuApi from '@/sheep/api/product/spu';
|
||||||
|
|
@ -189,7 +189,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { resetPagination } from '@/sheep/helper/utils';
|
||||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +144,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
import CommentApi from '@/sheep/api/product/comment';
|
import CommentApi from '@/sheep/api/product/comment';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import commentItem from '../components/detail/comment-item.vue';
|
import commentItem from '../components/detail/comment-item.vue';
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 合并列表
|
// 合并列表
|
||||||
state.pagination.list = _.concat(state.pagination.list, res.data.list);
|
state.pagination.list = concat(state.pagination.list, res.data.list);
|
||||||
state.pagination.total = res.data.total;
|
state.pagination.total = res.data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
<su-fixed alway :bgStyles="{ background: '#fff' }" :val="0" noNav opacity :placeholder="false">
|
<su-fixed alway :bgStyles="{ background: '#fff' }" :val="0" noNav opacity :placeholder="false">
|
||||||
<su-status-bar />
|
<su-status-bar />
|
||||||
<view
|
<view
|
||||||
class="ui-bar ss-flex ss-col-center ss-row-between ss-p-x-20"
|
class="ui-bar ss-flex ss-col-center ss-row-between"
|
||||||
|
:class="[{
|
||||||
|
'ss-p-x-20': sheep.$platform.provider !== 'alipay'
|
||||||
|
}]"
|
||||||
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
|
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
|
||||||
>
|
>
|
||||||
<!-- 左 -->
|
<!-- 左 -->
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,10 @@
|
||||||
>
|
>
|
||||||
<su-status-bar />
|
<su-status-bar />
|
||||||
<view
|
<view
|
||||||
class="ui-bar ss-flex ss-col-center ss-row-between ss-p-x-20"
|
class="ui-bar ss-flex ss-col-center ss-row-between"
|
||||||
|
:class="[{
|
||||||
|
'ss-p-x-20': sheep.$platform.provider !== 'alipay'
|
||||||
|
}]"
|
||||||
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
|
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
|
||||||
>
|
>
|
||||||
<!-- 左 -->
|
<!-- 左 -->
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@
|
||||||
isDay: true,
|
isDay: true,
|
||||||
};
|
};
|
||||||
const isLogin = computed(() => sheep.$store('user').isLogin);
|
const isLogin = computed(() => sheep.$store('user').isLogin);
|
||||||
const state = reactive({
|
let state = reactive({
|
||||||
goodsId: 0,
|
goodsId: 0,
|
||||||
skeletonLoading: true, // SPU 加载中
|
skeletonLoading: true, // SPU 加载中
|
||||||
goodsInfo: {}, // SPU 信息
|
goodsInfo: {}, // SPU 信息
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { resetPagination } from '@/sheep/helper/utils';
|
||||||
import SpuApi from '@/sheep/api/product/spu';
|
import SpuApi from '@/sheep/api/product/spu';
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
|
|
@ -286,7 +286,7 @@
|
||||||
}
|
}
|
||||||
appendSettlementProduct(data.list, res.data);
|
appendSettlementProduct(data.list, res.data);
|
||||||
});
|
});
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
mountMasonry();
|
mountMasonry();
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,9 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import CategoryApi from '@/sheep/api/product/category';
|
import CategoryApi from '@/sheep/api/product/category';
|
||||||
import SpuApi from '@/sheep/api/product/spu';
|
import SpuApi from '@/sheep/api/product/spu';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
import { computed, reactive } from 'vue';
|
import { computed, reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import { handleTree } from '@/sheep/helper/utils';
|
import { handleTree } from '@/sheep/helper/utils';
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
|
@ -117,7 +117,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 合并列表
|
// 合并列表
|
||||||
state.pagination.list = _.concat(state.pagination.list, res.data.list);
|
state.pagination.list = concat(state.pagination.list, res.data.list);
|
||||||
state.pagination.total = res.data.total;
|
state.pagination.total = res.data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
@ -130,14 +130,21 @@
|
||||||
state.pagination.pageNo++;
|
state.pagination.pageNo++;
|
||||||
getGoodsList();
|
getGoodsList();
|
||||||
}
|
}
|
||||||
|
function initMenuIndex() {
|
||||||
onLoad(async (params) => {
|
// TODO @AI:可优化:增加一个 params.id 的兼容
|
||||||
await getList();
|
const appStore = sheep.$store('app');
|
||||||
|
// 处理 tabbar 传参的情况
|
||||||
|
const tabbarParams = appStore.paramsForTabbar || {};
|
||||||
|
const id = tabbarParams.id;
|
||||||
|
appStore.clearParamsForTabbar(); // 使用完后清理,避免影响下次跳转
|
||||||
// 首页点击分类的处理:查找满足条件的分类
|
// 首页点击分类的处理:查找满足条件的分类
|
||||||
const foundCategory = state.categoryList.find((category) => category.id === Number(params.id));
|
const foundCategory = state.categoryList.find((category) => category.id === Number(id));
|
||||||
// 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类
|
// 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类
|
||||||
onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0);
|
onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0);
|
||||||
|
}
|
||||||
|
onShow(async () => {
|
||||||
|
await getList();
|
||||||
|
initMenuIndex();
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleScrollToLower() {
|
function handleScrollToLower() {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
|
import { onLoad, onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import $share from '@/sheep/platform/share';
|
import $share from '@/sheep/platform/share';
|
||||||
// 隐藏原生tabBar
|
// 隐藏原生tabBar
|
||||||
|
|
@ -79,6 +79,20 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onShow(async() => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
// ios首次授权网络,需要重新加载一次应用初始化
|
||||||
|
// 可能需要考虑上uni.onNetworkStatusChange,uni.offNetworkStatusChange组合拳以及主动主动唤起权限申请
|
||||||
|
// 一开始放app.vue,感觉负载太重,搬到这里来了。
|
||||||
|
// 如果你的首页不是这个页面,需要把代码搬过去。
|
||||||
|
if (sheep.$platform.os === 'ios') {
|
||||||
|
if (await sheep.$platform.checkNetwork()) {
|
||||||
|
await sheep.$store('app').init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
});
|
||||||
|
|
||||||
// 下拉刷新
|
// 下拉刷新
|
||||||
onPullDownRefresh(() => {
|
onPullDownRefresh(() => {
|
||||||
sheep.$store('app').init();
|
sheep.$store('app').init();
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import {
|
import {
|
||||||
formatAfterSaleStatus,
|
formatAfterSaleStatus,
|
||||||
formatAfterSaleStatusDescription,
|
formatAfterSaleStatusDescription,
|
||||||
|
|
@ -127,7 +127,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data.list.forEach((order) => handleAfterSaleButtons(order));
|
data.list.forEach((order) => handleAfterSaleButtons(order));
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref, watch } from 'vue';
|
||||||
import { isEmpty } from 'lodash-es';
|
import { isEmpty } from 'lodash-es';
|
||||||
import {
|
import {
|
||||||
fen2yuan,
|
fen2yuan,
|
||||||
|
|
@ -269,6 +269,7 @@
|
||||||
} from '@/sheep/hooks/useGoods';
|
} from '@/sheep/hooks/useGoods';
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
import DeliveryApi from '@/sheep/api/trade/delivery';
|
import DeliveryApi from '@/sheep/api/trade/delivery';
|
||||||
|
import PayOrderApi from '@/sheep/api/pay/order';
|
||||||
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
||||||
|
|
||||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||||
|
|
@ -276,8 +277,6 @@
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
orderInfo: {},
|
orderInfo: {},
|
||||||
merchantTradeNo: '', // 商户订单号
|
|
||||||
comeinType: '', // 进入订单详情的来源类型
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// ========== 门店自提(核销) ==========
|
// ========== 门店自提(核销) ==========
|
||||||
|
|
@ -428,8 +427,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow(async () => {
|
onShow(async () => {
|
||||||
//onShow中获取订单列表,保证跳转后页面为最新状态
|
// onShow 中获取订单列表,保证跳转后页面为最新状态
|
||||||
await getOrderDetail(state.orderInfo.id);
|
// 有几率在 onLoad 完成 state.orderInfo.id 赋值前进入 onShow
|
||||||
|
if (state.orderInfo.id) {
|
||||||
|
await getOrderDetail(state.orderInfo.id);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
|
|
@ -437,12 +439,19 @@
|
||||||
if (options.id) {
|
if (options.id) {
|
||||||
id = options.id;
|
id = options.id;
|
||||||
}
|
}
|
||||||
// TODO 芋艿:【微信物流】下面两个变量,后续接入
|
// 场景:例如说“微信小程序购物订单”
|
||||||
state.comeinType = options.comein_type;
|
// https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order_center/order_center.html
|
||||||
if (state.comeinType === 'wechat') {
|
// (小程序商品订单详情 path)配置参考:pages/order/detail?payOrderNo=${商品订单号} 。其中:${商品订单号} out_trade_no 为 payOrderNo
|
||||||
state.merchantTradeNo = options.merchant_trade_no;
|
if (!id && options.payOrderNo) {
|
||||||
|
// 查询支付订单:根据 payOrderNo 取 merchantOrderId ,merchantOrderId 即 tradeOrderId
|
||||||
|
const payOrder = await PayOrderApi.getOrder(undefined, undefined, options.payOrderNo);
|
||||||
|
if (payOrder.code === 0) {
|
||||||
|
id = payOrder.data?.merchantOrderId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
state.orderInfo.id = id;
|
state.orderInfo.id = id;
|
||||||
|
// 完成 state.orderInfo.id 赋值后加载一次detail,但有几率与 onShow 重复可能导致 detail 会加载两次。
|
||||||
|
await getOrderDetail(state.orderInfo.id);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,8 +128,7 @@
|
||||||
handleOrderButtons,
|
handleOrderButtons,
|
||||||
} from '@/sheep/hooks/useGoods';
|
} from '@/sheep/hooks/useGoods';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import _ from 'lodash-es';
|
import { concat, isEmpty } from 'lodash-es';
|
||||||
import { isEmpty } from 'lodash-es';
|
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { resetPagination } from '@/sheep/helper/utils';
|
||||||
|
|
||||||
|
|
@ -331,7 +330,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data.list.forEach((order) => handleOrderButtons(order));
|
data.list.forEach((order) => handleOrderButtons(order));
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import PayWalletApi from '@/sheep/api/pay/wallet';
|
import PayWalletApi from '@/sheep/api/pay/wallet';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
import { ref, reactive, unref } from 'vue';
|
import { ref, reactive, unref } from 'vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import _ from 'lodash-es';
|
import { isEmpty } from 'lodash-es';
|
||||||
import { mobile } from '@/sheep/validate/form';
|
import { mobile } from '@/sheep/validate/form';
|
||||||
import AreaApi from '@/sheep/api/system/area';
|
import AreaApi from '@/sheep/api/system/area';
|
||||||
import AddressApi from '@/sheep/api/member/address';
|
import AddressApi from '@/sheep/api/member/address';
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
|
|
||||||
// 获得地区数据
|
// 获得地区数据
|
||||||
const getAreaData = () => {
|
const getAreaData = () => {
|
||||||
if (_.isEmpty(uni.getStorageSync('areaData'))) {
|
if (isEmpty(uni.getStorageSync('areaData'))) {
|
||||||
AreaApi.getAreaTree().then((res) => {
|
AreaApi.getAreaTree().then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
uni.setStorageSync('areaData', res.data);
|
uni.setStorageSync('areaData', res.data);
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import FavoriteApi from '@/sheep/api/product/favorite';
|
import FavoriteApi from '@/sheep/api/product/favorite';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { resetPagination } from '@/sheep/helper/utils';
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import SpuHistoryApi from '@/sheep/api/product/history';
|
import SpuHistoryApi from '@/sheep/api/product/history';
|
||||||
import { cloneDeep } from '@/sheep/helper/utils';
|
import { cloneDeep } from '@/sheep/helper/utils';
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import PayWalletApi from '@/sheep/api/pay/wallet';
|
import PayWalletApi from '@/sheep/api/pay/wallet';
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { resetPagination } from '@/sheep/helper/utils';
|
||||||
|
|
@ -154,7 +154,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { computed, reactive } from 'vue';
|
import { computed, reactive } from 'vue';
|
||||||
import _ from 'lodash-es';
|
import { concat } from 'lodash-es';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import PointApi from '@/sheep/api/member/point';
|
import PointApi from '@/sheep/api/member/point';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { resetPagination } from '@/sheep/helper/utils';
|
||||||
|
|
@ -145,7 +145,7 @@
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ const AuthUtil = {
|
||||||
},
|
},
|
||||||
custom: {
|
custom: {
|
||||||
showSuccess: true,
|
showSuccess: true,
|
||||||
loadingMsg: '登陆中',
|
loadingMsg: '登录中',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -91,7 +91,7 @@ const AuthUtil = {
|
||||||
},
|
},
|
||||||
custom: {
|
custom: {
|
||||||
showSuccess: true,
|
showSuccess: true,
|
||||||
loadingMsg: '登陆中',
|
loadingMsg: '登录中',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -107,7 +107,7 @@ const AuthUtil = {
|
||||||
},
|
},
|
||||||
custom: {
|
custom: {
|
||||||
showSuccess: true,
|
showSuccess: true,
|
||||||
loadingMsg: '登陆中',
|
loadingMsg: '登录中',
|
||||||
successMsg: '登录成功',
|
successMsg: '登录成功',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export default {
|
||||||
data,
|
data,
|
||||||
custom: {
|
custom: {
|
||||||
showSuccess: true,
|
showSuccess: true,
|
||||||
loadingMsg: '登陆中',
|
loadingMsg: '登录中',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,15 @@ import request from '@/sheep/request';
|
||||||
|
|
||||||
const PayOrderApi = {
|
const PayOrderApi = {
|
||||||
// 获得支付订单
|
// 获得支付订单
|
||||||
getOrder: (id, sync) => {
|
getOrder: (id, sync, no) => {
|
||||||
|
const params = {};
|
||||||
|
if (id) params.id = id;
|
||||||
|
if (no) params.no = no;
|
||||||
|
if (sync !== undefined) params.sync = sync;
|
||||||
return request({
|
return request({
|
||||||
url: '/pay/order/get',
|
url: '/pay/order/get',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: { id, sync },
|
params,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 提交支付订单
|
// 提交支付订单
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
open-type="getPhoneNumber"
|
open-type="getPhoneNumber"
|
||||||
@getphonenumber="getPhoneNumber"
|
@getphonenumber="getPhoneNumber"
|
||||||
>
|
>
|
||||||
使用微信手机号
|
手机号快捷登录
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,18 @@
|
||||||
:src="sheep.$url.static('/static/img/shop/platform/apple.png')"
|
:src="sheep.$url.static('/static/img/shop/platform/apple.png')"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<!-- 7.4 支付宝小程序登录 -->
|
||||||
|
<button
|
||||||
|
v-if="sheep.$platform.name === 'alipayMiniProgram'"
|
||||||
|
@tap="thirdLogin('alipay')"
|
||||||
|
class="ss-reset-button auto-login-btn"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="auto-login-img"
|
||||||
|
:src="sheep.$url.static('/static/img/shop/pay/alipay.png')"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 用户协议的勾选 -->
|
<!-- 用户协议的勾选 -->
|
||||||
|
|
@ -85,7 +97,7 @@
|
||||||
<view class="agreement-options-container">
|
<view class="agreement-options-container">
|
||||||
<!-- 同意选项 -->
|
<!-- 同意选项 -->
|
||||||
<view class="agreement-option ss-m-b-20">
|
<view class="agreement-option ss-m-b-20">
|
||||||
<label class="radio ss-flex ss-col-center" @tap="onAgree">
|
<view class="radio ss-flex ss-col-center" @tap="onAgree">
|
||||||
<radio
|
<radio
|
||||||
:checked="state.protocol === true"
|
:checked="state.protocol === true"
|
||||||
color="var(--ui-BG-Main)"
|
color="var(--ui-BG-Main)"
|
||||||
|
|
@ -98,12 +110,12 @@
|
||||||
<view class="agreement-text">与</view>
|
<view class="agreement-text">与</view>
|
||||||
<view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 《隐私协议》 </view>
|
<view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 《隐私协议》 </view>
|
||||||
</view>
|
</view>
|
||||||
</label>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 拒绝选项 -->
|
<!-- 拒绝选项 -->
|
||||||
<view class="agreement-option">
|
<view class="agreement-option">
|
||||||
<label class="radio ss-flex ss-col-center" @tap="onRefuse">
|
<view class="radio ss-flex ss-col-center" @tap="onRefuse">
|
||||||
<radio
|
<radio
|
||||||
:checked="state.protocol === false"
|
:checked="state.protocol === false"
|
||||||
color="#ff4d4f"
|
color="#ff4d4f"
|
||||||
|
|
@ -116,7 +128,7 @@
|
||||||
<view class="agreement-text">与</view>
|
<view class="agreement-text">与</view>
|
||||||
<view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 《隐私协议》 </view>
|
<view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 《隐私协议》 </view>
|
||||||
</view>
|
</view>
|
||||||
</label>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,11 @@
|
||||||
|
|
||||||
// 组件中使用 onMounted 监听页面加载,不是页面组件不使用 onShow
|
// 组件中使用 onMounted 监听页面加载,不是页面组件不使用 onShow
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
// #ifdef MP-ALIPAY
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: "",
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
if (!isEmpty(shareInfo.value)) {
|
if (!isEmpty(shareInfo.value)) {
|
||||||
sheep.$platform.share.updateShareInfo(shareInfo.value);
|
sheep.$platform.share.updateShareInfo(shareInfo.value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
<template>
|
<template>
|
||||||
<view :style="[bgStyle, { marginLeft: `${data.space}px` }]">
|
<view :style="[bgStyle, { marginLeft: `${data.space}px` }]">
|
||||||
<uni-grid :showBorder="Boolean(data.border)" :column="data.column">
|
<uni-grid :showBorder="Boolean(data.border)" :column="data.column">
|
||||||
<uni-grid-item v-for="(item, index) in data.list" :key="index" @tap="sheep.$router.go(item.url)">
|
<uni-grid-item v-for="(item, index) in data.list" :key="index" >
|
||||||
<view class="grid-item-box ss-flex ss-flex-col ss-row-center ss-col-center">
|
<view class="grid-item-box ss-flex ss-flex-col ss-row-center ss-col-center" @tap="sheep.$router.go(item.url)">
|
||||||
<view class="img-box">
|
<view class="img-box">
|
||||||
<view class="tag-box" v-if="item.badge.show"
|
<view class="tag-box" v-if="item.badge.show"
|
||||||
:style="[{ background: item.badge.bgColor, color: item.badge.textColor }]">
|
:style="[{ background: item.badge.bgColor, color: item.badge.textColor }]">
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,9 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
// 修复 https://t.zsxq.com/8v0JG 反馈的问题,richtext height 不自适应的问题
|
||||||
.richtext {
|
.richtext {
|
||||||
line-height: 0;
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, watch } from 'vue';
|
import { computed, reactive, watch } from 'vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { convertProductPropertyList, fen2yuan } from '@/sheep/hooks/useGoods';
|
import { convertProductPropertyList, initDefaultSelect, fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
|
|
||||||
const headerBg = sheep.$url.css('/static/img/shop/goods/groupon-btn-long.png');
|
const headerBg = sheep.$url.css('/static/img/shop/goods/groupon-btn-long.png');
|
||||||
const emits = defineEmits(['change', 'addCart', 'buy', 'close', 'ladder']);
|
const emits = defineEmits(['change', 'addCart', 'buy', 'close', 'ladder']);
|
||||||
|
|
@ -315,7 +315,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDisabled(false);
|
changeDisabled(false);
|
||||||
// TODO 芋艿:待讨论的优化点:1)单规格,要不要默认选中;2)默认要不要选中第一个规格
|
// 初始化默认选中规格中的第一个,如果不需要,注释这段代码即可
|
||||||
|
initDefaultSelect(propertyList, onSelectSku);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,12 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, watch } from 'vue';
|
import { computed, reactive, watch } from 'vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { formatStock, convertProductPropertyList, fen2yuan } from '@/sheep/hooks/useGoods';
|
import {
|
||||||
|
formatStock,
|
||||||
|
convertProductPropertyList,
|
||||||
|
fen2yuan,
|
||||||
|
initDefaultSelect,
|
||||||
|
} from '@/sheep/hooks/useGoods';
|
||||||
|
|
||||||
const emits = defineEmits(['change', 'addCart', 'buy', 'close']);
|
const emits = defineEmits(['change', 'addCart', 'buy', 'close']);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|
@ -305,7 +310,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDisabled(false);
|
changeDisabled(false);
|
||||||
// TODO 芋艿:待讨论的优化点:1)单规格,要不要默认选中;2)默认要不要选中第一个规格
|
// 初始化默认选中规格中的第一个,如果不需要,注释这段代码即可
|
||||||
|
initDefaultSelect(propertyList, onSelectSku);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
:badgeStyle="tabbar.badgeStyle"
|
:badgeStyle="tabbar.badgeStyle"
|
||||||
:isCenter="getTabbarCenter(index)"
|
:isCenter="getTabbarCenter(index)"
|
||||||
:centerImage="sheep.$url.cdn(item.iconUrl)"
|
:centerImage="sheep.$url.cdn(item.iconUrl)"
|
||||||
@tap="sheep.$router.go(item.url)"
|
@click="sheep.$router.go(item.url)"
|
||||||
>
|
>
|
||||||
<template v-slot:active-icon>
|
<template v-slot:active-icon>
|
||||||
<image class="u-page__item__slot-icon" :src="sheep.$url.cdn(item.activeIconUrl)"></image>
|
<image class="u-page__item__slot-icon" :src="sheep.$url.cdn(item.activeIconUrl)"></image>
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,19 @@ export default {
|
||||||
* @param {String} url -图片地址
|
* @param {String} url -图片地址
|
||||||
*/
|
*/
|
||||||
checkMPUrl(url) {
|
checkMPUrl(url) {
|
||||||
|
if (!url || typeof url !== 'string') {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
if (
|
if (
|
||||||
url.substring(0, 4) === 'http' &&
|
url.startsWith('http://') &&
|
||||||
url.substring(0, 5) !== 'https' &&
|
!url.startsWith('https://') &&
|
||||||
url.substring(0, 12) !== 'http://store' &&
|
!url.startsWith('http://store') &&
|
||||||
url.substring(0, 10) !== 'http://tmp' &&
|
!url.startsWith('http://tmp') &&
|
||||||
url.substring(0, 10) !== 'http://usr'
|
!url.startsWith('http://usr')
|
||||||
) {
|
) {
|
||||||
url = 'https' + url.substring(4, url.length);
|
url = url.replace('http://', 'https://');
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
return url;
|
return url;
|
||||||
|
|
|
||||||
|
|
@ -497,3 +497,18 @@ export function getRewardActivityRuleItemDescriptions(activity) {
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 单规格,要默认选中 */
|
||||||
|
export function initDefaultSelect(propertyList, onSelectSku) {
|
||||||
|
if (propertyList.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 遍历每一个属性
|
||||||
|
for (const property of propertyList) {
|
||||||
|
const firstValue = (property.values || [])[0];
|
||||||
|
// 不是禁用直接选中
|
||||||
|
if (firstValue && !firstValue.disabled) {
|
||||||
|
onSelectSku(property.id, firstValue.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,9 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用后端接口,获得 JSSDK 初始化所需的签名
|
// 调用后端接口,获得 JSSDK 初始化所需的签名
|
||||||
const url = location.origin;
|
// 微信要求签名 URL 与当前页面去掉 hash 后完全一致;不能直接用 location.origin(会丢子路径与 query)
|
||||||
const { code, data } = await AuthUtil.createWeixinMpJsapiSignature(url);
|
const signUrl = location.href.split('#')[0];
|
||||||
|
const { code, data } = await AuthUtil.createWeixinMpJsapiSignature(signUrl);
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
jweixin.config({
|
jweixin.config({
|
||||||
debug: false,
|
debug: false,
|
||||||
|
|
@ -57,7 +58,11 @@ export default {
|
||||||
configSuccess = true;
|
configSuccess = true;
|
||||||
jweixin.error((err) => {
|
jweixin.error((err) => {
|
||||||
configSuccess = false;
|
configSuccess = false;
|
||||||
console.error('微信 JSSDK 初始化失败', err);
|
console.error('[wx-jssdk] config error', err, {
|
||||||
|
href: location.href,
|
||||||
|
signUrl,
|
||||||
|
data,
|
||||||
|
});
|
||||||
$helper.toast('微信JSSDK:' + err.errMsg);
|
$helper.toast('微信JSSDK:' + err.errMsg);
|
||||||
});
|
});
|
||||||
jweixin.ready(() => {
|
jweixin.ready(() => {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import { isEmpty } from 'lodash-es';
|
||||||
import { isWxBrowser } from '@/sheep/helper/utils';
|
import { isWxBrowser } from '@/sheep/helper/utils';
|
||||||
// #endif
|
// #endif
|
||||||
import wechat from './provider/wechat/index.js';
|
import wechat from './provider/wechat/index.js';
|
||||||
|
import alipay from './provider/alipay/index';
|
||||||
import apple from './provider/apple';
|
import apple from './provider/apple';
|
||||||
import share from './share';
|
import share from './share';
|
||||||
import Pay from './pay';
|
import Pay from './pay';
|
||||||
|
|
@ -53,6 +54,19 @@ platform = 'miniProgram';
|
||||||
provider = 'wechat';
|
provider = 'wechat';
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef MP-ALIPAY
|
||||||
|
name = 'alipayMiniProgram';
|
||||||
|
platform = 'alipayMiniProgram';
|
||||||
|
provider = 'alipay';
|
||||||
|
if (!device.safeAreaInsets) {
|
||||||
|
device.safeAreaInsets = uni.getSystemInfoSync().safeAreaInsets
|
||||||
|
}
|
||||||
|
// 兜底一下。还是没有值时候,就给个默认值
|
||||||
|
if (!device.safeAreaInsets) {
|
||||||
|
device.safeAreaInsets = {}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
if (isEmpty(name)) {
|
if (isEmpty(name)) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '暂不支持该平台',
|
title: '暂不支持该平台',
|
||||||
|
|
@ -64,6 +78,8 @@ if (isEmpty(name)) {
|
||||||
const load = () => {
|
const load = () => {
|
||||||
if (provider === 'wechat') {
|
if (provider === 'wechat') {
|
||||||
wechat.load();
|
wechat.load();
|
||||||
|
} else if (provider === 'alipay') {
|
||||||
|
alipay.load();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -72,6 +88,7 @@ const useProvider = (_provider = '') => {
|
||||||
if (_provider === '') _provider = provider;
|
if (_provider === '') _provider = provider;
|
||||||
if (_provider === 'wechat') return wechat;
|
if (_provider === 'wechat') return wechat;
|
||||||
if (_provider === 'apple') return apple;
|
if (_provider === 'apple') return apple;
|
||||||
|
if (_provider === 'alipay') return alipay;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 支付服务转发
|
// 支付服务转发
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
// 这里 特指支付宝小程序,后面如果需要拓展什么阿里云小程序、淘宝小程序之类的,就自己新建
|
||||||
|
import service from './miniProgram';
|
||||||
|
|
||||||
|
const alipay = service;
|
||||||
|
|
||||||
|
export default alipay;
|
||||||
|
|
@ -0,0 +1,220 @@
|
||||||
|
import SocialApi from '@/sheep/api/member/social';
|
||||||
|
import AuthUtil from '@/sheep/api/member/auth';
|
||||||
|
import UserApi from '@/sheep/api/member/user';
|
||||||
|
|
||||||
|
const socialType = 40; // 社交类型 - 支付宝小程序
|
||||||
|
|
||||||
|
let subscribeEventList = []
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
checkUpdate()
|
||||||
|
getSubscribeTemplate()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================= 登录相关逻辑===================
|
||||||
|
|
||||||
|
// 基本上的登录逻辑是和微信小程序一样的
|
||||||
|
|
||||||
|
//支付宝小程序静默授权登录
|
||||||
|
const login = async () => {
|
||||||
|
return new Promise(async (resolve,reject)=>{
|
||||||
|
// 1. 获取支付宝的code
|
||||||
|
const codeResult = await uni.login({
|
||||||
|
provider: 'alipay',
|
||||||
|
scopes: 'auth_user',
|
||||||
|
});
|
||||||
|
if(codeResult.errMsg !== 'login:ok'){
|
||||||
|
return resolve(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 社交登录
|
||||||
|
const loginResult = await AuthUtil.socialLogin(socialType, codeResult.code, 'default');
|
||||||
|
if (loginResult.code === 0) {
|
||||||
|
setOpenid(loginResult.data.openid);
|
||||||
|
return resolve(true);
|
||||||
|
} else {
|
||||||
|
return resolve(false);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付宝小程序手机号授权登录
|
||||||
|
const mobileLogin = async (e) =>{
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
if (e.errMsg !== 'getPhoneNumber:ok') {
|
||||||
|
return resolve(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 获得支付宝 code
|
||||||
|
const codeResult = await uni.login();
|
||||||
|
if (codeResult.errMsg !== 'login:ok') {
|
||||||
|
return resolve(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO 2. 一键登录
|
||||||
|
// const loginResult = await AuthUtil.weixinMiniAppLogin(e.code, codeResult.code, 'default');
|
||||||
|
// if (loginResult.code === 0) {
|
||||||
|
// setOpenid(loginResult.data.openid);
|
||||||
|
// return resolve(true);
|
||||||
|
// } else {
|
||||||
|
// return resolve(false);
|
||||||
|
// }
|
||||||
|
// TODO 芋艿:shareInfo: uni.getStorageSync('shareLog') || {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 支付宝小程序绑定
|
||||||
|
const bind = () => {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
// 1. 获得支付宝小程序 code
|
||||||
|
const codeResult = await uni.login({
|
||||||
|
provider: 'alipay',
|
||||||
|
scopes: 'auth_user',
|
||||||
|
});
|
||||||
|
if (codeResult.errMsg !== 'login:ok') {
|
||||||
|
return resolve(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 绑定账号
|
||||||
|
const bindResult = await SocialApi.socialBind(socialType, codeResult.code, 'default');
|
||||||
|
if (bindResult.code === 0) {
|
||||||
|
setOpenid(bindResult.data);
|
||||||
|
return resolve(true);
|
||||||
|
} else {
|
||||||
|
return resolve(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 支付宝小程序解除绑定
|
||||||
|
const unbind = async (openid) => {
|
||||||
|
const { code } = await SocialApi.socialUnbind(socialType, openid);
|
||||||
|
return code === 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 绑定用户手机号
|
||||||
|
const bindUserPhoneNumber = (e) => {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
// todo 待完善
|
||||||
|
// const { code } = await UserApi.updateUserMobileByWeixin(e.code);
|
||||||
|
// if (code === 0) {
|
||||||
|
// resolve(true);
|
||||||
|
// }
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 设置 openid 到本地存储,目前只有 pay 支付时会使用
|
||||||
|
function setOpenid(openid) {
|
||||||
|
uni.setStorageSync('openid', openid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得 openid
|
||||||
|
async function getOpenid(force = false) {
|
||||||
|
let openid = uni.getStorageSync('openid');
|
||||||
|
if (!openid && force) {
|
||||||
|
const info = await getInfo();
|
||||||
|
if (info && info.openid) {
|
||||||
|
openid = info.openid;
|
||||||
|
setOpenid(openid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得社交信息
|
||||||
|
async function getInfo() {
|
||||||
|
const { code, data } = await SocialApi.getSocialUser(socialType);
|
||||||
|
if (code !== 0) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ========== 非登录相关的逻辑 ==========
|
||||||
|
|
||||||
|
// 小程序更新
|
||||||
|
const checkUpdate = (silence = true) => {
|
||||||
|
if (uni.canIUse('getUpdateManager')) {
|
||||||
|
const updateManager = uni.getUpdateManager();
|
||||||
|
updateManager.onCheckForUpdate(function(res) {
|
||||||
|
// 请求完新版本信息的回调
|
||||||
|
if (res.hasUpdate) {
|
||||||
|
updateManager.onUpdateReady(function() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '更新提示',
|
||||||
|
content: '新版本已经准备好,是否重启应用?',
|
||||||
|
success: function(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||||
|
updateManager.applyUpdate();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if(!silence) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前为最新版本',
|
||||||
|
icon: 'none',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取订阅消息模板
|
||||||
|
async function getSubscribeTemplate(){
|
||||||
|
const { code, data } = await SocialApi.getSubscribeTemplateList();
|
||||||
|
if (code === 0) {
|
||||||
|
subscribeEventList = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订阅消息
|
||||||
|
function subscribeMessage(event, callback = undefined){
|
||||||
|
let tmplIds = [];
|
||||||
|
if (typeof event === 'string') {
|
||||||
|
const temp = subscribeEventList.find(item => item.title.includes(event));
|
||||||
|
}
|
||||||
|
if (temp) {
|
||||||
|
tmplIds.push(temp.id);
|
||||||
|
}
|
||||||
|
if (typeof event === 'object') {
|
||||||
|
event.forEach((e) => {
|
||||||
|
const temp = subscribeEventList.find(item => item.title.includes(e));
|
||||||
|
if (temp) {
|
||||||
|
tmplIds.push(temp.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmplIds.length === 0) return;
|
||||||
|
uni.requestSubscribeMessage({
|
||||||
|
tmplIds,
|
||||||
|
success: ()=>{
|
||||||
|
// 不管是拒绝还是同意都触发
|
||||||
|
callback && callback()
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log(err);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
load,
|
||||||
|
login,
|
||||||
|
bind,
|
||||||
|
unbind,
|
||||||
|
bindUserPhoneNumber,
|
||||||
|
mobileLogin,
|
||||||
|
getInfo,
|
||||||
|
getOpenid,
|
||||||
|
subscribeMessage,
|
||||||
|
checkUpdate,
|
||||||
|
};
|
||||||
|
|
@ -10,6 +10,8 @@ import service from './miniProgram';
|
||||||
import service from './openPlatform';
|
import service from './openPlatform';
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
const wechat = service;
|
let wechat = {};
|
||||||
|
if (typeof service !== 'undefined') {
|
||||||
|
wechat = service;
|
||||||
|
}
|
||||||
export default wechat;
|
export default wechat;
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,13 @@ const _go = (
|
||||||
|
|
||||||
// 跳转底部导航
|
// 跳转底部导航
|
||||||
if (TABBAR.includes(page)) {
|
if (TABBAR.includes(page)) {
|
||||||
|
// wx.switchTab: url 不支持 queryString
|
||||||
|
// 设置全局变量
|
||||||
|
const params = queryToParams(query);
|
||||||
|
$store('app').setParamsForTabbar(params);
|
||||||
|
// 请记得在业务代码里使用完后,清理掉全局状态,避免影响下次跳转
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url,
|
url: page,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -109,6 +114,19 @@ function paramsToQuery(params) {
|
||||||
return query.join('&');
|
return query.join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function queryToParams(query) {
|
||||||
|
if (isEmpty(query)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
let params = {};
|
||||||
|
let pairs = query.split('&');
|
||||||
|
for (let i = 0; i < pairs.length; i++) {
|
||||||
|
let pair = pairs[i].split('=');
|
||||||
|
params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
function back() {
|
function back() {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
history.back();
|
history.back();
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import { baseUrl, h5Url } from '@/sheep/config';
|
||||||
const app = defineStore({
|
const app = defineStore({
|
||||||
id: 'app',
|
id: 'app',
|
||||||
state: () => ({
|
state: () => ({
|
||||||
|
paramsForTabbar: {}, // 为全局tabbar跳转传参用。原因是 tabbar 无法传参,只能通过全局状态传递
|
||||||
info: {
|
info: {
|
||||||
// 应用信息
|
// 应用信息
|
||||||
name: '', // 商城名称
|
name: '', // 商城名称
|
||||||
|
|
@ -73,7 +74,7 @@ const app = defineStore({
|
||||||
this.info = {
|
this.info = {
|
||||||
name: '芋道商城',
|
name: '芋道商城',
|
||||||
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
|
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
|
||||||
version: '2025.10',
|
version: '2026.03',
|
||||||
copyright: '全部开源,个人与企业可 100% 免费使用',
|
copyright: '全部开源,个人与企业可 100% 免费使用',
|
||||||
copytime: 'Copyright© 2018-2025',
|
copytime: 'Copyright© 2018-2025',
|
||||||
|
|
||||||
|
|
@ -113,6 +114,13 @@ const app = defineStore({
|
||||||
$router.error('InitError', res.msg || '加载失败');
|
$router.error('InitError', res.msg || '加载失败');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 设置 paramsForTabbar
|
||||||
|
setParamsForTabbar(params = {}) {
|
||||||
|
this.paramsForTabbar = params;
|
||||||
|
},
|
||||||
|
clearParamsForTabbar() {
|
||||||
|
this.paramsForTabbar = {};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
persist: {
|
persist: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,12 @@
|
||||||
-->
|
-->
|
||||||
<view class="ui-navbar-box">
|
<view class="ui-navbar-box">
|
||||||
<view
|
<view
|
||||||
class="ui-bar ss-p-x-20"
|
class="ui-bar"
|
||||||
:class="state.isDark ? 'text-white' : 'text-black'"
|
:class="[{
|
||||||
|
'text-white': state.isDark,
|
||||||
|
'text-black': !state.isDark,
|
||||||
|
'ss-p-x-20': sheep.$platform.provider !== 'alipay'
|
||||||
|
}]"
|
||||||
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
|
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
|
||||||
>
|
>
|
||||||
<view class="icon-box ss-flex">
|
<view class="icon-box ss-flex">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<!-- 自定义底部导航项 -->
|
<!-- 自定义底部导航项 -->
|
||||||
<template>
|
<template>
|
||||||
<view class="u-tabbar-item" :style="[addStyle(customStyle)]">
|
<view class="u-tabbar-item" :style="[addStyle(customStyle)]" @click="clickHandler">
|
||||||
<view v-if="isCenter" class="tabbar-center-item">
|
<view v-if="isCenter" class="tabbar-center-item">
|
||||||
<image class="center-image" :src="centerImage" mode="aspectFill"></image>
|
<image class="center-image" :src="centerImage" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue