feat(custom): 新增聚合积分支付
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-03-20 15:53:52 +08:00
parent 2646d025f4
commit 63733d0109
14 changed files with 437 additions and 409 deletions

View File

@@ -70,4 +70,8 @@ export const createPayQr = (data: object) =>
// 检查手机号码是否存在
export const checkPhone = (data: object) =>
request("/user/find/phone", data, "POST");
request("/user/find/phone", data, "POST");
// 获取商家特定用户会员积分2024-3-19
export const getUserPoint = (data: object) =>
request("/store/get/user/integral", data, "POST");

View File

@@ -4,7 +4,7 @@ import Taro from "@tarojs/taro";
import { addCart, getCart, clearCart } from "@/api/cart";
import { Del2 } from "@nutui/icons-vue-taro";
import { createActiveOrder } from "@/api/goods";
import { createAfterOrder } from "@/api/admin";
import { createAfterOrder, getUserPoint } from "@/api/admin";
import Pay from "@/components/Pay.vue";
interface CardList {
@@ -142,11 +142,21 @@ const create_order = async () => {
url: `/pages/admin/add_order/pending_order/pending_order_detail/index?oid=${res.data.oid}&bid=${props.merInfo.bid}`,
});
} else {
const mer_info = Taro.getStorageSync("mer_info");
const user_info = Taro.getStorageSync("userInfo");
const data = await getUserPoint({
phone: user_info.data.phone,
bid: mer_info.bid,
});
res = await createActiveOrder({
Bid: [props.merInfo.bid],
custID: data.data.store_user_id,
});
if (res.data.oid) {
orderData.value = res.oid;
orderData.value = {
jh_info: data.data,
oid: res.data.oid,
};
isShowPay.value = true;
}
}
@@ -174,9 +184,10 @@ defineExpose({
<view class="container">
<view>购物车数量: {{ cartInfo.count }}</view>
<view v-if="cartInfo.count > 0">
<text>总金额: {{ cartInfo.price.toFixed(2) }}</text
<text>总金额: {{ cartInfo.price.toFixed(2) }}</text>
<text v-if="!IsPendingOrder"
>总积分: {{ cartInfo.exchange.toFixed(2) }}</text
>
<text v-if="!IsPendingOrder">总积分: {{ cartInfo.exchange.toFixed(2) }}</text>
</view>
</view>
<view v-if="cartInfo.count > 0" class="payBtn" @click.stop="create_order"

View File

@@ -14,45 +14,40 @@
<nut-cell-group
:style="{ margin: interval ? '40rpx 0 150rpx 0' : '40rpx 0' }"
>
<nut-cell
title="微信支付"
desc="使用微信快捷支付"
is-link
@click="goPay(1)"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
<nut-cell
title="积分支付"
:desc="`剩余积分:${info.integral || 0}`"
is-link
@click="goPay(2)"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
<!-- <nut-cell
title="挂帐后结"
desc="先消费后结账"
<nut-cell
title="微信支付"
desc="使用微信快捷支付"
is-link
@click="goPay(1)"
>
<template v-slot:icon>
<IconFont size="30" :name="require('../static/wx.png')" />
</template>
</nut-cell>
<nut-cell
title="平台积分支付"
:desc="`剩余积分:${info.integral || 0}`"
is-link
@click="goPay(2)"
>
<template v-slot:icon>
<IconFont size="30" :name="require('../static/pt.png')" />
</template>
</nut-cell>
<nut-cell
v-if="
jfInfo.jh_info?.store_user_id ||
jfInfo.jh_info?.store_user_id?.length > 0
"
title="聚合积分支付"
:desc="`剩余积分:${jfInfo.jh_info?.integral || 0}`"
is-link
@click="goPay(3)"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
<IconFont size="30" :name="require('../static/jh.png')" />
</template>
</nut-cell> -->
</nut-cell>
</nut-cell-group>
</view>
</nut-popup>
@@ -112,21 +107,22 @@ const getInfo = async () => {
};
const goPay = async (type: number) => {
console.log(prop);
if (!prop.jfInfo)
return Taro.showToast({
title: "未获取到订单信息",
title: "未获取到订单信息~",
icon: "none",
});
try {
// 1微信支付 2积分支付 3挂帐
if (type === 1 || type === 2) {
const { data } = await payOrder({
oid: prop.jfInfo,
OrderType: prop.OrderType,
PayType: type,
});
if (type === 1) {
console.log(prop.jfInfo);
// 1微信支付 2积分支付 3专属积分兑换
const { data } = await payOrder({
oid: prop.jfInfo.oid,
OrderType: prop.OrderType,
PayType: type,
});
switch (type) {
case 1:
if (data.data) {
Taro.requestPayment({
timeStamp: data.data.timeStamp,
@@ -153,24 +149,19 @@ const goPay = async (type: number) => {
});
} else {
Taro.showToast({
title: "未知异常",
title: "支付失败,请稍后再试~",
icon: "none",
});
emit("closePay", false);
}
} else if (type === 2) {
break;
default:
Taro.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
icon: "none",
});
emit("successPay", false);
}
} else {
Taro.showToast({
title: "挂帐后结账",
icon: "none",
});
break;
}
} catch (e) {
Taro.showToast({

View File

@@ -27,6 +27,15 @@
</view>
<view class="rightIcon">
<Scan style="margin-right: 20px" @click="scanCode" size="22" />
<button v-if="isLogin" open-type="contact">
<Message
color="#666666"
style="margin-right: 20px"
@click="toSetting"
size="22"
/>
</button>
<Setting style="margin-right: 20px" @click="toSetting" size="22" />
</view>
</view>
@@ -91,29 +100,19 @@
</view>
<!-- 我的服务 -->
<view class="user-center">
<view class="user-center" v-if="isLogin">
<view>我的服务</view>
<view class="box">
<template v-if="isLogin">
<view
class="box-mini"
v-for="item in userMenuList"
:key="item.id"
@click="toPage(item.url)"
>
<!-- <image :src="item.icon" /> -->
<IconFont size="40" :name="item.icon"></IconFont>
<view class="label">{{ item.label }}</view>
</view>
</template>
<button v-if="isLogin" class="box-mini" open-type="contact">
<IconFont
size="40"
name="http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png"
></IconFont>
<text class="label">联系客服</text>
</button>
<view
class="box-mini"
v-for="(item, idx) in userMenuList"
:key="idx"
@click="toPage(item.url)"
>
<!-- <image :src="item.icon" /> -->
<IconFont size="40" :name="item.icon"></IconFont>
<view class="label">{{ item.label }}</view>
</view>
</view>
</view>
@@ -130,7 +129,7 @@
@click="toPage('/pages/admin/add_order/index')"
>
<IconFont
size="50"
size="40"
:name="require('../../static/user/1-1.png')"
></IconFont>
</nut-grid-item>
@@ -141,7 +140,7 @@
@click="toPage('/pages/admin/verify/index')"
>
<IconFont
size="50"
size="40"
:name="require('../../static/user/1-2.png')"
></IconFont>
</nut-grid-item>
@@ -152,7 +151,7 @@
@click="toPage('/pages/admin/order_manage/index')"
>
<IconFont
size="50"
size="40"
:name="require('../../static/user/1-3.png')"
></IconFont>
</nut-grid-item>
@@ -163,7 +162,7 @@
@click="toPage('/pages/admin/withdrawal/index')"
>
<IconFont
size="50"
size="40"
:name="require('../../static/user/1-4.png')"
></IconFont>
</nut-grid-item>
@@ -184,7 +183,13 @@
<script lang="ts" setup>
import { ref } from "vue";
import { ArrowRight, Setting, IconFont, Scan } from "@nutui/icons-vue-taro";
import {
ArrowRight,
Setting,
IconFont,
Scan,
Message,
} from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import Auth from "@/components/Auth.vue";
import { getPersonalInfo, getPhone, bindParent } from "@/api/user";
@@ -229,10 +234,9 @@ const getUserInfo = async () => {
...res.data,
data: {
...res.data.data,
permission:
res.data.data.permission
? JSON.parse(res.data.data.permission)
: {},
permission: res.data.data.permission
? JSON.parse(res.data.data.permission)
: {},
},
};
Taro.setStorageSync("userInfo", userInfo.value);
@@ -262,13 +266,11 @@ const toOrderList = (e: number) => {
const userMenuList = ref([
{
id: 0,
label: "后结订单",
url: "/pages/users/pending_order/index",
icon: require("../../static/user/dd.png"),
},
{
id: 1,
label: "我的账户",
url: "/pages/users/account/index",
icon: "http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png",
@@ -280,23 +282,15 @@ const userMenuList = ref([
// icon: "http://jdt168.com/uploads/default/20220829/583fd6cbd729b24eab9c3cae20ae694d.png",
// },
{
id: 3,
label: "我的推广",
url: "/pages/users/distribution/index",
icon: "http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png",
},
// {
// id: 4,
// label: "关注商家",
// url: "",
// icon: "http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png",
// label: "聚合积分",
// url: "/pages/users/integral/index",
// icon: require("../../static/jhjf.png"),
// },
// {
// id: 5,
// label: '联系客服',
// url: '',
// icon: 'http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png'
// }
]);
const toSetting = () => {
@@ -370,6 +364,7 @@ const scanCode = () => {
justify-content: space-between;
box-sizing: border-box;
text-align: left;
padding-right: 20px;
.user-center-card__header__info {
margin-left: 20px;
@@ -381,6 +376,23 @@ const scanCode = () => {
.rightIcon {
height: 100px;
margin: auto;
display: flex;
justify-content: flex-start;
// align-items: center;
button {
padding: 0 !important;
margin: 0 !important;
background: transparent;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
position: relative;
top: -13px;
}
button::after {
border: none;
background: transparent;
}
}
}
@@ -433,25 +445,23 @@ const scanCode = () => {
background-color: #fff;
border-radius: 20px;
margin: 20px;
padding: 30px;
padding: 20px;
width: 710px;
box-sizing: border-box;
.box {
margin-top: 20px;
display: flex;
flex-wrap: wrap;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 20px;
box-sizing: border-box;
justify-content: flex-start;
.box-mini {
display: flex;
box-sizing: border-box;
width: 150px;
flex-direction: column;
align-items: center;
width: 150px;
margin-bottom: 20px;
margin-right: 13px;
.label {
font-size: 25px;
@@ -464,32 +474,6 @@ const scanCode = () => {
height: 80px;
}
}
button {
width: 150px;
position: relative;
margin-left: auto;
margin-right: auto;
padding-left: 0;
padding-right: 0;
box-sizing: border-box;
// font-size: 18px;
text-align: center;
text-decoration: none;
// line-height: 1;
line-height: 1.35;
// border-radius: 5px;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
color: #000000;
background-color: #fff;
height: 100%;
}
button::after {
border: none;
background: transparent;
}
}
}

View File

@@ -22,6 +22,10 @@ const tabsList = ref([
title: "活动赠送",
value: 4,
},
{
title: "聚合积分",
value: 5,
},
]);
const computerType = computed(() => {
@@ -81,13 +85,13 @@ const getList = async () => {
PageSize: page.value.PageSize,
Type: tabValue.value,
};
if (tabValue.value === 1 || tabValue.value === 3) {
if (tabValue.value === 1 || tabValue.value === 3 || tabValue.value === 5) {
res = await getBeanDetail(newData);
} else if (tabValue.value === 2) {
// delete data.value.Type;
Reflect.deleteProperty(data.value, "Type");
res = await getIntegralDetail(newData);
} else {
} else if (tabValue.value === 4) {
res = await getGiftRecord(newData);
}
data.value = res.data.data || [];
@@ -117,28 +121,31 @@ const getList = async () => {
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
</view>
</view>
<view class="tabs-box">
<view
v-for="item in tabsList"
:key="item.value"
@click="tabChange(item.value)"
>
<view class="text">{{ item.title }}</view>
<scroll-view scroll-x>
<view class="tabs-box">
<view
class="line"
:class="{ lineColor: item.value === tabValue }"
></view>
v-for="item in tabsList"
:key="item.value"
@click="tabChange(item.value)"
>
<view class="text">{{ item.title }}</view>
<view
class="line"
:class="{ lineColor: item.value === tabValue }"
></view>
</view>
</view>
</view>
</scroll-view>
<view v-if="data.length > 0">
<view v-if="tabValue === 1 || tabValue === 3">
<view v-if="tabValue === 1 || tabValue === 3 || tabValue === 5">
<view class="card-list" v-for="(item, index) in data" :key="index">
<view class="left">
<view>订单{{ item.oid }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view v-if="tabValue === 1" style="color: green"
<view v-if="tabValue === 1 || tabValue === 5" style="color: green"
>-
<text>{{ item.number }}积分</text>
</view>
@@ -245,12 +252,17 @@ const getList = async () => {
.tabs-box {
display: flex;
flex-direction: row;
justify-content: space-evenly;
// justify-content: space-evenly;
align-items: center;
height: auto;
background-color: #fff;
padding: 0 20px;
padding: 0 10px;
text-align: center;
overflow-x: auto;
view {
width: 200px;
}
.text {
margin: 10px 20px;

View File

@@ -4,6 +4,7 @@ import Taro from "@tarojs/taro";
import Pay from "@/components/Pay.vue";
import { getActiveOrderList, deleteActiveOrder } from "@/api/goods";
import { getOrderStatistics } from "@/api/order";
import { getUserPoint } from "@/api/admin";
const tabValue = ref(0);
@@ -94,13 +95,18 @@ const tabChange = (index: number) => {
getList();
};
Taro.useReachBottom(() => {
console.log("useReachBottom");
});
const openPay = (item: OrderList) => {
const openPay = async (item: OrderList) => {
isShowPay.value = true;
jfInfo.value = item.oid;
const mer_info = Taro.getStorageSync("mer_info");
const user_info = Taro.getStorageSync("userInfo");
const data = await getUserPoint({
phone: user_info.data.phone,
bid: mer_info.bid,
});
jfInfo.value = {
jh_info: data.data,
oid: item.oid,
};
};
const errPay = () => {
@@ -122,6 +128,12 @@ const closePay = () => {
getList();
};
const successPay = () => {
isShowPay.value = false;
jfInfo.value = {};
getList();
};
const toDetail = (item: any) => {
Taro.setStorageSync("item", item);
Taro.navigateTo({
@@ -271,6 +283,7 @@ const getTj = async () => {
:jfInfo="jfInfo"
:OrderType="2"
@errPay="errPay"
@successPay="successPay"
@closePay="closePay"
/>
</view>

View File

@@ -152,6 +152,7 @@
:jfInfo="jfInfo"
:OrderType="2"
@errPay="errPay"
@successPay="successPay"
@closePay="closePay"
/>
</view>
@@ -164,6 +165,7 @@ import { ref } from "vue";
import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
import Pay from "@/components/Pay.vue";
import { getUserPoint } from "@/api/admin";
dayjs.extend(duration);
@@ -218,9 +220,18 @@ const toAdder = () => {
});
};
const openPay = () => {
const openPay = async () => {
isShowPay.value = true;
jfInfo.value = Taro.getStorageSync("item");
const mer_info = Taro.getStorageSync("mer_info");
const user_info = Taro.getStorageSync("userInfo");
const data = await getUserPoint({
phone: user_info.data.phone,
bid: mer_info.bid,
});
jfInfo.value = {
jh_info: data.data,
oid: Taro.getStorageSync("item").oid,
};
};
const successPay = (val: boolean) => {

View File

@@ -17,10 +17,10 @@ const toPage = (url: string) => {
is-link
@click="toPage('/pages/users/user_setting/index')"
></nut-cell>
<nut-cell title="关于我们" is-link @click="toPage('1')"></nut-cell>
<!-- <nut-cell title="关于我们" is-link @click="toPage('1')"></nut-cell>
<nut-cell title="资质证明" is-link @click="toPage('1')"></nut-cell>
<nut-cell title="协议规则" is-link @click="toPage('1')"></nut-cell>
<nut-cell title="隐私设置" is-link @click="toPage('1')"></nut-cell>
<nut-cell title="隐私设置" is-link @click="toPage('1')"></nut-cell> -->
</nut-cell-group>
</view>
</template>

BIN
src/static/jh.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
src/static/jhjf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/static/pt.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
src/static/wx.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB