第一版正式版本

This commit is contained in:
77 2024-11-04 11:13:41 +08:00
parent de5eb74256
commit 7d8e731ea6
19 changed files with 927 additions and 1209 deletions

View File

@ -240,17 +240,6 @@
"group": "商品" "group": "商品"
} }
}, },
{
"path": "sales",
"style": {
"navigationBarTitleText": "促销商品"
},
"meta": {
"sync": true,
"title": "促销商品",
"group": "商品"
}
},
{ {
"path": "list", "path": "list",
"style": { "style": {

View File

@ -18,7 +18,7 @@
> >
<template #top> <template #top>
<!-- 撑一下顶部导航 --> <!-- 撑一下顶部导航 -->
<view style="height: 45px"></view> <view :style="{height:hei+'px'}"></view>
</template> </template>
<!-- style="transform: scaleY(-1)"必须写否则会导致列表倒置 --> <!-- style="transform: scaleY(-1)"必须写否则会导致列表倒置 -->
<!-- 注意不要直接在chat-item组件标签上设置style因为在微信小程序中是无效的请包一层view --> <!-- 注意不要直接在chat-item组件标签上设置style因为在微信小程序中是无效的请包一层view -->
@ -48,7 +48,12 @@
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import KeFuApi from '@/sheep/api/promotion/kefu'; import KeFuApi from '@/sheep/api/promotion/kefu';
import { isEmpty } from '@/sheep/helper/utils'; import { isEmpty } from '@/sheep/helper/utils';
const props = defineProps({
hei: {
type: [Object, String, Number],
default() {},
},
});
const messageList = ref([]); // const messageList = ref([]); //
const showNewMessageTip = ref(false); // const showNewMessageTip = ref(false); //
const backToTopStyle = reactive({ const backToTopStyle = reactive({

View File

@ -93,7 +93,7 @@
class="chat-avatar ss-m-l-24" class="chat-avatar ss-m-l-24"
:src=" :src="
sheep.$url.cdn(message.senderAvatar) || sheep.$url.cdn(message.senderAvatar) ||
sheep.$url.static('/static/img/shop/chat/default.png') sheep.$url.static('https://zysc.fjptzykj.com:3000/shangcheng/d1e722fb4a257a9ab28c7aca2df004d0159a8ee9cc1d02bccf7ef27b55fcc526.png')
" "
mode="aspectFill" mode="aspectFill"
> >

View File

@ -7,7 +7,7 @@
<!-- 覆盖头部导航栏背景颜色 --> <!-- 覆盖头部导航栏背景颜色 -->
<div class="page-bg" :style="{ height: sys_navBar + 'px' }"></div> <div class="page-bg" :style="{ height: sys_navBar + 'px' }"></div>
<!-- 聊天区域 --> <!-- 聊天区域 -->
<MessageList ref="messageListRef"> <MessageList ref="messageListRef" :hei="sys_navBar">
<template #bottom> <template #bottom>
<message-input <message-input
v-model="chat.msg" v-model="chat.msg"
@ -179,7 +179,9 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.chat-wrap { .chat-wrap {
.page-bg { .page-bg {
width: 100%; width: 100%;
position: absolute; position: absolute;

File diff suppressed because one or more lines are too long

View File

@ -2,10 +2,45 @@
<template> <template>
<view class="new-main"> <view class="new-main">
<view class="account-card"> <view class="account-card">
<view class="new-ljsy">
<view class="l dd">
<!-- <view class="l-img">
<image src="https://zysc.fjptzykj.com:3000/shangcheng/7624fd0e447748a5f8f4532d89a416cf7f962644e588c99d7e8c8baeab7ee91f.png" class="img"></image>
</view> -->
<view class="l-text">
<view class="l-text-b">
累计收益
</view>
<view class="l-text-t">
{{
fen2yuan(state.summary2.withdrawPrice || 0)
}}
</view>
</view>
</view>
<view class="l r" @click="sheep.$router.go('/pages/commission/team')">
<!-- <view class="l-img">
<image src="https://zysc.fjptzykj.com:3000/shangcheng/6575e409f7656efb2821b2159ca0a26916f83f037fc533f9f19aa141c412ee2c.png" class="img"></image>
</view> -->
<view class="l-text">
<view class="l-text-b">
我的团队
</view>
<view class="l-text-t">
{{
state.arr2.firstBrokerageUserCount + state.arr2.secondBrokerageUserCount ||
0
}}
</view>
</view>
</view>
</view>
<view class="account-card-box"> <view class="account-card-box">
<view class="ss-flex ss-row-between card-box-header"> <!--<view class="ss-flex ss-row-between card-box-header">
<view class="ss-flex"> <view class="ss-flex">
<!-- <view class="header-title ss-m-r-16">账户信息</view> -->
<button class="ss-reset-button look-btn ss-flex" @tap="state.showMoney = !state.showMoney"> <button class="ss-reset-button look-btn ss-flex" @tap="state.showMoney = !state.showMoney">
<uni-icons :type="state.showMoney ? 'eye-filled' : 'eye-slash-filled'" color="#A57A55" <uni-icons :type="state.showMoney ? 'eye-filled' : 'eye-slash-filled'" color="#A57A55"
size="20" /> size="20" />
@ -15,19 +50,23 @@
<view class="header-title ss-m-r-4">提现记录</view> <view class="header-title ss-m-r-4">提现记录</view>
<text class="cicon-play-arrow" /> <text class="cicon-play-arrow" />
</view> </view>
</view> </view> -->
<!-- 提现金额 --> <!-- 提现金额 -->
<view class="ss-flex new-cont"> <view class="new-cont">
<view class="ss-flex-1 ss-flex-col "> <view class="ss-flex-1 ss-flex-col ">
<view class="item-title">可提现()</view> <view class="item-title">可提现()</view>
<view class="item-detail"> <view class="item-detail">
{{ state.showMoney ? fen2yuan(state.brokerageInfo.brokeragePrice) : '***' }} {{ state.showMoney ? fen2yuan(state.brokerageInfo.brokeragePrice) : '***' }}
</view> </view>
</view> </view>
<view class="ss-flex-1 ss-flex-col ss-col-center new-btn" <!-- <view class="ss-flex-1 ss-flex-col ss-col-center new-btn"
@tap="sheep.$router.go('/pages/commission/withdraw')" @tap="sheep.$router.go('/pages/commission/withdraw')"
> >
立即提现 立即提现
</view> -->
<view class="sss" @tap="sheep.$router.go('/pages/commission/wallet')">
<view class="header-title ss-m-r-4">提现记录</view>
<image class="menu-icon-you" src="@/static/images/dayu.png" mode="aspectFill"></image>
</view> </view>
</view> </view>
<!-- 收益 --> <!-- 收益 -->
@ -51,15 +90,24 @@
</view> </view>
</view> </view>
</view> </view>
<view class="ss-flex-1 ss-flex-col ss-col-center new-btn"
@tap="sheep.$router.go('/pages/commission/withdraw')">
立即提现
</view>
</view> </view>
</view>
</view>
<!-- 菜单栏 -->
<commission-menu />
</view> </view>
</template> </template>
<script setup> <script setup>
import commissionMenu from './commission-menu.vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
import { import {
computed, computed,
@ -75,15 +123,39 @@
const userInfo = computed(() => sheep.$store('user').userInfo); const userInfo = computed(() => sheep.$store('user').userInfo);
const state = reactive({ const state = reactive({
showMoney: false, showMoney: true,
summary: {}, summary: {},
brokerageInfo: {}, // brokerageInfo: {}, //
arr:{} arr: {},
summary2: {},
arr2: {}
});
async function getAgentInfo() {
const {
code,
data
} = await BrokerageApi.getBrokerageUserSummary();
if (code !== 0) {
return;
}
state.summary2 = data;
}
onBeforeMount(async () => {
getAgentInfo();
//
let {
data
} = await BrokerageApi.getBrokerageUserSummary();
state.arr2 = data;
}); });
// //
async function getBrokerageUser() { async function getBrokerageUser() {
const { data, code } = await BrokerageApi.getBrokerageUser(); const {
data,
code
} = await BrokerageApi.getBrokerageUser();
if (code === 0) { if (code === 0) {
state.brokerageInfo = data; state.brokerageInfo = data;
} }
@ -106,44 +178,133 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.new-main{ .menu-icon-you {
width: 100%; width: 38rpx;
height: 38rpx;
} }
.account-card {
width: 694rpx; .new-btn {
width: 85%;
margin: 0 auto; margin: 0 auto;
background: rgba(235, 70, 39);
padding: 12px 0;
border-radius: 20px;
color: white;
font-weight:700;
}
.new-ljsy {
// width: 100%;
// background:white;
padding: 8px 13px;
display: flex;
justify-content: center;
.l {
// background: rgba(254,244,237);
// background:url('https://zysc.fjptzykj.com/admin-api/infra/file/25/get/8e878e15d22f68e0187a953aeba31b80423b7e3fafa8e4aa9f237477ac0fd519.png') rgba(254,244,237,1);
width: 43%;
height: 85px;
border-radius: 12px;
background-size: cover;
// position:relative;
display: flex;
align-items: center;
justify-content: left;
&.dd {
margin-right: 5%;
}
.l-text {
// position:absolute;
// top:50%;
// transform: translateY(-50%);
// left:70px;
.l-text-t {
font-size: 27px;
font-weight: 700;
}
.l-text-b {
font-size: 24rpx;
}
}
.l-img {
width: 40px;
height: 40px;
margin-right: 10px;
.img {
width: 100%;
height: 100%;
}
}
}
.r {
// background:url('https://zysc.fjptzykj.com/admin-api/infra/file/25/get/b18f31e528ad0ab1026441faba07cb9e64723ffa511d103324fcd65fcaaf1557.png') rgba(254,244,237,1);
// background-size: cover;
.l-text {
// left:80px;
}
}
}
.new-main {
width: 100%;
margin: 15px auto !important;
}
.account-card {
// width: 694rpx;
margin: 0 15px;
padding: 2rpx; padding: 2rpx;
// background: linear-gradient(180deg, #ffffff 0.88%, #fff9ec 100%); // background: linear-gradient(180deg, #ffffff 0.88%, #fff9ec 100%);
border-radius: 12rpx 12rpx 0 0; // border-radius: 12rpx 12rpx 0 0;
z-index: 3; z-index: 3;
position: relative; position: relative;
background: url('https://zysc.fjptzykj.com:3000/shangcheng/423af1ff70d4e80ca7bd4ede17b9fe63800aaffd2e4e8b5b7584ab5bf5884996.png') no-repeat; background: url('https://zysc.fjptzykj.com:3000/shangcheng/cbbe23772e68ed5fc5c18d193f9f674d6e87ccddd422e0df6af6cab5dfea6c27.png') no-repeat;
background-size: cover; background-size: 100%;
padding-bottom: 25px;
border-radius: 18px;
.account-card-box { .account-card-box {
// background: #ffefd6; // background: #ffefd6;
.new-cont { .new-cont {
padding: 0 45rpx; padding: 0 45rpx;
display: flex;
justify-content: space-between;
margin-top: 13px;
.sss{
display:flex;
height:20px;
align-items:center;
.header-title{
color:rgba(194,194,194);
}
}
.new-btn { .new-btn {
background: rgba(178, 102, 67); background: rgba(178, 102, 67);
border-radius: 22px; border-radius: 22px;
padding: 8px 0; padding: 8px 0;
font-size: 16px; font-size: 16px;
color: white; color: white;
font-weight:700; font-weight: 700;
} }
.item-title { .item-title {
color: rgba(139, 105, 87, 1); color: rgba(142, 144, 145, 1);
font-size: 24rpx;
} }
.item-detail { .item-detail {
color: rgba(81, 41, 24, 1); color: rgba(231, 91, 79, 1);
font-size: 31px; font-size: 20px;
} }
} }
@ -173,16 +334,16 @@
.item-title { .item-title {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
color: rgba(139, 105, 87, 1); color: rgba(142, 144, 145, 1);
line-height: 30rpx; line-height: 30rpx;
margin-bottom: 24rpx; margin-bottom: 24rpx;
} }
.item-detail { .item-detail {
font-size: 36rpx; font-size: 20px;
font-family: OPPOSANS; font-family: OPPOSANS;
font-weight: bold; font-weight: bold;
color: #692e04; color: rgba(80, 80, 80, 1);
line-height: 30rpx; line-height: 30rpx;
} }
} }

View File

@ -13,41 +13,10 @@
</view> </view>
</view> </view>
<!-- 账户信息 --> <!-- 账户信息 -->
<account-info style="margin: 0 auto;" /> <account-info />
</view>
<view class="new-ljsy">
<view class="l dd">
<view class="l-img">
<image src="https://zysc.fjptzykj.com:3000/shangcheng/7624fd0e447748a5f8f4532d89a416cf7f962644e588c99d7e8c8baeab7ee91f.png" class="img"></image>
</view>
<view class="l-text">
<view class="l-text-t">
{{
fen2yuan(state.summary.withdrawPrice || 0)
}}
</view>
<view class="l-text-b">
累计收益
</view>
</view>
</view>
<view class="l r" @click="sheep.$router.go('/pages/commission/team')">
<view class="l-img">
<image src="https://zysc.fjptzykj.com:3000/shangcheng/6575e409f7656efb2821b2159ca0a26916f83f037fc533f9f19aa141c412ee2c.png" class="img"></image>
</view>
<view class="l-text">
<view class="l-text-t">
{{
state.arr.firstBrokerageUserCount + state.arr.secondBrokerageUserCount ||
0
}}
</view>
<view class="l-text-b">
我的团队
</view>
</view>
</view>
</view> </view>
</template> </template>
<script setup> <script setup>
@ -68,8 +37,6 @@
const state = reactive({ const state = reactive({
showMoney: false, showMoney: false,
summary:{},
arr:{}
}); });
async function getAgentInfo() { async function getAgentInfo() {
@ -88,64 +55,15 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.new-ljsy {
width:100%;
background:white;
padding: 20px 0;
display: flex;
justify-content: center;
.l {
background: rgba(254,244,237);
// background:url('https://zysc.fjptzykj.com/admin-api/infra/file/25/get/8e878e15d22f68e0187a953aeba31b80423b7e3fafa8e4aa9f237477ac0fd519.png') rgba(254,244,237,1);
width:43%;
height:85px;
border-radius: 12px;
background-size: cover;
// position:relative;
display:flex;
align-items:center;
justify-content: center;
&.dd{
margin-right: 5%;
}
.l-text{
// position:absolute;
// top:50%;
// transform: translateY(-50%);
// left:70px;
.l-text-t{
font-size:20px;
font-weight: 700;
}
.l-text-b{
font-size: 13px;
}
}
.l-img{
width:40px;
height:40px;
margin-right:10px;
.img{
width:100%;
height:100%;
}
}
}
.r {
// background:url('https://zysc.fjptzykj.com/admin-api/infra/file/25/get/b18f31e528ad0ab1026441faba07cb9e64723ffa511d103324fcd65fcaaf1557.png') rgba(254,244,237,1);
// background-size: cover;
.l-text{
// left:80px;
}
}
}
// //
.user-card { .user-card {
width: 100%; width: 100%;
height: 580rpx; height: 580rpx;
// margin: -88rpx 20rpx 0 20rpx; // margin: -88rpx 20rpx 0 20rpx;
background: url('https://zysc.fjptzykj.com:3000/shangcheng/c4f941683d41701ac7f182824791ff43b5f7e70fb527b4d4d153416d6065c44f.png') no-repeat; background: url('https://zysc.fjptzykj.com:3000/shangcheng/ae736076156e99710f417fe5619cd0be47a2fad082a192dbbd6dcbc2bbc65eea.png') no-repeat;
// background: url('https://zysc.fjptzykj.com:3000/shangcheng/4bcaa2803c9cc953353d22db804b952b333e97d2a0d57266a00baf0c07379efa.png') no-repeat; // background: url('https://zysc.fjptzykj.com:3000/shangcheng/4bcaa2803c9cc953353d22db804b952b333e97d2a0d57266a00baf0c07379efa.png') no-repeat;
// background:#ff3000; // background:#ff3000;
background-size: 100% 100%; background-size: 100% 100%;

View File

@ -63,7 +63,7 @@
list: [], list: [],
total: 0, total: 0,
pageNo: 1, pageNo: 1,
pageSize: 1, pageSize: 8,
}, },
}); });

View File

@ -8,9 +8,9 @@
<image class="menu-icon " :src="sheep.$url.static(item.img)" mode="aspectFill"></image> <image class="menu-icon " :src="sheep.$url.static(item.img)" mode="aspectFill"></image>
<view>{{ item.title }}</view> <view>{{ item.title }}</view>
</view> </view>
<view class="r"> <!-- <view class="r">
<image class="menu-icon-you" src="@/static/images/dayu.png" mode="aspectFill"></image> <image class="menu-icon-you" src="@/static/images/dayu.png" mode="aspectFill"></image>
</view> </view> -->
</view> </view>
</view> </view>
</view> </view>
@ -41,32 +41,32 @@
const state = reactive({ const state = reactive({
menuListnew: [{ menuListnew: [{
img: 'https://zysc.fjptzykj.com:3000/shangcheng/82255ab9cb8fa91b261a1976c81a7c761c34a8aa3d3fc12864b3b83158d22267.png', img: 'https://zysc.fjptzykj.com:3000/shangcheng/38fcbd2619cac8f4134efdf6ddf98a098d7ec4920be09c399d3e05b26699cfc3.png',
title: '推广名片', title: '推广名片',
path: 'action:showShareModal', path: 'action:showShareModal',
}, },
{ {
img: 'https://zysc.fjptzykj.com:3000/shangcheng/3aca872c5c25923b883b98364ca7525bcb7d176cf89769bab429fed090c75adb.png', img: 'https://zysc.fjptzykj.com:3000/shangcheng/d6fd382e25839128b4231616b5414b09964f998faaed300fd71b093d0545b4c9.png',
title: '佣金明细', title: '佣金明细',
path: '/pages/commission/wallet', path: '/pages/commission/wallet',
}, },
{ {
img: 'https://zysc.fjptzykj.com:3000/shangcheng/512aaaf15aeedc1fd5ad6dc14161d83a4c4ecee33ae2428986c8ecbf0c420fa7.png', img: 'https://zysc.fjptzykj.com:3000/shangcheng/fb1773e483bdf5889657ad0c6113327051a337514d5de0bce3d14a744d1f2b0c.png',
title: '分销订单', title: '分销订单',
path: '/pages/commission/order', path: '/pages/commission/order',
}, },
{ {
img: 'https://zysc.fjptzykj.com:3000/shangcheng/6b61f1357f2f5a4a211c0bb4bac3d85c6e85958e0bfd04d0045d6c83e98085b7.png', img: 'https://zysc.fjptzykj.com:3000/shangcheng/7553f1ef8dd48b2fce3fc3a56eb40fe04a6099fe7744f26b5e2481050ab940e7.png',
title: '推广商品', title: '推广商品',
path: '/pages/commission/goods', path: '/pages/commission/goods',
}, },
{ {
img: 'https://zysc.fjptzykj.com:3000/shangcheng/e488e0f84bd4da1edfe75ccfbcc16acf8c60073409f03406bb350573b43769a8.png', img: 'https://zysc.fjptzykj.com:3000/shangcheng/59061d8cd61d6488f5ec24eb4e04b09308862c54cbde8e5e38d58cb38a0098d9.png',
title: '推广排行', title: '推广排行',
path: '/pages/commission/promoter', path: '/pages/commission/promoter',
}, },
{ {
img: 'https://zysc.fjptzykj.com:3000/shangcheng/28d6bf4595172ed0a1cdc693483eef018f7f1242be35106bb12ce3ca21940753.png', img: 'https://zysc.fjptzykj.com:3000/shangcheng/4207ccd490ee40e80c21a6bdf6df62cc89b20cf36cf26fed1559704b7e61b131.png',
title: '佣金排行', title: '佣金排行',
path: '/pages/commission/commission-ranking', path: '/pages/commission/commission-ranking',
}, },
@ -120,27 +120,30 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.new-menu { .new-menu {
width: 100%; margin:0 15px;
background: white; background: white;
margin-top:10px;
border-radius: 18px;
padding:25px 0;
padding-bottom:0;
.new-menu-list { .new-menu-list {
display: flex; // display: flex;
flex-wrap: wrap; // flex-wrap: wrap;
align-items: center; // align-items: center;
padding: 0 20px; // padding: 0 20px;
.new-menu-item { .new-menu-item {
float: left;
width: 50%;
// margin-bottom:19px;
display: flex; display: flex;
flex-wrap: wrap; justify-content: center;
width: 100%;
align-items: center;
justify-content: space-between;
margin-bottom:19px;
.l { .l {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
width: 50%; margin-bottom: 25px;
// width: 50%;
.menu-icon{ .menu-icon{
margin-right: 10px; margin-right: 10px;
} }
@ -208,8 +211,8 @@
} }
.menu-icon { .menu-icon {
width: 45rpx; width: 35px;
height: 45rpx; height: 35px;
background: #ffffff; background: #ffffff;
border-radius: 50%; border-radius: 50%;
} }

View File

@ -78,11 +78,12 @@
// TODO // TODO
function onShareGoods(goodsInfo) { function onShareGoods(goodsInfo) {
console.log(goodsInfo,"/pages/index/cart")
state.shareInfo = $share.getShareInfo( state.shareInfo = $share.getShareInfo(
{ {
title: goodsInfo.title, title: goodsInfo.name,
image: sheep.$url.cdn(goodsInfo.image), image: sheep.$url.cdn(goodsInfo.picUrl),
desc: goodsInfo.subtitle, desc: goodsInfo.introduction,
params: { params: {
page: '2', page: '2',
query: goodsInfo.id, query: goodsInfo.id,
@ -90,10 +91,10 @@
}, },
{ {
type: 'goods', // type: 'goods', //
title: goodsInfo.title, // title: goodsInfo.name, //
image: sheep.$url.cdn(goodsInfo.image), // image: sheep.$url.cdn(goodsInfo.picUrl), //
price: goodsInfo.price[0], // price: fen2yuan(goodsInfo.price), //
original_price: goodsInfo.original_price, // marketPrice: fen2yuan(goodsInfo.marketPrice), //
}, },
); );
showShareModal(); showShareModal();

View File

@ -13,7 +13,7 @@
<!-- 账户信息 --> <!-- 账户信息 -->
<!-- <account-info /> --> <!-- <account-info /> -->
<!-- 菜单栏 --> <!-- 菜单栏 -->
<commission-menu /> <!-- <commission-menu /> -->
<!-- 分销记录 --> <!-- 分销记录 -->
<!-- <commission-log /> --> <!-- <commission-log /> -->

View File

@ -97,7 +97,7 @@
list: [], list: [],
total: 0, total: 0,
pageNo: 1, pageNo: 1,
pageSize: 1, pageSize: 8,
}, },
}); });
@ -128,7 +128,7 @@
state.loadStatus = 'loading'; state.loadStatus = 'loading';
let { code, data } = await BrokerageApi.getBrokerageRecordPage({ let { code, data } = await BrokerageApi.getBrokerageRecordPage({
pageSize: state.pagination.pageSize, pageSize: state.pagination.pageSize,
pageNo: state.pagination.pageSize, pageNo: state.pagination.pageNo,
bizType: 1, // 广 bizType: 1, // 广
status: state.currentTab > 0 ? state.currentTab : undefined, status: state.currentTab > 0 ? state.currentTab : undefined,
}); });

View File

@ -150,7 +150,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'; import _ 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/util'; import { resetPagination } from '@/sheep/util';
@ -168,7 +168,7 @@
list: [], list: [],
total: 0, total: 0,
pageNo: 1, pageNo: 1,
pageSize: 1, pageSize: 8,
}, },
loadStatus: '', loadStatus: '',

View File

@ -1,433 +0,0 @@
<template>
<s-layout navbar="normal" :leftWidth="0" :rightWidth="0" >
<!-- 筛选 -->
<!-- <su-sticky bgColor="#fff">
<view class="ss-flex">
<view class="ss-flex-1">
<su-tabs :list="state.tabList" :scrollable="false" @change="onTabsChange"
:current="state.currentTab" />
</view>
<view class="list-icon" @tap="state.iconStatus = !state.iconStatus">
<text v-if="state.iconStatus" class="sicon-goods-list" />
<text v-else class="sicon-goods-card" />
</view>
</view>
</su-sticky> -->
<su-swiper
:list="state.data"
imageMode="scaleToFill"
/>
<view class="title">
<text v-if="state.name == 'recommendBest'">精品推荐</text>
<text v-if="state.name == 'recommendHot'">热门榜单</text>
<text v-if="state.name == 'recommendNew'">新品首发</text>
<text v-if="state.name == 'recommendGood'">促销单品</text>
</view>
<!-- 弹窗 -->
<su-popup :show="state.showFilter" type="top" round="10" :space="sys_navBar + 38" backgroundColor="#F6F6F6"
:zIndex="10" @close="state.showFilter = false">
<view class="filter-list-box">
<view class="filter-item" v-for="(item, index) in state.tabList[state.currentTab].list"
:key="item.value" :class="[{ 'filter-item-active': index === state.curFilter }]"
@tap="onFilterItem(index)">
{{ item.label }}
</view>
</view>
</su-popup>
<!-- 情况一单列布局 -->
<view class="goods-list ss-m-t-20">
<view class="ss-p-l-20 ss-p-r-20 ss-m-b-20" v-for="item in state.pagination.list" :key="item.id">
<s-goods-column class="" size="lg" :data="item" :topRadius="10" :bottomRadius="10"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })" />
</view>
</view>
<!-- 情况二双列布局 -->
<!-- <view v-if="!state.iconStatus && state.pagination.total > 0"
class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top">
<view class="goods-list-box">
<view class="left-list" v-for="item in state.leftGoodsList" :key="item.id">
<s-goods-column class="goods-md-box" size="md" :data="item" :topRadius="10" :bottomRadius="10"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
@getHeight="mountMasonry($event, 'left')">
<template v-slot:cart>
<button class="ss-reset-button cart-btn" />
</template>
</s-goods-column>
</view>
</view>
<view class="goods-list-box">
<view class="right-list" v-for="item in state.rightGoodsList" :key="item.id">
<s-goods-column class="goods-md-box" size="md" :topRadius="10" :bottomRadius="10" :data="item"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
@getHeight="mountMasonry($event, 'right')">
<template v-slot:cart>
<button class="ss-reset-button cart-btn" />
</template>
</s-goods-column>
</view>
</view>
</view> -->
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
}" @tap="loadMore" />
<!-- <s-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无商品" /> -->
</s-layout>
</template>
<script setup>
import request from '@/sheep/request';
import {
baseUrl,
apiPath
} from '@/sheep/config';
import {
reactive
} from 'vue';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import _ from 'lodash';
import {
resetPagination
} from '@/sheep/util';
import SpuApi from '@/sheep/api/product/spu';
const sys_navBar = sheep.$platform.navbar;
const emits = defineEmits(['close', 'change']);
const state = reactive({
data:[
{
// src:'https://zysc.fjptzykj.com:3000/shangcheng/38f95116a77c4927d9fb3bb2cb3744161481c349e12005eebf78b21e84b6e379.png'
}
],
name:'',
pagination: {
list: [],
total: 0,
pageNo: 1,
pageSize: 6,
},
currentSort: undefined,
currentOrder: undefined,
currentTab: 0, // tab
curFilter: 0, // list
showFilter: false,
iconStatus: false, // true - false -
keyword: '',
categoryId: 0,
tabList: [{
name: '综合推荐',
list: [{
label: '综合推荐',
},
{
label: '价格升序',
sort: 'price',
order: true,
},
{
label: '价格降序',
sort: 'price',
order: false,
},
],
},
{
name: '销量',
sort: 'salesCount',
order: false,
},
{
name: '新品优先',
value: 'createTime',
order: false,
},
],
loadStatus: '',
leftGoodsList: [], // -
rightGoodsList: [], // -
});
//
let count = 0;
let leftHeight = 0;
let rightHeight = 0;
// leftGoodsList + rightGoodsList
function mountMasonry(height = 0, where = 'left') {
if (!state.pagination.list[count]) {
return;
}
if (where === 'left') {
leftHeight += height;
} else {
rightHeight += height;
}
if (leftHeight <= rightHeight) {
state.leftGoodsList.push(state.pagination.list[count]);
} else {
state.rightGoodsList.push(state.pagination.list[count]);
}
count++;
}
//
function emptyList() {
resetPagination(state.pagination);
state.leftGoodsList = [];
state.rightGoodsList = [];
count = 0;
leftHeight = 0;
rightHeight = 0;
}
//
function onSearch(e) {
state.keyword = e;
emptyList();
getList(state.currentSort, state.currentOrder);
}
//
function onTabsChange(e) {
//
if (state.tabList[e.index].list) {
state.currentTab = e.index;
state.showFilter = !state.showFilter;
return;
}
state.showFilter = false;
// tab
if (e.index === state.currentTab) {
return;
}
state.currentTab = e.index;
state.currentSort = e.sort;
state.currentOrder = e.order;
emptyList();
getList(e.sort, e.order);
}
// tab list
const onFilterItem = (val) => {
//
// tabList[0] list
if (
state.currentSort === state.tabList[0].list[val].sort &&
state.currentOrder === state.tabList[0].list[val].order
) {
state.showFilter = false;
return;
}
state.showFilter = false;
//
state.curFilter = val;
state.tabList[0].name = state.tabList[0].list[val].label;
state.currentSort = state.tabList[0].list[val].sort;
state.currentOrder = state.tabList[0].list[val].order;
// +
emptyList();
getList();
};
async function getList() {
state.loadStatus = 'loading';
const {
code,
data
} = await SpuApi.getSpusales({
pageNo: state.pagination.pageNo,
pageSize: state.pagination.pageSize,
sortField: state.currentSort,
sortAsc: state.currentOrder,
categoryId: state.categoryId,
keyword: state.keyword,
recommendBenefit:1
});
if (code !== 0) {
return;
}
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';
mountMasonry();
}
//
function loadMore() {
if (state.loadStatus === 'noMore') {
return;
}
state.pagination.pageNo++;
getList(state.currentSort, state.currentOrder);
}
//
const getSpu = async (id) => {
const data = await SpuApi.getSpusales({recommendBenefit:1});
console.log(data, "我要留了")
};
//
function classValue(val) {
state.isShow = val;
request({
url: `${baseUrl}${apiPath}/product/spu/getActivityGoods`,
method: 'GET',
params: {
// projectdayId: this.brandId4,
// technicianId: this.brandId3
activityType:val
},
custom: {
showLoading: false,
},
}).then((res) => {
//
state.pagination.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';
});
}
onLoad((options) => {
state.categoryId = options.categoryId;
state.keyword = options.keyword;
state.name = options.activityType
classValue(options.activityType)
// getList(state.currentSort, state.currentOrder);
});
//
onReachBottom(() => {
loadMore();
});
</script>
<style lang="scss" scoped>
.title{
text-align: center;
padding: 10px 0;
position: relative;
&:after {
position: absolute;
content:'';
top: 50%;
left: 98px;
width: 100px;
height:2px;
background:#dadada;
transform: translateX(-50%);
}
&:before {
position: absolute;
content:'';
height:2px;
top: 50%;
right: 0;
width: 100px;
background:#dadada;
transform: translateX(-50%);
}
}
.goods-list-box {
width: 50%;
box-sizing: border-box;
.left-list {
margin-right: 10rpx;
margin-bottom: 20rpx;
}
.right-list {
margin-left: 10rpx;
margin-bottom: 20rpx;
}
}
.goods-box {
&:nth-last-of-type(1) {
margin-bottom: 0 !important;
}
&:nth-child(2n) {
margin-right: 0;
}
}
.list-icon {
width: 80rpx;
.sicon-goods-card {
font-size: 40rpx;
}
.sicon-goods-list {
font-size: 40rpx;
}
}
.goods-card {
margin-left: 20rpx;
}
.list-filter-tabs {
background-color: #fff;
}
.filter-list-box {
padding: 28rpx 52rpx;
.filter-item {
font-size: 28rpx;
font-weight: 500;
color: #333333;
line-height: normal;
margin-bottom: 24rpx;
&:nth-last-child(1) {
margin-bottom: 0;
}
}
.filter-item-active {
color: var(--ui-BG-Main);
}
}
.tab-item {
height: 50px;
position: relative;
z-index: 11;
.tab-title {
font-size: 30rpx;
}
.cur-tab-title {
font-weight: $font-weight-bold;
}
.tab-line {
width: 60rpx;
height: 6rpx;
border-radius: 6rpx;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 10rpx;
background-color: var(--ui-BG-Main);
z-index: 12;
}
}
</style>

View File

@ -201,23 +201,27 @@
}); });
} }
// TODO // TODO
const shareInfo = computed(() => { const shareInfo = computed(() => {
// if (isEmpty(activity)) return {}; if (isEmpty(state.goodsInfo)) return {};
// return sheep.$platform.share.getShareInfo({ return sheep.$platform.share.getShareInfo(
// title: activity.value.name, {
// image: sheep.$url.cdn(state.goodsInfo.picUrl), title: state.goodsInfo.name,
// params: { image: sheep.$url.cdn(state.goodsInfo.picUrl),
// page: '4', desc: state.goodsInfo.introduction,
// query: activity.value.id, params: {
// }, page: '2',
// }, { query: state.goodsInfo.id,
// type: 'goods', // },
// title: activity.value.name, // },
// image: sheep.$url.cdn(state.goodsInfo.picUrl), // {
// price: state.goodsInfo.price, // type: 'goods', //
// marketPrice: state.goodsInfo.marketPrice, // title: state.goodsInfo.name, //
// }, ); image: sheep.$url.cdn(state.goodsInfo.picUrl), //
price: fen2yuan(state.goodsInfo.price), //
original_price: fen2yuan(state.goodsInfo.marketPrice), //
},
);
}); });
const activity = ref(); const activity = ref();

View File

@ -1,7 +1,7 @@
<!-- 收银台 --> <!-- 收银台 -->
<template> <template>
<s-layout title="收银台"> <s-layout title="收银台">
<view class="bg-white ss-modal-box ss-flex-col"> <view class=" ss-modal-box ss-flex-col">
<!-- 订单信息 --> <!-- 订单信息 -->
<view class="modal-header ss-flex-col ss-col-center ss-row-center"> <view class="modal-header ss-flex-col ss-col-center ss-row-center">
<view class="money-box ss-m-b-20"> <view class="money-box ss-m-b-20">
@ -14,22 +14,31 @@
<!-- 支付方式 --> <!-- 支付方式 -->
<view class="modal-content ss-flex-1"> <view class="modal-content ss-flex-1">
<view class="pay-title ss-p-l-30 ss-m-y-30">选择支付方式</view> <view class="pay-title ss-p-l-30 " style="margin-top: 15px;">支付方式</view>
<radio-group @change="onTapPay"> <radio-group @change="onTapPay">
<label class="pay-type-item" v-for="item in state.payMethods" :key="item.title"> <label class="pay-type-item" v-for="item in state.payMethods" :key="item.title">
<view class="pay-item ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom" <view class="pay-item ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom"
:class="{ 'disabled-pay-item': item.disabled }"> :class="{ 'disabled-pay-item': item.disabled }"
<view class="ss-flex ss-col-center"> v-if="!item.disabled">
<image class="pay-icon" v-if="item.disabled" <view class="ss-flex ss-col-center ggbon">
:src="sheep.$url.static('/static/img/shop/pay/cod_disabled.png')" <image class="pay-icon"
v-if="item.value == 'wechat'"
src="https://zysc.fjptzykj.com:3000/shangcheng/f7abe1733a9f4377b85e5c289ac7925f88f3804e563695346549e08ae6086542.png"
mode="aspectFit" /> mode="aspectFit" />
<image class="pay-icon" v-else :src="sheep.$url.static(item.icon)" mode="aspectFit" /> <image class="pay-icon"
<text class="pay-title">{{ item.title }}</text> v-if="item.value == 'wallet'"
src="https://zysc.fjptzykj.com:3000/shangcheng/0d7fbb299d587542189b204bcfd32e313340c0c956a8187884f7e544b2cad4ae.png"
mode="aspectFit" />
<view class="new-class">
<view class="pay-title">{{ item.title }}</view>
<view class="userInfo-money" v-if="item.value == 'wechat'">使用微信快捷支付</view>
<view class="userInfo-money ss-m-r-10" v-if="item.value === 'wallet'">
可用余额<text class="b">{{ fen2yuan(userWallet.balance) }}</text>
</view>
</view>
</view> </view>
<view class="check-box ss-flex ss-col-center ss-p-l-10"> <view class="check-box ss-flex ss-col-center ss-p-l-10">
<view class="userInfo-money ss-m-r-10" v-if="item.value === 'wallet'">
余额: {{ fen2yuan(userWallet.balance) }}
</view>
<radio :value="item.value" color="var(--ui-BG-Main)" style="transform: scale(0.8)" <radio :value="item.value" color="var(--ui-BG-Main)" style="transform: scale(0.8)"
:disabled="item.disabled" :checked="state.payment === item.value" /> :disabled="item.disabled" :checked="state.payment === item.value" />
</view> </view>
@ -48,7 +57,7 @@
</button> </button>
<button v-else class="ss-reset-button save-btn" @tap="onPay" :disabled="state.payStatus !== 1" <button v-else class="ss-reset-button save-btn" @tap="onPay" :disabled="state.payStatus !== 1"
:class="{ 'disabled-btn': state.payStatus !== 1 }"> :class="{ 'disabled-btn': state.payStatus !== 1 }">
立即支付 确定支付
</button> </button>
</view> </view>
</view> </view>
@ -207,6 +216,7 @@
return; return;
} }
state.payMethods = getPayMethods(data); state.payMethods = getPayMethods(data);
console.log(state.payMethods,"state.payMethods")
} }
onLoad((options) => { onLoad((options) => {
@ -235,8 +245,8 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.pay-icon { .pay-icon {
width: 36rpx; width: 27px;
height: 36rpx; height: 27px;
margin-right: 26rpx; margin-right: 26rpx;
} }
@ -248,7 +258,7 @@
padding: 60rpx 20rpx 40rpx; padding: 60rpx 20rpx 40rpx;
.money-text { .money-text {
color: $red; color: rgba(210, 79, 62);
font-size: 46rpx; font-size: 46rpx;
font-weight: bold; font-weight: bold;
font-family: OPPOSANS; font-family: OPPOSANS;
@ -261,7 +271,10 @@
.time-text { .time-text {
font-size: 26rpx; font-size: 26rpx;
color: $gray-b; color: rgba(210, 79, 62);
background: white;
border-radius: 13px;
padding:5px 15px;
} }
.close-icon { .close-icon {
@ -275,11 +288,13 @@
.modal-content { .modal-content {
overflow-y: auto; overflow-y: auto;
margin:0 12px;
background:white;
border-radius:8px;
.pay-title { .pay-title {
font-size: 26rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: rgba(157,157,157);
} }
.pay-tip { .pay-tip {
@ -288,7 +303,16 @@
} }
.pay-item { .pay-item {
height: 86rpx; height: 58px;
padding:10px 10px;
.ggbon{
.new-class{
.pay-title{
font-size:16px;
color:black;
}
}
}
} }
.disabled-pay-item { .disabled-pay-item {
@ -301,6 +325,10 @@
font-size: 26rpx; font-size: 26rpx;
color: #bbbbbb; color: #bbbbbb;
line-height: normal; line-height: normal;
.b{
margin-left:10px;
color:rgba(230,205,154);
}
} }
} }
@ -308,7 +336,8 @@
width: 710rpx; width: 710rpx;
height: 80rpx; height: 80rpx;
border-radius: 40rpx; border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); // background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
background: rgba(210, 79, 62);
color: $white; color: $white;
} }

View File

@ -11,10 +11,10 @@
{{ item.areaName }}{{ ', ' + item.detailAddress }} {{ item.areaName }}{{ ', ' + item.detailAddress }}
</view> </view>
<view class="store-address line1"> <view class="store-address line1">
营业时间{{item.openingTime[0] + ":" + item.openingTime[1]}}-{{item.closingTime[0] + ":" + item.closingTime[1]}} 营业时间{{item?.openingTime[0] + ":" + item?.openingTime[1]}}-{{item?.closingTime[0] + ":" + item?.closingTime[1]}}
</view> </view>
<view class="status" v-if="item.stat == 0">未营业</view> <view class="status" v-if="item?.stat == 0">未营业</view>
<view class="status" v-if="item.stat == 1">营业中</view> <view class="status" v-if="item?.stat == 1">营业中</view>
</view> </view>
<view class="row-right ss-flex-col ss-col-center"> <view class="row-right ss-flex-col ss-col-center">
<view> <view>
@ -209,11 +209,15 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.status { .status {
background: rgba(214, 81, 42); background: rgba(214, 81, 42);
width: 56px; width: 40px;
text-align: center; text-align: center;
color: white; color: white;
border-radius: 3px; border-radius: 3px;
margin-top: 10px; margin-top: 5px;
font-size: 20rpx;
display:flex;
align-items:center;
justify-content:center;
} }
.line1 { .line1 {
@ -256,14 +260,14 @@
.store-cent-left { .store-cent-left {
// width: 177px; // width: 177px;
flex: 1; flex: 1;
max-width: 185px; max-width: 156px;
position: relative; position: relative;
padding-right: 10px; padding-right: 10px;
&::after { &::after {
position: absolute; position: absolute;
content: ''; content: '';
width: 2px; width: 1px;
height: 100%; height: 100%;
background: rgba(223, 223, 223); background: rgba(223, 223, 223);
right: 0; right: 0;
@ -274,21 +278,22 @@
.store-img { .store-img {
// flex: 1; // flex: 1;
width: 120rpx; width: 60px;
height: 120rpx; height: 60px;
border-radius: 6rpx; border-radius: 6rpx;
margin-right: 22rpx; margin-right: 22rpx;
} }
.store-img .img { .store-img .img {
width: 100%; width: 60px;
height: 100%; height: 60px;
border-radius: 31px;
} }
.store-name { .store-name {
color: #282828; color: #282828;
font-size: 30rpx; font-size: 26rpx;
margin-bottom: 22rpx; margin-bottom: 5px;
font-weight: 800; font-weight: 800;
} }
@ -338,8 +343,8 @@
} }
.row-right { .row-right {
flex: 1; // flex: 1;
margin-left:10px; margin-left: 10px;
//display: flex; //display: flex;
//flex-direction: column; //flex-direction: column;
//align-items: flex-end; //align-items: flex-end;

View File

@ -12,7 +12,7 @@
<view class="text acea-row row-middle"> <view class="text acea-row row-middle">
<view class="name line1"> <view class="name line1">
<!-- {{ userInfo.nickname }} --> <!-- {{ userInfo.nickname }} -->
ai豆 {{userInfo.nickname}}
</view> </view>
<!-- <view class="vip" v-if='userInfo.level'> --> <!-- <view class="vip" v-if='userInfo.level'> -->
<view class="vip"> <view class="vip">
@ -20,7 +20,7 @@
<!-- {{ userInfo.level.name }} --> <!-- {{ userInfo.level.name }} -->
白金会员 {{userInfo.level.name}}
</view> </view>
</view> </view>
</view> </view>
@ -29,7 +29,7 @@
<zmxy-slideshow :items="levelList" :autoplay="false"></zmxy-slideshow> <zmxy-slideshow :items="levelList" :autoplay="false"></zmxy-slideshow>
<!-- TODO --> <!-- TODO -->
<view class="experience"> <view class="experience">
<view class="title">当前经验值</view> <view class="title">当前经验值:{{userInfo.experience}}</view>
<view class="num"> <view class="num">
<!-- {{ userInfo.experience }} --> <!-- {{ userInfo.experience }} -->
</view> </view>
@ -133,7 +133,7 @@
<view class="info line1">购买商品可获得对应是经验值</view> <view class="info line1">购买商品可获得对应是经验值</view>
</view> </view>
</view> </view>
<navigator url="/pages/index/category" class="button" hover-class="none">去获取</navigator> <!-- <navigator class="button" hover-class="none" open-type='switchTab'>去获取</navigator> -->
</view> </view>
</view> </view>
</view> </view>
@ -174,6 +174,10 @@
</template> </template>
<script setup> <script setup>
import {
computed
} from 'vue';
import sheep from '@/sheep';
import { import {
ref, ref,
reactive, reactive,
@ -184,6 +188,8 @@
mapGetters mapGetters
} from "vuex"; } from "vuex";
import getExper from '@/sheep/api/member/level'; import getExper from '@/sheep/api/member/level';
const userInfo = computed(() => sheep.$store('user').userInfo);
console.log(userInfo.value,"isLoginisLogin")
// import dayjs from './dayjs/dayjs.min.js'; // import dayjs from './dayjs/dayjs.min.js';
// const store = useStore(); // const store = useStore();

View File

@ -2,7 +2,9 @@ import sheep from '@/sheep';
// #ifdef H5 // #ifdef H5
import $wxsdk from '@/sheep/libs/sdk-h5-weixin'; import $wxsdk from '@/sheep/libs/sdk-h5-weixin';
// #endif // #endif
import { getRootUrl } from '@/sheep/helper'; import {
getRootUrl
} from '@/sheep/helper';
import PayOrderApi from '@/sheep/api/pay/order'; import PayOrderApi from '@/sheep/api/pay/order';
/** /**
@ -122,7 +124,10 @@ export default class SheepPay {
// #ifdef H5 // #ifdef H5
// 微信公众号 JSSDK 支付 // 微信公众号 JSSDK 支付
async wechatOfficialAccountPay() { async wechatOfficialAccountPay() {
let { code, data } = await this.prepay('wx_pub'); let {
code,
data
} = await this.prepay('wx_pub');
if (code !== 0) { if (code !== 0) {
return; return;
} }
@ -148,7 +153,10 @@ export default class SheepPay {
// 浏览器微信 H5 支付 TODO 芋艿:待接入 // 浏览器微信 H5 支付 TODO 芋艿:待接入
async wechatWapPay() { async wechatWapPay() {
const { error, data } = await this.prepay(); const {
error,
data
} = await this.prepay();
if (error === 0) { if (error === 0) {
const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${ const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${
this.payment this.payment
@ -159,7 +167,10 @@ export default class SheepPay {
// 支付链接 TODO 芋艿:待接入 // 支付链接 TODO 芋艿:待接入
async redirectPay() { async redirectPay() {
let { error, data } = await this.prepay(); let {
error,
data
} = await this.prepay();
if (error === 0) { if (error === 0) {
const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${ const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${
this.payment this.payment
@ -173,7 +184,10 @@ export default class SheepPay {
// 微信小程序支付 // 微信小程序支付
async wechatMiniProgramPay() { async wechatMiniProgramPay() {
// let that = this; // let that = this;
let { code, data } = await this.prepay('wx_lite'); let {
code,
data
} = await this.prepay('wx_lite');
if (code !== 0) { if (code !== 0) {
return; return;
} }
@ -201,20 +215,27 @@ export default class SheepPay {
// 余额支付 // 余额支付
async walletPay() { async walletPay() {
const { code } = await this.prepay('wallet'); const {
code
} = await this.prepay('wallet');
code === 0 && this.payResult('success'); code === 0 && this.payResult('success');
} }
// 模拟支付 // 模拟支付
async mockPay() { async mockPay() {
const { code } = await this.prepay('mock'); const {
code
} = await this.prepay('mock');
code === 0 && this.payResult('success'); code === 0 && this.payResult('success');
} }
// 支付宝复制链接支付 TODO 芋艿:待接入 // 支付宝复制链接支付 TODO 芋艿:待接入
async copyPayLink() { async copyPayLink() {
let that = this; let that = this;
let { error, data } = await this.prepay(); let {
error,
data
} = await this.prepay();
if (error === 0) { if (error === 0) {
// 引入showModal 点击确认 复制链接; // 引入showModal 点击确认 复制链接;
uni.showModal({ uni.showModal({
@ -233,7 +254,10 @@ export default class SheepPay {
// 支付宝支付 TODO 芋艿:待接入 // 支付宝支付 TODO 芋艿:待接入
async alipay() { async alipay() {
let that = this; let that = this;
const { error, data } = await this.prepay(); const {
error,
data
} = await this.prepay();
if (error === 0) { if (error === 0) {
uni.requestPayment({ uni.requestPayment({
provider: 'alipay', provider: 'alipay',
@ -255,7 +279,10 @@ export default class SheepPay {
// 微信支付 TODO 芋艿:待接入 // 微信支付 TODO 芋艿:待接入
async wechatAppPay() { async wechatAppPay() {
let that = this; let that = this;
let { error, data } = await this.prepay(); let {
error,
data
} = await this.prepay();
if (error === 0) { if (error === 0) {
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', provider: 'wxpay',
@ -284,7 +311,7 @@ export default class SheepPay {
uni.showModal({ uni.showModal({
title: '微信支付', title: '微信支付',
content: '请先绑定微信再使用微信支付', content: '请先绑定微信再使用微信支付',
success: function (res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
sheep.$platform.useProvider('wechat').bind(); sheep.$platform.useProvider('wechat').bind();
} }
@ -294,37 +321,37 @@ export default class SheepPay {
} }
export function getPayMethods(channels) { export function getPayMethods(channels) {
const payMethods = [ const payMethods = [{
{
icon: '/static/img/shop/pay/wechat.png', icon: '/static/img/shop/pay/wechat.png',
title: '微信支付', title: '微信支付',
value: 'wechat', value: 'wechat',
disabled: true, disabled: true,
}, },
{
icon: '/static/img/shop/pay/alipay.png',
title: '支付宝支付',
value: 'alipay',
disabled: true,
},
{ {
icon: '/static/img/shop/pay/wallet.png', icon: '/static/img/shop/pay/wallet.png',
title: '余额支付', title: '余额支付',
value: 'wallet', value: 'wallet',
disabled: true, disabled: true,
}, },
{ // {
icon: '/static/img/shop/pay/apple.png', // icon: '/static/img/shop/pay/alipay.png',
title: 'Apple Pay', // title: '支付宝支付',
value: 'apple', // value: 'alipay',
disabled: true, // disabled: true,
}, // },
{
icon: '/static/img/shop/pay/wallet.png', // {
title: '模拟支付', // icon: '/static/img/shop/pay/apple.png',
value: 'mock', // title: 'Apple Pay',
disabled: true, // value: 'apple',
}, // disabled: true,
// },
// {
// icon: '/static/img/shop/pay/wallet.png',
// title: '模拟支付',
// value: 'mock',
// disabled: true,
// },
]; ];
const platform = sheep.$platform.name; const platform = sheep.$platform.name;
@ -338,26 +365,26 @@ export function getPayMethods(channels) {
wechatMethod.disabled = false; wechatMethod.disabled = false;
} }
wechatMethod.disabled = false; // TODO 芋艿:临时测试 wechatMethod.disabled = false; // TODO 芋艿:临时测试
// 2. 处理【支付宝支付】
const alipayMethod = payMethods[1];
if (
(platform === 'WechatOfficialAccount' && channels.includes('alipay_wap')) ||
(platform === 'WechatMiniProgram' && channels.includes('alipay_wap')) ||
(platform === 'App' && channels.includes('alipay_app'))
) {
alipayMethod.disabled = false;
}
// 3. 处理【余额支付】 // 3. 处理【余额支付】
const walletMethod = payMethods[2]; const walletMethod = payMethods[1];
if (channels.includes('wallet')) { if (channels.includes('wallet')) {
walletMethod.disabled = false; walletMethod.disabled = false;
} }
// 4. 处理【苹果支付】TODO 芋艿:未来接入 // // 2. 处理【支付宝支付】
// 5. 处理【模拟支付】 // const alipayMethod = payMethods[1];
const mockMethod = payMethods[4]; // if (
if (channels.includes('mock')) { // (platform === 'WechatOfficialAccount' && channels.includes('alipay_wap')) ||
mockMethod.disabled = false; // (platform === 'WechatMiniProgram' && channels.includes('alipay_wap')) ||
} // (platform === 'App' && channels.includes('alipay_app'))
// ) {
// alipayMethod.disabled = false;
// }
// // 4. 处理【苹果支付】TODO 芋艿:未来接入
// // 5. 处理【模拟支付】
// const mockMethod = payMethods[4];
// if (channels.includes('mock')) {
// mockMethod.disabled = false;
// }
return payMethods; return payMethods;
} }