Branch_ccc #10
11
pages.json
11
pages.json
@ -240,17 +240,6 @@
|
||||
"group": "商品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "sales",
|
||||
"style": {
|
||||
"navigationBarTitleText": "促销商品"
|
||||
},
|
||||
"meta": {
|
||||
"sync": true,
|
||||
"title": "促销商品",
|
||||
"group": "商品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "list",
|
||||
"style": {
|
||||
|
@ -18,7 +18,7 @@
|
||||
>
|
||||
<template #top>
|
||||
<!-- 撑一下顶部导航 -->
|
||||
<view style="height: 45px"></view>
|
||||
<view :style="{height:hei+'px'}"></view>
|
||||
</template>
|
||||
<!-- style="transform: scaleY(-1)"必须写,否则会导致列表倒置!!! -->
|
||||
<!-- 注意不要直接在chat-item组件标签上设置style,因为在微信小程序中是无效的,请包一层view -->
|
||||
@ -48,7 +48,12 @@
|
||||
import { reactive, ref } from 'vue';
|
||||
import KeFuApi from '@/sheep/api/promotion/kefu';
|
||||
import { isEmpty } from '@/sheep/helper/utils';
|
||||
|
||||
const props = defineProps({
|
||||
hei: {
|
||||
type: [Object, String, Number],
|
||||
default() {},
|
||||
},
|
||||
});
|
||||
const messageList = ref([]); // 消息列表
|
||||
const showNewMessageTip = ref(false); // 显示有新消息提示
|
||||
const backToTopStyle = reactive({
|
||||
|
@ -93,7 +93,7 @@
|
||||
class="chat-avatar ss-m-l-24"
|
||||
:src="
|
||||
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"
|
||||
>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<!-- 覆盖头部导航栏背景颜色 -->
|
||||
<div class="page-bg" :style="{ height: sys_navBar + 'px' }"></div>
|
||||
<!-- 聊天区域 -->
|
||||
<MessageList ref="messageListRef">
|
||||
<MessageList ref="messageListRef" :hei="sys_navBar">
|
||||
<template #bottom>
|
||||
<message-input
|
||||
v-model="chat.msg"
|
||||
@ -179,7 +179,9 @@
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.chat-wrap {
|
||||
|
||||
.page-bg {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
|
File diff suppressed because one or more lines are too long
@ -2,32 +2,71 @@
|
||||
<template>
|
||||
<view class="new-main">
|
||||
<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="ss-flex ss-row-between card-box-header">
|
||||
<!--<view class="ss-flex ss-row-between card-box-header">
|
||||
<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">
|
||||
<uni-icons :type="state.showMoney ? 'eye-filled' : 'eye-slash-filled'" color="#A57A55"
|
||||
size="20" />
|
||||
</button>
|
||||
</view>
|
||||
<view class="ss-flex" @tap="sheep.$router.go('/pages/commission/wallet')">
|
||||
<view class="ss-flex" @tap="sheep.$router.go('/pages/commission/wallet')">
|
||||
<view class="header-title ss-m-r-4">提现记录</view>
|
||||
<text class="cicon-play-arrow" />
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 提现金额 -->
|
||||
<view class="ss-flex new-cont">
|
||||
<view class="new-cont">
|
||||
<view class="ss-flex-1 ss-flex-col ">
|
||||
<view class="item-title">可提现(元)</view>
|
||||
<view class="item-detail">
|
||||
{{ state.showMoney ? fen2yuan(state.brokerageInfo.brokeragePrice) : '***' }}
|
||||
</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')"
|
||||
>
|
||||
立即提现
|
||||
</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>
|
||||
<!-- 收益 -->
|
||||
@ -51,15 +90,24 @@
|
||||
</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>
|
||||
<!-- 菜单栏 -->
|
||||
<commission-menu />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import commissionMenu from './commission-menu.vue';
|
||||
import sheep from '@/sheep';
|
||||
import {
|
||||
computed,
|
||||
@ -75,18 +123,42 @@
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
const state = reactive({
|
||||
showMoney: false,
|
||||
showMoney: true,
|
||||
summary: {},
|
||||
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() {
|
||||
const { data, code } = await BrokerageApi.getBrokerageUser();
|
||||
if (code === 0) {
|
||||
state.brokerageInfo = data;
|
||||
}
|
||||
const {
|
||||
data,
|
||||
code
|
||||
} = await BrokerageApi.getBrokerageUser();
|
||||
if (code === 0) {
|
||||
state.brokerageInfo = data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -101,49 +173,138 @@
|
||||
}
|
||||
});
|
||||
onBeforeMount(() => {
|
||||
getBrokerageUser();
|
||||
getBrokerageUser();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.new-main{
|
||||
width: 100%;
|
||||
.menu-icon-you {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
.account-card {
|
||||
width: 694rpx;
|
||||
|
||||
.new-btn {
|
||||
width: 85%;
|
||||
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;
|
||||
// background: linear-gradient(180deg, #ffffff 0.88%, #fff9ec 100%);
|
||||
border-radius: 12rpx 12rpx 0 0;
|
||||
// border-radius: 12rpx 12rpx 0 0;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
background: url('https://zysc.fjptzykj.com:3000/shangcheng/423af1ff70d4e80ca7bd4ede17b9fe63800aaffd2e4e8b5b7584ab5bf5884996.png') no-repeat;
|
||||
background-size: cover;
|
||||
|
||||
|
||||
background: url('https://zysc.fjptzykj.com:3000/shangcheng/cbbe23772e68ed5fc5c18d193f9f674d6e87ccddd422e0df6af6cab5dfea6c27.png') no-repeat;
|
||||
background-size: 100%;
|
||||
padding-bottom: 25px;
|
||||
border-radius: 18px;
|
||||
|
||||
.account-card-box {
|
||||
|
||||
// background: #ffefd6;
|
||||
.new-cont {
|
||||
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 {
|
||||
background: rgba(178, 102, 67);
|
||||
border-radius: 22px;
|
||||
padding: 8px 0;
|
||||
font-size: 16px;
|
||||
color: white;
|
||||
font-weight:700;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
color: rgba(139, 105, 87, 1);
|
||||
color: rgba(142, 144, 145, 1);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.item-detail {
|
||||
color: rgba(81, 41, 24, 1);
|
||||
font-size: 31px;
|
||||
color: rgba(231, 91, 79, 1);
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,16 +334,16 @@
|
||||
.item-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(139, 105, 87, 1);
|
||||
color: rgba(142, 144, 145, 1);
|
||||
line-height: 30rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.item-detail {
|
||||
font-size: 36rpx;
|
||||
font-size: 20px;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: bold;
|
||||
color: #692e04;
|
||||
color: rgba(80, 80, 80, 1);
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
|
@ -13,41 +13,10 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 账户信息 -->
|
||||
<account-info style="margin: 0 auto;" />
|
||||
</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>
|
||||
<account-info />
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -68,8 +37,6 @@
|
||||
|
||||
const state = reactive({
|
||||
showMoney: false,
|
||||
summary:{},
|
||||
arr:{}
|
||||
});
|
||||
|
||||
async function getAgentInfo() {
|
||||
@ -88,64 +55,15 @@
|
||||
</script>
|
||||
|
||||
<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 {
|
||||
width: 100%;
|
||||
height: 580rpx;
|
||||
// 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:#ff3000;
|
||||
background-size: 100% 100%;
|
||||
|
@ -63,7 +63,7 @@
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
<image class="menu-icon " :src="sheep.$url.static(item.img)" mode="aspectFill"></image>
|
||||
<view>{{ item.title }}</view>
|
||||
</view>
|
||||
<view class="r">
|
||||
<!-- <view class="r">
|
||||
<image class="menu-icon-you" src="@/static/images/dayu.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -41,32 +41,32 @@
|
||||
|
||||
const state = reactive({
|
||||
menuListnew: [{
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/82255ab9cb8fa91b261a1976c81a7c761c34a8aa3d3fc12864b3b83158d22267.png',
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/38fcbd2619cac8f4134efdf6ddf98a098d7ec4920be09c399d3e05b26699cfc3.png',
|
||||
title: '推广名片',
|
||||
path: 'action:showShareModal',
|
||||
},
|
||||
{
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/3aca872c5c25923b883b98364ca7525bcb7d176cf89769bab429fed090c75adb.png',
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/d6fd382e25839128b4231616b5414b09964f998faaed300fd71b093d0545b4c9.png',
|
||||
title: '佣金明细',
|
||||
path: '/pages/commission/wallet',
|
||||
},
|
||||
{
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/512aaaf15aeedc1fd5ad6dc14161d83a4c4ecee33ae2428986c8ecbf0c420fa7.png',
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/fb1773e483bdf5889657ad0c6113327051a337514d5de0bce3d14a744d1f2b0c.png',
|
||||
title: '分销订单',
|
||||
path: '/pages/commission/order',
|
||||
},
|
||||
{
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/6b61f1357f2f5a4a211c0bb4bac3d85c6e85958e0bfd04d0045d6c83e98085b7.png',
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/7553f1ef8dd48b2fce3fc3a56eb40fe04a6099fe7744f26b5e2481050ab940e7.png',
|
||||
title: '推广商品',
|
||||
path: '/pages/commission/goods',
|
||||
},
|
||||
{
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/e488e0f84bd4da1edfe75ccfbcc16acf8c60073409f03406bb350573b43769a8.png',
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/59061d8cd61d6488f5ec24eb4e04b09308862c54cbde8e5e38d58cb38a0098d9.png',
|
||||
title: '推广排行',
|
||||
path: '/pages/commission/promoter',
|
||||
},
|
||||
{
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/28d6bf4595172ed0a1cdc693483eef018f7f1242be35106bb12ce3ca21940753.png',
|
||||
img: 'https://zysc.fjptzykj.com:3000/shangcheng/4207ccd490ee40e80c21a6bdf6df62cc89b20cf36cf26fed1559704b7e61b131.png',
|
||||
title: '佣金排行',
|
||||
path: '/pages/commission/commission-ranking',
|
||||
},
|
||||
@ -120,27 +120,30 @@
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.new-menu {
|
||||
width: 100%;
|
||||
margin:0 15px;
|
||||
background: white;
|
||||
|
||||
margin-top:10px;
|
||||
border-radius: 18px;
|
||||
padding:25px 0;
|
||||
padding-bottom:0;
|
||||
.new-menu-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
// display: flex;
|
||||
// flex-wrap: wrap;
|
||||
// align-items: center;
|
||||
// padding: 0 20px;
|
||||
|
||||
.new-menu-item {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom:19px;
|
||||
float: left;
|
||||
width: 50%;
|
||||
// margin-bottom:19px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
.l {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
width: 50%;
|
||||
margin-bottom: 25px;
|
||||
// width: 50%;
|
||||
.menu-icon{
|
||||
margin-right: 10px;
|
||||
}
|
||||
@ -208,8 +211,8 @@
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
width: 45rpx;
|
||||
height: 45rpx;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
background: #ffffff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
@ -78,11 +78,12 @@
|
||||
|
||||
// TODO 芋艿:分享的接入
|
||||
function onShareGoods(goodsInfo) {
|
||||
console.log(goodsInfo,"/pages/index/cart")
|
||||
state.shareInfo = $share.getShareInfo(
|
||||
{
|
||||
title: goodsInfo.title,
|
||||
image: sheep.$url.cdn(goodsInfo.image),
|
||||
desc: goodsInfo.subtitle,
|
||||
title: goodsInfo.name,
|
||||
image: sheep.$url.cdn(goodsInfo.picUrl),
|
||||
desc: goodsInfo.introduction,
|
||||
params: {
|
||||
page: '2',
|
||||
query: goodsInfo.id,
|
||||
@ -90,10 +91,10 @@
|
||||
},
|
||||
{
|
||||
type: 'goods', // 商品海报
|
||||
title: goodsInfo.title, // 商品标题
|
||||
image: sheep.$url.cdn(goodsInfo.image), // 商品主图
|
||||
price: goodsInfo.price[0], // 商品价格
|
||||
original_price: goodsInfo.original_price, // 商品原价
|
||||
title: goodsInfo.name, // 商品标题
|
||||
image: sheep.$url.cdn(goodsInfo.picUrl), // 商品主图
|
||||
price: fen2yuan(goodsInfo.price), // 商品价格
|
||||
marketPrice: fen2yuan(goodsInfo.marketPrice), // 商品原价
|
||||
},
|
||||
);
|
||||
showShareModal();
|
||||
|
@ -13,7 +13,7 @@
|
||||
<!-- 账户信息 -->
|
||||
<!-- <account-info /> -->
|
||||
<!-- 菜单栏 -->
|
||||
<commission-menu />
|
||||
<!-- <commission-menu /> -->
|
||||
<!-- 分销记录 -->
|
||||
<!-- <commission-log /> -->
|
||||
|
||||
|
@ -97,7 +97,7 @@
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
});
|
||||
|
||||
@ -128,7 +128,7 @@
|
||||
state.loadStatus = 'loading';
|
||||
let { code, data } = await BrokerageApi.getBrokerageRecordPage({
|
||||
pageSize: state.pagination.pageSize,
|
||||
pageNo: state.pagination.pageSize,
|
||||
pageNo: state.pagination.pageNo,
|
||||
bizType: 1, // 获得推广佣金
|
||||
status: state.currentTab > 0 ? state.currentTab : undefined,
|
||||
});
|
||||
|
@ -150,7 +150,7 @@
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import dayjs from 'dayjs';
|
||||
import _ from 'lodash';
|
||||
import _ from 'lodash-es';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { resetPagination } from '@/sheep/util';
|
||||
@ -168,7 +168,7 @@
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
loadStatus: '',
|
||||
|
||||
|
@ -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>
|
@ -201,24 +201,28 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 分享信息 TODO 芋艿:待接入
|
||||
const shareInfo = computed(() => {
|
||||
// if (isEmpty(activity)) return {};
|
||||
// return sheep.$platform.share.getShareInfo({
|
||||
// title: activity.value.name,
|
||||
// image: sheep.$url.cdn(state.goodsInfo.picUrl),
|
||||
// params: {
|
||||
// page: '4',
|
||||
// query: activity.value.id,
|
||||
// },
|
||||
// }, {
|
||||
// type: 'goods', // 商品海报
|
||||
// title: activity.value.name, // 商品标题
|
||||
// image: sheep.$url.cdn(state.goodsInfo.picUrl), // 商品主图
|
||||
// price: state.goodsInfo.price, // 商品价格
|
||||
// marketPrice: state.goodsInfo.marketPrice, // 商品原价
|
||||
// }, );
|
||||
});
|
||||
// TODO 芋艿:待测试
|
||||
const shareInfo = computed(() => {
|
||||
if (isEmpty(state.goodsInfo)) return {};
|
||||
return sheep.$platform.share.getShareInfo(
|
||||
{
|
||||
title: state.goodsInfo.name,
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl),
|
||||
desc: state.goodsInfo.introduction,
|
||||
params: {
|
||||
page: '2',
|
||||
query: state.goodsInfo.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'goods', // 商品海报
|
||||
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 timeStatusEnum = ref('');
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!-- 收银台 -->
|
||||
<template>
|
||||
<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="money-box ss-m-b-20">
|
||||
@ -14,22 +14,31 @@
|
||||
|
||||
<!-- 支付方式 -->
|
||||
<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">
|
||||
<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"
|
||||
:class="{ 'disabled-pay-item': item.disabled }">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<image class="pay-icon" v-if="item.disabled"
|
||||
:src="sheep.$url.static('/static/img/shop/pay/cod_disabled.png')"
|
||||
:class="{ 'disabled-pay-item': item.disabled }"
|
||||
v-if="!item.disabled">
|
||||
<view class="ss-flex ss-col-center ggbon">
|
||||
<image class="pay-icon"
|
||||
v-if="item.value == 'wechat'"
|
||||
src="https://zysc.fjptzykj.com:3000/shangcheng/f7abe1733a9f4377b85e5c289ac7925f88f3804e563695346549e08ae6086542.png"
|
||||
mode="aspectFit" />
|
||||
<image class="pay-icon" v-else :src="sheep.$url.static(item.icon)" mode="aspectFit" />
|
||||
<text class="pay-title">{{ item.title }}</text>
|
||||
<image class="pay-icon"
|
||||
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 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)"
|
||||
:disabled="item.disabled" :checked="state.payment === item.value" />
|
||||
</view>
|
||||
@ -48,7 +57,7 @@
|
||||
</button>
|
||||
<button v-else class="ss-reset-button save-btn" @tap="onPay" :disabled="state.payStatus !== 1"
|
||||
:class="{ 'disabled-btn': state.payStatus !== 1 }">
|
||||
立即支付
|
||||
确定支付
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
@ -207,6 +216,7 @@
|
||||
return;
|
||||
}
|
||||
state.payMethods = getPayMethods(data);
|
||||
console.log(state.payMethods,"state.payMethods")
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
@ -235,8 +245,8 @@
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.pay-icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
|
||||
@ -248,7 +258,7 @@
|
||||
padding: 60rpx 20rpx 40rpx;
|
||||
|
||||
.money-text {
|
||||
color: $red;
|
||||
color: rgba(210, 79, 62);
|
||||
font-size: 46rpx;
|
||||
font-weight: bold;
|
||||
font-family: OPPOSANS;
|
||||
@ -261,7 +271,10 @@
|
||||
|
||||
.time-text {
|
||||
font-size: 26rpx;
|
||||
color: $gray-b;
|
||||
color: rgba(210, 79, 62);
|
||||
background: white;
|
||||
border-radius: 13px;
|
||||
padding:5px 15px;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
@ -275,11 +288,13 @@
|
||||
|
||||
.modal-content {
|
||||
overflow-y: auto;
|
||||
|
||||
margin:0 12px;
|
||||
background:white;
|
||||
border-radius:8px;
|
||||
.pay-title {
|
||||
font-size: 26rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
color: rgba(157,157,157);
|
||||
}
|
||||
|
||||
.pay-tip {
|
||||
@ -288,7 +303,16 @@
|
||||
}
|
||||
|
||||
.pay-item {
|
||||
height: 86rpx;
|
||||
height: 58px;
|
||||
padding:10px 10px;
|
||||
.ggbon{
|
||||
.new-class{
|
||||
.pay-title{
|
||||
font-size:16px;
|
||||
color:black;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.disabled-pay-item {
|
||||
@ -301,6 +325,10 @@
|
||||
font-size: 26rpx;
|
||||
color: #bbbbbb;
|
||||
line-height: normal;
|
||||
.b{
|
||||
margin-left:10px;
|
||||
color:rgba(230,205,154);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,7 +336,8 @@
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
{{ item.areaName }}{{ ', ' + item.detailAddress }}
|
||||
</view>
|
||||
<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 class="status" v-if="item.stat == 0">未营业</view>
|
||||
<view class="status" v-if="item.stat == 1">营业中</view>
|
||||
<view class="status" v-if="item?.stat == 0">未营业</view>
|
||||
<view class="status" v-if="item?.stat == 1">营业中</view>
|
||||
</view>
|
||||
<view class="row-right ss-flex-col ss-col-center">
|
||||
<view>
|
||||
@ -209,11 +209,15 @@
|
||||
<style lang="scss" scoped>
|
||||
.status {
|
||||
background: rgba(214, 81, 42);
|
||||
width: 56px;
|
||||
width: 40px;
|
||||
text-align: center;
|
||||
color: white;
|
||||
border-radius: 3px;
|
||||
margin-top: 10px;
|
||||
margin-top: 5px;
|
||||
font-size: 20rpx;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
}
|
||||
|
||||
.line1 {
|
||||
@ -256,14 +260,14 @@
|
||||
.store-cent-left {
|
||||
// width: 177px;
|
||||
flex: 1;
|
||||
max-width: 185px;
|
||||
max-width: 156px;
|
||||
position: relative;
|
||||
padding-right: 10px;
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
width: 2px;
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
background: rgba(223, 223, 223);
|
||||
right: 0;
|
||||
@ -274,21 +278,22 @@
|
||||
|
||||
.store-img {
|
||||
// flex: 1;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 22rpx;
|
||||
}
|
||||
|
||||
.store-img .img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 31px;
|
||||
}
|
||||
|
||||
.store-name {
|
||||
color: #282828;
|
||||
font-size: 30rpx;
|
||||
margin-bottom: 22rpx;
|
||||
font-size: 26rpx;
|
||||
margin-bottom: 5px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
@ -338,8 +343,8 @@
|
||||
}
|
||||
|
||||
.row-right {
|
||||
flex: 1;
|
||||
margin-left:10px;
|
||||
// flex: 1;
|
||||
margin-left: 10px;
|
||||
//display: flex;
|
||||
//flex-direction: column;
|
||||
//align-items: flex-end;
|
||||
|
@ -12,7 +12,7 @@
|
||||
<view class="text acea-row row-middle">
|
||||
<view class="name line1">
|
||||
<!-- {{ userInfo.nickname }} -->
|
||||
ai豆
|
||||
{{userInfo.nickname}}
|
||||
</view>
|
||||
<!-- <view class="vip" v-if='userInfo.level'> -->
|
||||
<view class="vip">
|
||||
@ -20,7 +20,7 @@
|
||||
<!-- {{ userInfo.level.name }} -->
|
||||
|
||||
|
||||
白金会员
|
||||
{{userInfo.level.name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -29,7 +29,7 @@
|
||||
<zmxy-slideshow :items="levelList" :autoplay="false"></zmxy-slideshow>
|
||||
<!-- TODO -->
|
||||
<view class="experience">
|
||||
<view class="title">当前经验值</view>
|
||||
<view class="title">当前经验值:{{userInfo.experience}}</view>
|
||||
<view class="num">
|
||||
<!-- {{ userInfo.experience }} -->
|
||||
</view>
|
||||
@ -133,7 +133,7 @@
|
||||
<view class="info line1">购买商品可获得对应是经验值</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>
|
||||
@ -174,6 +174,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed
|
||||
} from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
@ -184,6 +188,8 @@
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
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';
|
||||
|
||||
// const store = useStore();
|
||||
|
@ -2,7 +2,9 @@ import sheep from '@/sheep';
|
||||
// #ifdef H5
|
||||
import $wxsdk from '@/sheep/libs/sdk-h5-weixin';
|
||||
// #endif
|
||||
import { getRootUrl } from '@/sheep/helper';
|
||||
import {
|
||||
getRootUrl
|
||||
} from '@/sheep/helper';
|
||||
import PayOrderApi from '@/sheep/api/pay/order';
|
||||
|
||||
/**
|
||||
@ -14,350 +16,375 @@ import PayOrderApi from '@/sheep/api/pay/order';
|
||||
*/
|
||||
|
||||
export default class SheepPay {
|
||||
constructor(payment, orderType, id) {
|
||||
this.payment = payment;
|
||||
this.id = id;
|
||||
this.orderType = orderType;
|
||||
this.payAction();
|
||||
}
|
||||
constructor(payment, orderType, id) {
|
||||
this.payment = payment;
|
||||
this.id = id;
|
||||
this.orderType = orderType;
|
||||
this.payAction();
|
||||
}
|
||||
|
||||
payAction() {
|
||||
const payAction = {
|
||||
WechatOfficialAccount: {
|
||||
wechat: () => {
|
||||
this.wechatOfficialAccountPay();
|
||||
},
|
||||
alipay: () => {
|
||||
this.redirectPay(); // 现在公众号可以直接跳转支付宝页面
|
||||
},
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
},
|
||||
WechatMiniProgram: {
|
||||
wechat: () => {
|
||||
this.wechatMiniProgramPay();
|
||||
},
|
||||
alipay: () => {
|
||||
this.copyPayLink();
|
||||
},
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
},
|
||||
App: {
|
||||
wechat: () => {
|
||||
this.wechatAppPay();
|
||||
},
|
||||
alipay: () => {
|
||||
this.alipay();
|
||||
},
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
},
|
||||
H5: {
|
||||
wechat: () => {
|
||||
this.wechatWapPay();
|
||||
},
|
||||
alipay: () => {
|
||||
this.redirectPay();
|
||||
},
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
},
|
||||
};
|
||||
return payAction[sheep.$platform.name][this.payment]();
|
||||
}
|
||||
payAction() {
|
||||
const payAction = {
|
||||
WechatOfficialAccount: {
|
||||
wechat: () => {
|
||||
this.wechatOfficialAccountPay();
|
||||
},
|
||||
alipay: () => {
|
||||
this.redirectPay(); // 现在公众号可以直接跳转支付宝页面
|
||||
},
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
},
|
||||
WechatMiniProgram: {
|
||||
wechat: () => {
|
||||
this.wechatMiniProgramPay();
|
||||
},
|
||||
alipay: () => {
|
||||
this.copyPayLink();
|
||||
},
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
},
|
||||
App: {
|
||||
wechat: () => {
|
||||
this.wechatAppPay();
|
||||
},
|
||||
alipay: () => {
|
||||
this.alipay();
|
||||
},
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
},
|
||||
H5: {
|
||||
wechat: () => {
|
||||
this.wechatWapPay();
|
||||
},
|
||||
alipay: () => {
|
||||
this.redirectPay();
|
||||
},
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
},
|
||||
};
|
||||
return payAction[sheep.$platform.name][this.payment]();
|
||||
}
|
||||
|
||||
// 预支付
|
||||
prepay(channel) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let data = {
|
||||
id: this.id,
|
||||
channelCode: channel,
|
||||
channelExtras: {},
|
||||
};
|
||||
// 特殊逻辑:微信公众号、小程序支付时,必须传入 openid
|
||||
if (['wx_pub', 'wx_lite'].includes(channel)) {
|
||||
const openid = await sheep.$platform.useProvider('wechat').getOpenid();
|
||||
// 如果获取不到 openid,微信无法发起支付,此时需要引导
|
||||
if (!openid) {
|
||||
this.bindWeixin();
|
||||
return;
|
||||
}
|
||||
data.channelExtras.openid = openid;
|
||||
}
|
||||
// 发起预支付 API 调用
|
||||
PayOrderApi.submitOrder(data).then((res) => {
|
||||
// 成功时
|
||||
res.code === 0 && resolve(res);
|
||||
// 失败时
|
||||
if (res.code !== 0 && res.msg.indexOf('无效的openid') >= 0) {
|
||||
// 特殊逻辑:微信公众号、小程序支付时,必须传入 openid 不正确的情况
|
||||
if (
|
||||
res.msg.indexOf('无效的openid') >= 0 || // 获取的 openid 不正确时,或者随便输入了个 openid
|
||||
res.msg.indexOf('下单账号与支付账号不一致') >= 0
|
||||
) {
|
||||
// https://developers.weixin.qq.com/community/develop/doc/00008c53c347804beec82aed051c00
|
||||
this.bindWeixin();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
// #ifdef H5
|
||||
// 微信公众号 JSSDK 支付
|
||||
async wechatOfficialAccountPay() {
|
||||
let { code, data } = await this.prepay('wx_pub');
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
const payConfig = JSON.parse(data.displayContent);
|
||||
$wxsdk.wxpay(payConfig, {
|
||||
success: () => {
|
||||
this.payResult('success');
|
||||
},
|
||||
cancel: () => {
|
||||
sheep.$helper.toast('支付已手动取消');
|
||||
},
|
||||
fail: (error) => {
|
||||
if (error.errMsg.indexOf('chooseWXPay:没有此SDK或暂不支持此SDK模拟') >= 0) {
|
||||
sheep.$helper.toast(
|
||||
'发起微信支付失败,原因:可能是微信开发者工具不支持,建议使用微信打开网页后支付',
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.payResult('fail');
|
||||
},
|
||||
});
|
||||
}
|
||||
// 预支付
|
||||
prepay(channel) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let data = {
|
||||
id: this.id,
|
||||
channelCode: channel,
|
||||
channelExtras: {},
|
||||
};
|
||||
// 特殊逻辑:微信公众号、小程序支付时,必须传入 openid
|
||||
if (['wx_pub', 'wx_lite'].includes(channel)) {
|
||||
const openid = await sheep.$platform.useProvider('wechat').getOpenid();
|
||||
// 如果获取不到 openid,微信无法发起支付,此时需要引导
|
||||
if (!openid) {
|
||||
this.bindWeixin();
|
||||
return;
|
||||
}
|
||||
data.channelExtras.openid = openid;
|
||||
}
|
||||
// 发起预支付 API 调用
|
||||
PayOrderApi.submitOrder(data).then((res) => {
|
||||
// 成功时
|
||||
res.code === 0 && resolve(res);
|
||||
// 失败时
|
||||
if (res.code !== 0 && res.msg.indexOf('无效的openid') >= 0) {
|
||||
// 特殊逻辑:微信公众号、小程序支付时,必须传入 openid 不正确的情况
|
||||
if (
|
||||
res.msg.indexOf('无效的openid') >= 0 || // 获取的 openid 不正确时,或者随便输入了个 openid
|
||||
res.msg.indexOf('下单账号与支付账号不一致') >= 0
|
||||
) {
|
||||
// https://developers.weixin.qq.com/community/develop/doc/00008c53c347804beec82aed051c00
|
||||
this.bindWeixin();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
// #ifdef H5
|
||||
// 微信公众号 JSSDK 支付
|
||||
async wechatOfficialAccountPay() {
|
||||
let {
|
||||
code,
|
||||
data
|
||||
} = await this.prepay('wx_pub');
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
const payConfig = JSON.parse(data.displayContent);
|
||||
$wxsdk.wxpay(payConfig, {
|
||||
success: () => {
|
||||
this.payResult('success');
|
||||
},
|
||||
cancel: () => {
|
||||
sheep.$helper.toast('支付已手动取消');
|
||||
},
|
||||
fail: (error) => {
|
||||
if (error.errMsg.indexOf('chooseWXPay:没有此SDK或暂不支持此SDK模拟') >= 0) {
|
||||
sheep.$helper.toast(
|
||||
'发起微信支付失败,原因:可能是微信开发者工具不支持,建议使用微信打开网页后支付',
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.payResult('fail');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 浏览器微信 H5 支付 TODO 芋艿:待接入
|
||||
async wechatWapPay() {
|
||||
const { error, data } = await this.prepay();
|
||||
if (error === 0) {
|
||||
const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${
|
||||
// 浏览器微信 H5 支付 TODO 芋艿:待接入
|
||||
async wechatWapPay() {
|
||||
const {
|
||||
error,
|
||||
data
|
||||
} = await this.prepay();
|
||||
if (error === 0) {
|
||||
const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${
|
||||
this.payment
|
||||
}&orderType=${this.orderType}`;
|
||||
location.href = `${data.pay_data.h5_url}&redirect_url=${encodeURIComponent(redirect_url)}`;
|
||||
}
|
||||
}
|
||||
location.href = `${data.pay_data.h5_url}&redirect_url=${encodeURIComponent(redirect_url)}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 支付链接 TODO 芋艿:待接入
|
||||
async redirectPay() {
|
||||
let { error, data } = await this.prepay();
|
||||
if (error === 0) {
|
||||
const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${
|
||||
// 支付链接 TODO 芋艿:待接入
|
||||
async redirectPay() {
|
||||
let {
|
||||
error,
|
||||
data
|
||||
} = await this.prepay();
|
||||
if (error === 0) {
|
||||
const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${
|
||||
this.payment
|
||||
}&orderType=${this.orderType}`;
|
||||
location.href = data.pay_data + encodeURIComponent(redirect_url);
|
||||
}
|
||||
}
|
||||
location.href = data.pay_data + encodeURIComponent(redirect_url);
|
||||
}
|
||||
}
|
||||
|
||||
// #endif
|
||||
// #endif
|
||||
|
||||
// 微信小程序支付
|
||||
async wechatMiniProgramPay() {
|
||||
// let that = this;
|
||||
let { code, data } = await this.prepay('wx_lite');
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// 调用微信小程序支付
|
||||
const payConfig = JSON.parse(data.displayContent);
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: payConfig.timeStamp,
|
||||
nonceStr: payConfig.nonceStr,
|
||||
package: payConfig.packageValue,
|
||||
signType: payConfig.signType,
|
||||
paySign: payConfig.paySign,
|
||||
success: (res) => {
|
||||
this.payResult('success');
|
||||
},
|
||||
fail: (err) => {
|
||||
if (err.errMsg === 'requestPayment:fail cancel') {
|
||||
sheep.$helper.toast('支付已手动取消');
|
||||
} else {
|
||||
this.payResult('fail');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
// 微信小程序支付
|
||||
async wechatMiniProgramPay() {
|
||||
// let that = this;
|
||||
let {
|
||||
code,
|
||||
data
|
||||
} = await this.prepay('wx_lite');
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// 调用微信小程序支付
|
||||
const payConfig = JSON.parse(data.displayContent);
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: payConfig.timeStamp,
|
||||
nonceStr: payConfig.nonceStr,
|
||||
package: payConfig.packageValue,
|
||||
signType: payConfig.signType,
|
||||
paySign: payConfig.paySign,
|
||||
success: (res) => {
|
||||
this.payResult('success');
|
||||
},
|
||||
fail: (err) => {
|
||||
if (err.errMsg === 'requestPayment:fail cancel') {
|
||||
sheep.$helper.toast('支付已手动取消');
|
||||
} else {
|
||||
this.payResult('fail');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 余额支付
|
||||
async walletPay() {
|
||||
const { code } = await this.prepay('wallet');
|
||||
code === 0 && this.payResult('success');
|
||||
}
|
||||
// 余额支付
|
||||
async walletPay() {
|
||||
const {
|
||||
code
|
||||
} = await this.prepay('wallet');
|
||||
code === 0 && this.payResult('success');
|
||||
}
|
||||
|
||||
// 模拟支付
|
||||
async mockPay() {
|
||||
const { code } = await this.prepay('mock');
|
||||
code === 0 && this.payResult('success');
|
||||
}
|
||||
// 模拟支付
|
||||
async mockPay() {
|
||||
const {
|
||||
code
|
||||
} = await this.prepay('mock');
|
||||
code === 0 && this.payResult('success');
|
||||
}
|
||||
|
||||
// 支付宝复制链接支付 TODO 芋艿:待接入
|
||||
async copyPayLink() {
|
||||
let that = this;
|
||||
let { error, data } = await this.prepay();
|
||||
if (error === 0) {
|
||||
// 引入showModal 点击确认 复制链接;
|
||||
uni.showModal({
|
||||
title: '支付宝支付',
|
||||
content: '复制链接到外部浏览器',
|
||||
confirmText: '复制链接',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
sheep.$helper.copyText(data.pay_data);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
// 支付宝复制链接支付 TODO 芋艿:待接入
|
||||
async copyPayLink() {
|
||||
let that = this;
|
||||
let {
|
||||
error,
|
||||
data
|
||||
} = await this.prepay();
|
||||
if (error === 0) {
|
||||
// 引入showModal 点击确认 复制链接;
|
||||
uni.showModal({
|
||||
title: '支付宝支付',
|
||||
content: '复制链接到外部浏览器',
|
||||
confirmText: '复制链接',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
sheep.$helper.copyText(data.pay_data);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 支付宝支付 TODO 芋艿:待接入
|
||||
async alipay() {
|
||||
let that = this;
|
||||
const { error, data } = await this.prepay();
|
||||
if (error === 0) {
|
||||
uni.requestPayment({
|
||||
provider: 'alipay',
|
||||
orderInfo: data.pay_data, //支付宝订单数据
|
||||
success: (res) => {
|
||||
that.payResult('success');
|
||||
},
|
||||
fail: (err) => {
|
||||
if (err.errMsg === 'requestPayment:fail [paymentAlipay:62001]user cancel') {
|
||||
sheep.$helper.toast('支付已手动取消');
|
||||
} else {
|
||||
that.payResult('fail');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
// 支付宝支付 TODO 芋艿:待接入
|
||||
async alipay() {
|
||||
let that = this;
|
||||
const {
|
||||
error,
|
||||
data
|
||||
} = await this.prepay();
|
||||
if (error === 0) {
|
||||
uni.requestPayment({
|
||||
provider: 'alipay',
|
||||
orderInfo: data.pay_data, //支付宝订单数据
|
||||
success: (res) => {
|
||||
that.payResult('success');
|
||||
},
|
||||
fail: (err) => {
|
||||
if (err.errMsg === 'requestPayment:fail [paymentAlipay:62001]user cancel') {
|
||||
sheep.$helper.toast('支付已手动取消');
|
||||
} else {
|
||||
that.payResult('fail');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 微信支付 TODO 芋艿:待接入
|
||||
async wechatAppPay() {
|
||||
let that = this;
|
||||
let { error, data } = await this.prepay();
|
||||
if (error === 0) {
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
orderInfo: data.pay_data, //微信订单数据(官方说是string。实测为object)
|
||||
success: (res) => {
|
||||
that.payResult('success');
|
||||
},
|
||||
fail: (err) => {
|
||||
err.errMsg !== 'requestPayment:fail cancel' && that.payResult('fail');
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
// 微信支付 TODO 芋艿:待接入
|
||||
async wechatAppPay() {
|
||||
let that = this;
|
||||
let {
|
||||
error,
|
||||
data
|
||||
} = await this.prepay();
|
||||
if (error === 0) {
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
orderInfo: data.pay_data, //微信订单数据(官方说是string。实测为object)
|
||||
success: (res) => {
|
||||
that.payResult('success');
|
||||
},
|
||||
fail: (err) => {
|
||||
err.errMsg !== 'requestPayment:fail cancel' && that.payResult('fail');
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 支付结果跳转,success:成功,fail:失败
|
||||
payResult(resultType) {
|
||||
sheep.$router.redirect('/pages/pay/result', {
|
||||
id: this.id,
|
||||
orderType: this.orderType,
|
||||
payState: resultType,
|
||||
});
|
||||
}
|
||||
// 支付结果跳转,success:成功,fail:失败
|
||||
payResult(resultType) {
|
||||
sheep.$router.redirect('/pages/pay/result', {
|
||||
id: this.id,
|
||||
orderType: this.orderType,
|
||||
payState: resultType,
|
||||
});
|
||||
}
|
||||
|
||||
// 引导绑定微信
|
||||
bindWeixin() {
|
||||
uni.showModal({
|
||||
title: '微信支付',
|
||||
content: '请先绑定微信再使用微信支付',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
sheep.$platform.useProvider('wechat').bind();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
// 引导绑定微信
|
||||
bindWeixin() {
|
||||
uni.showModal({
|
||||
title: '微信支付',
|
||||
content: '请先绑定微信再使用微信支付',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
sheep.$platform.useProvider('wechat').bind();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function getPayMethods(channels) {
|
||||
const payMethods = [
|
||||
{
|
||||
icon: '/static/img/shop/pay/wechat.png',
|
||||
title: '微信支付',
|
||||
value: 'wechat',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/alipay.png',
|
||||
title: '支付宝支付',
|
||||
value: 'alipay',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/wallet.png',
|
||||
title: '余额支付',
|
||||
value: 'wallet',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/apple.png',
|
||||
title: 'Apple Pay',
|
||||
value: 'apple',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/wallet.png',
|
||||
title: '模拟支付',
|
||||
value: 'mock',
|
||||
disabled: true,
|
||||
},
|
||||
];
|
||||
const platform = sheep.$platform.name;
|
||||
const payMethods = [{
|
||||
icon: '/static/img/shop/pay/wechat.png',
|
||||
title: '微信支付',
|
||||
value: 'wechat',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/wallet.png',
|
||||
title: '余额支付',
|
||||
value: 'wallet',
|
||||
disabled: true,
|
||||
},
|
||||
// {
|
||||
// icon: '/static/img/shop/pay/alipay.png',
|
||||
// title: '支付宝支付',
|
||||
// value: 'alipay',
|
||||
// disabled: true,
|
||||
// },
|
||||
|
||||
// 1. 处理【微信支付】
|
||||
const wechatMethod = payMethods[0];
|
||||
if (
|
||||
(platform === 'WechatOfficialAccount' && channels.includes('wx_pub')) ||
|
||||
(platform === 'WechatMiniProgram' && channels.includes('wx_lite')) ||
|
||||
(platform === 'App' && channels.includes('wx_app'))
|
||||
) {
|
||||
wechatMethod.disabled = false;
|
||||
}
|
||||
wechatMethod.disabled = false; // TODO 芋艿:临时测试
|
||||
// {
|
||||
// icon: '/static/img/shop/pay/apple.png',
|
||||
// title: 'Apple Pay',
|
||||
// value: 'apple',
|
||||
// disabled: true,
|
||||
// },
|
||||
// {
|
||||
// icon: '/static/img/shop/pay/wallet.png',
|
||||
// title: '模拟支付',
|
||||
// value: 'mock',
|
||||
// disabled: true,
|
||||
// },
|
||||
];
|
||||
const platform = sheep.$platform.name;
|
||||
|
||||
// 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. 处理【余额支付】
|
||||
const walletMethod = payMethods[2];
|
||||
if (channels.includes('wallet')) {
|
||||
walletMethod.disabled = false;
|
||||
}
|
||||
// 4. 处理【苹果支付】TODO 芋艿:未来接入
|
||||
// 5. 处理【模拟支付】
|
||||
const mockMethod = payMethods[4];
|
||||
if (channels.includes('mock')) {
|
||||
mockMethod.disabled = false;
|
||||
}
|
||||
return payMethods;
|
||||
// 1. 处理【微信支付】
|
||||
const wechatMethod = payMethods[0];
|
||||
if (
|
||||
(platform === 'WechatOfficialAccount' && channels.includes('wx_pub')) ||
|
||||
(platform === 'WechatMiniProgram' && channels.includes('wx_lite')) ||
|
||||
(platform === 'App' && channels.includes('wx_app'))
|
||||
) {
|
||||
wechatMethod.disabled = false;
|
||||
}
|
||||
wechatMethod.disabled = false; // TODO 芋艿:临时测试
|
||||
// 3. 处理【余额支付】
|
||||
const walletMethod = payMethods[1];
|
||||
if (channels.includes('wallet')) {
|
||||
walletMethod.disabled = false;
|
||||
}
|
||||
// // 2. 处理【支付宝支付】
|
||||
// const alipayMethod = payMethods[1];
|
||||
// if (
|
||||
// (platform === 'WechatOfficialAccount' && channels.includes('alipay_wap')) ||
|
||||
// (platform === 'WechatMiniProgram' && channels.includes('alipay_wap')) ||
|
||||
// (platform === 'App' && channels.includes('alipay_app'))
|
||||
// ) {
|
||||
// alipayMethod.disabled = false;
|
||||
// }
|
||||
|
||||
// // 4. 处理【苹果支付】TODO 芋艿:未来接入
|
||||
// // 5. 处理【模拟支付】
|
||||
// const mockMethod = payMethods[4];
|
||||
// if (channels.includes('mock')) {
|
||||
// mockMethod.disabled = false;
|
||||
// }
|
||||
return payMethods;
|
||||
}
|
Loading…
Reference in New Issue
Block a user