优惠券使用

main
Frontend-徐志烘 1 year ago
parent 7456b65bb4
commit 86a2a9e3d6

@ -196,6 +196,13 @@
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/payCoupons/payCoupons",
"style" :
{
"navigationBarTitleText" : ""
}
}
],

@ -0,0 +1,467 @@
<template>
<view class="charge">
<view class="tops">
<img class="nav-img" src="https://www.jiubaotongxue.love/image/nav10.png" alt="" @click="getNavs" />
<view class="title" style="font-size: 36rpx;">
拉新券使用
</view>
</view>
<view class="topss">
</view>
<scroll-view scroll-y="true" class="scrol">
<view class="big">
<view class="card" v-for="(item,index) in couponsData" :key="item.id" @click="checkCoupons(index)">
<view class="boxs" v-if="item.status===1&& headerindex===1&&item.couponName" :class="{couponsActive:couponsIndex===index}">
<view class="boxs-left">
<text class="boxs-left-top" v-if="item.couponName==='拉新洗车券'"></text>
<text class="boxs-left-tops" v-if="item.couponName==='拉新洗车券'"></text>
<text class="boxs-left-top" v-if="item.couponName==='停车场优惠卷'"></text>
<text class="boxs-left-tops" v-if="item.couponName==='停车场优惠卷'"></text>
<text class="boxs-left-top" v-if="item.couponName==='拉新折扣券'"></text>
<text class="boxs-left-tops" v-if="item.couponName==='拉新折扣券'"></text>
</view>
<view class="boxs-right">
<view class="boxs-right-top">
{{item.couponName}}
</view>
<view class="boxs-right-tops">
{{item.endTime}}
</view>
<view class="line">
</view>
<view class="boxs-right-bottom">
<!-- 每次上线使用20分钟 -->{{item.rule}}({{item.freeTime}}分钟)
</view>
</view>
<view class="boxs-Btn">
{{item.freeTime}}分钟
</view>
</view>
<view class="boxs" v-if="item.status===0&&headerindex===2">
<view class="boxs-left">
<text class="boxs-left-top" v-if="item.couponName==='拉新洗车券'"></text>
<text class="boxs-left-tops" v-if="item.couponName==='拉新洗车券'"></text>
<text class="boxs-left-top" v-if="item.couponName==='停车场优惠卷'"></text>
<text class="boxs-left-tops" v-if="item.couponName==='停车场优惠卷'"></text>
</view>
<view class="boxs-right">
<view class="boxs-right-top">
{{item.couponName}}
</view>
<view class="boxs-right-tops">
有效期:{{item.endTime}}
</view>
<view class="line">
</view>
<view class="boxs-right-bottom">
<!-- 每次上线使用20分钟 -->{{item.rule}}
</view>
</view>
<view class="boxs-Btns"
:class="{boxsBtnsActives:item.status===2,boxsBtnsActive:item.status===0}">
</view>
</view>
</view>
<view class="kong" style="width: 100%;height: 1000rpx;text-align: center;"
v-if="headerindex===1&&isShow===3">
<img style="width: 480rpx;height: 400rpx;margin-top: 360rpx;margin-left: 50%;transform: translateX(-50%);"
src="https://www.jiubaotongxue.love/image/demo111.png" alt="" />
<view style="width: 100%;height: 50rpx;line-height: 50rpx;text-align: center;">
暂无数据
</view>
</view>
<view class="kong" style="width: 100%;height: 1000rpx;text-align: center;"
v-if="headerindex===2&&isShowCoupons===0">
<img style="width: 480rpx;height: 400rpx;margin-top: 360rpx;margin-left: 50%;transform: translateX(-50%);"
src="https://www.jiubaotongxue.love/image/demo111.png" alt="" />
<view style="width: 100%;height: 50rpx;line-height: 50rpx;text-align: center;">
暂无数据
</view>
</view>
</view>
</scroll-view>
<view class="charge-play">
<view class="charge-body-title">
{{couponsData[couponsIndex].rule}}可洗车{{couponsData[couponsIndex].freeTime}}分钟
</view>
<view class="charge-play-icon">
<view class="icon-left">
<img class="icon-img" src="https://www.jiubaotongxue.love/image/demo54.png" alt="" />
<text>微信支付</text>
</view>
<view class="icon-right icon-active">
</view>
</view>
</view>
<view class="charge-btnPlay">
<text class="charge-btnPlay-left">支付<text class="pricess">{{couponsData[couponsIndex].amount}}</text> </text>
<view class="plays" @click="goPlays">
去支付
</view>
</view>
</view>
<!-- <explain v-if="explainShow===1" @close="close"></explain> -->
<windows v-if="ccc===1" @cloSe="cloSe" @oks="oks" :titleMsg="titleMsg"></windows>
</template>
<script setup>
import {
ref
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app'
import {
coupons
} from '../../stor/Coupons/coupons.js'
import {
storeToRefs
} from 'pinia';
const c = coupons()
const {
isShowCoupons,
couponsData,
que,
isShow,
} = storeToRefs(c)
c.getcouponsData()
onLoad(() => {
console.log(isShowCoupons, isShow);
})
const headerindex = ref(1)
const titles = ref('券列表')
const bgcolor = ref('#fff')
const color = ref('#000')
const ccc = ref(0)
const quan = ref(0)
const couponsIndex = ref(0)
const remo = () => {
headerindex.value = 1
}
const add = () => {
headerindex.value = 2
}
//使
const xiche = (index) => {
quan.value = index
if (couponsData.value[index].type === 0) {
c.scanQrcode(couponsData.value[index])
} else if (couponsData.value[index].type === 2) {
ccc.value = 1
} else {
c.getYouHuiApi(couponsData.value[index].id)
}
}
const quedingsa = () => {
c.goStar()
}
const quedinga = () => {
c.quexio()
}
const goOks = () => {
c.getYouHuiApi(couponsData.value[quan.value].id)
ccc.value = 0
}
const checkCoupons = (index)=>{
couponsIndex.value=index
}
const goPlays = ()=>{
c.wxPlay(couponsData.value[quan.value])
}
</script>
<style lang="scss">
.charge {
width: 100%;
height: 100%;
position: absolute;
background-color: #f2f2f2;
.tops {
width: 100%;
position: fixed;
height: 318rpx;
// background: linear-gradient(113deg, #65AAFB 0%, #60A7FB 100%);
background-image: url("https://www.jiubaotongxue.love/image/demo56.png");
background-size: 100% 100%;
// z-index: 9;
.nav-img {
width: 64rpx;
height: 64rpx;
position: absolute;
top: 100rpx;
left: 20rpx;
}
.title {
width: 100%;
height: 50rpx;
line-height: 50rpx;
font-size: 36rpx;
position: absolute;
top: 108rpx;
left: 304rpx;
}
}
.topss {
width: 100%;
height: 260rpx;
}
.scrol {
width: 100%;
height: 60%;
.big {
width: 100%;
height: 100%;
.card {
width: 694rpx;
margin-left: 50%;
transform: translateX(-50%);
.boxs {
width: 694rpx;
height: 208rpx;
margin-top: 20rpx;
border-radius: 20rpx 20rpx 20rpx 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
.boxs-left {
width: 234rpx;
height: 208rpx;
background-image: url("https://www.jiubaotongxue.love/image/demo43.png");
background-size: 100% 100%;
.boxs-left-top {
display: block;
width: 100%;
height: 66rpx;
line-height: 66rpx;
text-align: center;
margin-top: 46rpx;
font-size: 48rpx;
color: white;
}
.boxs-left-tops {
display: block;
width: 100%;
height: 40rpx;
line-height: 40rpx;
text-align: center;
font-size: 28rpx;
color: white;
margin-top: 12rpx;
}
}
.boxs-right {
width: 460rpx;
height: 208rpx;
background-image: url("https://www.jiubaotongxue.love/image/demo44.png");
background-size: 100% 100%;
box-sizing: border-box;
padding-left: 28rpx;
.boxs-right-top {
width: 100%;
height: 42rpx;
font-weight: 500;
font-size: 30rpx;
color: #242526;
line-height: 42rpx;
margin-top: 34rpx;
font-weight: 700;
}
.boxs-right-tops {
width: 100%;
height: 34rpx;
font-weight: 400;
font-size: 24rpx;
color: rgba(36, 37, 38, 0.5);
line-height: 34rpx;
font-style: normal;
margin-top: 14rpx;
}
.line {
width: 100%;
height: 2rpx;
border-top: 1rpx solid #E6E6E6;
margin-top: 16rpx;
}
.boxs-right-bottom {
width: 100%;
height: 34rpx;
font-weight: 400;
font-size: 24rpx;
color: rgba(36, 37, 38, 0.5);
line-height: 34rpx;
margin-top: 16rpx;
}
}
.boxs-Btn {
position: absolute;
right: 28rpx;
top: 28rpx;
width: 88rpx;
height: 48rpx;
text-align: center;
line-height: 48rpx;
font-size: 22rpx;
color: white;
background: linear-gradient(135deg, #FEB44C 0%, #FF8833 100%);
border-radius: 25rpx 25rpx 25rpx 25rpx;
}
.boxs-Btns {
position: absolute;
right: 24rpx;
top: 24rpx;
width: 88rpx;
height: 88rpx;
border-radius: 50%;
background-size: 100% 100%;
}
.boxsBtnsActive {
background-image: url("https://www.jiubaotongxue.love/image/demo45.png");
}
.boxsBtnsActives {
background-image: url("https://www.jiubaotongxue.love/image/demo46.png");
}
}
.couponsActive{
border: 1rpx solid #3f95ff;
}
}
}
}
.charge-play {
width: 92%;
height: 200rpx;
// background-color: #ffffff;
margin-left: 50%;
transform: translateX(-50%);
// margin-top: 30rpx;
border-radius: 20rpx 20rpx 20rpx 20rpx;
.charge-body-title {
width: 100%;
height: 80rpx;
box-sizing: border-box;
line-height: 80rpx;
padding-left: 20rpx;
font-size: 32rpx;
font-weight: 700;
color: #666;
}
.charge-play-icon {
width: 100%;
height: 110rpx;
margin-top: 15rpx;
display: flex;
justify-content: space-between;
align-items: center;
background-color: white;
border-radius: 20rpx 20rpx 20rpx 20rpx;
.icon-left {
width: 260rpx;
height: 90rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rp;
.icon-img {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
margin-left: 30rpx;
}
}
.icon-right {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
border: 1rpx solid #666;
margin-right: 50rpx;
}
.icon-active {
border: none;
background-size: 100% 100%;
background-image: url("https://www.jiubaotongxue.love/image/xuanzhong.png");
}
}
}
.charge-btnPlay {
position: fixed;
bottom: 0rpx;
width: 100%;
height: 140rpx;
background-color: white;
line-height: 140rpx;
color: white;
display: flex;
justify-content: space-between;
// bottom: constant(safe-area-inset-bottom);
// bottom: env(safe-area-inset-bottom);
box-sizing: border-box;
padding-left: 30rpx;
.charge-btnPlay-left {
color: black;
font-size: 30rpx;
.pricess {
font-size: 40rpx;
color: #FF7733;
}
}
.plays {
width: 280rpx;
height: 96rpx;
background: linear-gradient(135deg, #4D97FF 0%, #3377FF 100%), linear-gradient(276deg, #1C9FF7 0%, #1275F7 100%);
box-shadow: 0rpx 8rpx 18rpx 0rpx rgba(5, 128, 255, 0.2);
border-radius: 50rpx;
text-align: center;
line-height: 96rpx;
margin-right: 30rpx;
margin-top: 20rpx;
}
}
}
</style>

@ -4,6 +4,7 @@ import {
import {
ref
} from 'vue'
import {
getCouponList,
getyouHui,
@ -16,7 +17,10 @@ import {
getShopid,
getTimeOrder
} from '../../api/api.js'
import {
appSecret,
appid
} from '../../common/baseurl.js'
export const coupons = defineStore('coupons', () => {
const couponsData = ref([])
@ -27,6 +31,8 @@ export const coupons = defineStore('coupons', () => {
const isShow = ref()
const que = ref(0)
const id = ref()
const p = ref(0)
const orderid = ref()
const getcouponsData = async () => {
couponsData.value = await getCouponList({
phoneNumber: uni.getStorageSync('phoneNumber')
@ -99,20 +105,25 @@ export const coupons = defineStore('coupons', () => {
uni.setStorageSync('mid', mid)
console.log(mid);
}
getShopid({
mid: uni.getStorageSync('mid'),
phone: uni.getStorageSync('phoneNumber')
}).then((res) => {
console.log(res);
console.log(res.data.networkId);
id.value = res.data.networkId
que.value = 1
})
console.log(resDats.value);
if (resDats.value.amount > 0) {
uni.navigateTo({
url: "/pages/payCoupons/payCoupons"
})
} else {
getShopid({
mid: uni.getStorageSync('mid'),
phone: uni.getStorageSync('phoneNumber')
}).then((res) => {
console.log(res);
console.log(res.data.networkId);
id.value = res.data.networkId
que.value = 1
})
}
// const mids = Number(mid)
}
}
const scanQrcode = (data) => {
@ -170,14 +181,15 @@ export const coupons = defineStore('coupons', () => {
uni.setStorageSync('orderid', res5)
uni.setStorageSync('msg', '拉新券')
const orderRes = await getTimeOrder({
phoneNumber: uni.getStorageSync('phoneNumber'),
phoneNumber: uni.getStorageSync(
'phoneNumber'),
amount: 0,
goodsId: resDats.value.id,
goodsType: 3, //洗车订单
networkId: id.value,
payType: 4, //
deviceId: uni.getStorageSync('mid'),
orderId:orderid.value
orderId: res5
})
uni.redirectTo({
url: '/pages/complete/complete'
@ -208,6 +220,172 @@ export const coupons = defineStore('coupons', () => {
}
})
}
// 洗车费-微信支付-套餐6元
const wxPlay = async (datas) => {
console.log(datas);
if (!uni.getStorageSync('phoneNumber')) {
uni.showToast({
icon: 'none',
title: "账号未登录,请先登录",
duration: 1000
})
return
}
//处理用户多次点击
if (p.value == 1) {
return
}
p.value = 1
const res = await getTimeStamps()
// {
// phoneNumber: uni.getStorageSync('phoneNumber'),
// amount: datas.amount,
// goodsId: datas.id,
// goodsType: 3, //洗车订单
// networkId: datas.networkId,
// payType: 1, //微信支付,
// deviceId: uni.getStorageSync('mid')
// }
orderid.value = res
if (res === "机器正在工作") {
uni.showToast({
icon: "none",
title: `${res}`
})
p.value = 0
} else {
console.log("out_trade_no", res);
console.log('这是订单号' + res);
const res1 = await getWxPlay({
appId: appid,
phone: uni.getStorageSync('phoneNumber'),
openId: uni.getStorageSync('openid'),
out_trade_no: res,
amount: datas.amount,
description: '拉新券洗车',
shopId: datas.id,
machineId: datas.networkId
})
console.log(res1);
uni.requestPayment({
provider: 'wxpay',
timeStamp: res1.timeStamp,
nonceStr: res1.nonceStr,
package: res1.package,
signType: res1.signType,
paySign: res1.paySign,
//付款成功进入执行启动设备
success: async (res2) => {
console.log('用户付款成功', res2);
//获取扫码后的设备id和手机号验证传入订单信息启动设备
const res4 = await start({
mid: uni.getStorageSync('mid'),
price: 100,
time: datas.freeTime*60,
description: '拉新券洗车',
orderId: orderid.value,
phone: uni.getStorageSync('phoneNumber'),
openId: uni.getStorageSync('openid')
})
console.log(res4);
if (res4.code == 200 || res4.code == 0) {
uni.showToast({
icon: 'none',
title: '启动设备成功',
duration: 1000,
success: async (res) => {
p.value = 0
uni.setStorageSync(
'orderid',
orderid
.value)
uni.setStorageSync('msg','拉新券洗车')
const orderRes = await getTimeOrder({
phoneNumber: uni.getStorageSync('phoneNumber'),
amount: datas.amount,
goodsId: datas.id,
goodsType: 3, //洗车订单
networkId: datas.networkId,
payType: 4, //微信支付,
deviceId: uni.getStorageSync('mid'),
orderId: orderid.value
})
uni.redirectTo({
url: '/pages/complete/complete'
})
const qaq = await getTincheCoupons({
phoneNumber: uni.getStorageSync('phoneNumber'),
oderId: orderid.value
})
uni.showToast({
icon: "none",
title: `${qaq.msg}`
})
const currentDate = new Date();
const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1)
.padStart(2, '0');
const day = String(currentDate.getDate())
.padStart(2, '0');
const hours = String(currentDate.getHours())
.padStart(2, '0');
const minutes = String(currentDate.getMinutes())
.padStart(2, '0');
const seconds = String(currentDate.getSeconds())
.padStart(2, '0');
const formattedDate =
`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const qaq1 = await getExcellent({
time: formattedDate,
networkId: datas.networkId
})
console.log(qaq1)
}
})
//不为200或者0的时候启动失败并提示原因。
} else {
console.log(res4);
uni.showToast({
icon: 'none',
title: `请在我的页面联系客服解决`,
duration: 1200,
success: (res) => {
p.value = 0
uni.setStorageSync(
'orderid',
orderid
.value)
uni.setStorageSync('msg','拉新券洗车')
}
})
}
},
//付款失败 提示原因
fail: (err) => {
p.value = 0
console.log("用户付款失败", err);
if (err) {
uni.showToast({
title: '用户付款失败',
icon: 'none',
duration: 1000
})
}
}
})
}
p.value = 0
}
return {
couponsData,
getcouponsData,
@ -217,6 +395,7 @@ export const coupons = defineStore('coupons', () => {
quexio,
goStar,
isShowCoupons,
isShow
isShow,
wxPlay
}
})

@ -32,6 +32,7 @@ if (!Math) {
"./pages/yijian/yijian.js";
"./pages/tuan/tuan.js";
"./pages/demo copy/index.js";
"./pages/payCoupons/payCoupons.js";
}
const _sfc_main = {
onLaunch: function() {

@ -27,7 +27,8 @@
"pages/guanyuMy/guanyuMy",
"pages/yijian/yijian",
"pages/tuan/tuan",
"pages/demo copy/index"
"pages/demo copy/index",
"pages/payCoupons/payCoupons"
],
"window": {
"navigationBarTextStyle": "black",

@ -0,0 +1,105 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const stor_Coupons_coupons = require("../../stor/Coupons/coupons.js");
if (!Array) {
const _easycom_windows2 = common_vendor.resolveComponent("windows");
_easycom_windows2();
}
const _easycom_windows = () => "../../components/windows/windows.js";
if (!Math) {
_easycom_windows();
}
const _sfc_main = {
__name: "payCoupons",
setup(__props) {
const c = stor_Coupons_coupons.coupons();
const {
isShowCoupons,
couponsData,
que,
isShow
} = common_vendor.storeToRefs(c);
c.getcouponsData();
common_vendor.onLoad(() => {
console.log(isShowCoupons, isShow);
});
const headerindex = common_vendor.ref(1);
common_vendor.ref("券列表");
common_vendor.ref("#fff");
common_vendor.ref("#000");
const ccc = common_vendor.ref(0);
const quan = common_vendor.ref(0);
const couponsIndex = common_vendor.ref(0);
const checkCoupons = (index) => {
couponsIndex.value = index;
};
const goPlays = () => {
c.wxPlay(couponsData.value[quan.value]);
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o((...args) => _ctx.getNavs && _ctx.getNavs(...args)),
b: common_vendor.f(common_vendor.unref(couponsData), (item, index, i0) => {
return common_vendor.e({
a: item.status === 1 && headerindex.value === 1 && item.couponName
}, item.status === 1 && headerindex.value === 1 && item.couponName ? common_vendor.e({
b: item.couponName === "拉新洗车券"
}, item.couponName === "拉新洗车券" ? {} : {}, {
c: item.couponName === "拉新洗车券"
}, item.couponName === "拉新洗车券" ? {} : {}, {
d: item.couponName === "停车场优惠卷"
}, item.couponName === "停车场优惠卷" ? {} : {}, {
e: item.couponName === "停车场优惠卷"
}, item.couponName === "停车场优惠卷" ? {} : {}, {
f: item.couponName === "拉新折扣券"
}, item.couponName === "拉新折扣券" ? {} : {}, {
g: item.couponName === "拉新折扣券"
}, item.couponName === "拉新折扣券" ? {} : {}, {
h: common_vendor.t(item.couponName),
i: common_vendor.t(item.endTime),
j: common_vendor.t(item.rule),
k: common_vendor.t(item.freeTime),
l: common_vendor.t(item.freeTime),
m: couponsIndex.value === index ? 1 : ""
}) : {}, {
n: item.status === 0 && headerindex.value === 2
}, item.status === 0 && headerindex.value === 2 ? common_vendor.e({
o: item.couponName === "拉新洗车券"
}, item.couponName === "拉新洗车券" ? {} : {}, {
p: item.couponName === "拉新洗车券"
}, item.couponName === "拉新洗车券" ? {} : {}, {
q: item.couponName === "停车场优惠卷"
}, item.couponName === "停车场优惠卷" ? {} : {}, {
r: item.couponName === "停车场优惠卷"
}, item.couponName === "停车场优惠卷" ? {} : {}, {
s: common_vendor.t(item.couponName),
t: common_vendor.t(item.endTime),
v: common_vendor.t(item.rule),
w: item.status === 2 ? 1 : "",
x: item.status === 0 ? 1 : ""
}) : {}, {
y: item.id,
z: common_vendor.o(($event) => checkCoupons(index), item.id)
});
}),
c: headerindex.value === 1 && common_vendor.unref(isShow) === 3
}, headerindex.value === 1 && common_vendor.unref(isShow) === 3 ? {} : {}, {
d: headerindex.value === 2 && common_vendor.unref(isShowCoupons) === 0
}, headerindex.value === 2 && common_vendor.unref(isShowCoupons) === 0 ? {} : {}, {
e: common_vendor.t(common_vendor.unref(couponsData)[couponsIndex.value].rule),
f: common_vendor.t(common_vendor.unref(couponsData)[couponsIndex.value].freeTime),
g: common_vendor.t(common_vendor.unref(couponsData)[couponsIndex.value].amount),
h: common_vendor.o(goPlays),
i: ccc.value === 1
}, ccc.value === 1 ? {
j: common_vendor.o(_ctx.cloSe),
k: common_vendor.o(_ctx.oks),
l: common_vendor.p({
titleMsg: _ctx.titleMsg
})
} : {});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/carwashingThree/pages/payCoupons/payCoupons.vue"]]);
wx.createPage(MiniProgramPage);

@ -0,0 +1,6 @@
{
"navigationBarTitleText": "",
"usingComponents": {
"windows": "../../components/windows/windows"
}
}

@ -0,0 +1 @@
<view class="charge"><view class="tops"><image class="nav-img" src="https://www.jiubaotongxue.love/image/nav10.png" alt="" bindtap="{{a}}"/><view class="title" style="font-size:36rpx"> 拉新券使用 </view></view><view class="topss"></view><scroll-view scroll-y="true" class="scrol"><view class="big"><view wx:for="{{b}}" wx:for-item="item" wx:key="y" class="card" bindtap="{{item.z}}"><view wx:if="{{item.a}}" class="{{['boxs', item.m && 'couponsActive']}}"><view class="boxs-left"><text wx:if="{{item.b}}" class="boxs-left-top">新</text><text wx:if="{{item.c}}" class="boxs-left-tops">拉新券</text><text wx:if="{{item.d}}" class="boxs-left-top">停</text><text wx:if="{{item.e}}" class="boxs-left-tops">停车券</text><text wx:if="{{item.f}}" class="boxs-left-top">拉</text><text wx:if="{{item.g}}" class="boxs-left-tops">拉新折扣券</text></view><view class="boxs-right"><view class="boxs-right-top">{{item.h}}</view><view class="boxs-right-tops">{{item.i}}</view><view class="line"></view><view class="boxs-right-bottom">{{item.j}}({{item.k}}分钟) </view></view><view class="boxs-Btn">{{item.l}}分钟 </view></view><view wx:if="{{item.n}}" class="boxs"><view class="boxs-left"><text wx:if="{{item.o}}" class="boxs-left-top">新</text><text wx:if="{{item.p}}" class="boxs-left-tops">拉新券</text><text wx:if="{{item.q}}" class="boxs-left-top">停</text><text wx:if="{{item.r}}" class="boxs-left-tops">停车券</text></view><view class="boxs-right"><view class="boxs-right-top">{{item.s}}</view><view class="boxs-right-tops"> 有效期:{{item.t}}</view><view class="line"></view><view class="boxs-right-bottom">{{item.v}}</view></view><view class="{{['boxs-Btns', item.w && 'boxsBtnsActives', item.x && 'boxsBtnsActive']}}"></view></view></view><view wx:if="{{c}}" class="kong" style="width:100%;height:1000rpx;text-align:center"><image style="width:480rpx;height:400rpx;margin-top:360rpx;margin-left:50%;transform:translateX(-50%)" src="https://www.jiubaotongxue.love/image/demo111.png" alt=""/><view style="width:100%;height:50rpx;line-height:50rpx;text-align:center"> 暂无数据 </view></view><view wx:if="{{d}}" class="kong" style="width:100%;height:1000rpx;text-align:center"><image style="width:480rpx;height:400rpx;margin-top:360rpx;margin-left:50%;transform:translateX(-50%)" src="https://www.jiubaotongxue.love/image/demo111.png" alt=""/><view style="width:100%;height:50rpx;line-height:50rpx;text-align:center"> 暂无数据 </view></view></view></scroll-view><view class="charge-play"><view class="charge-body-title">{{e}}可洗车{{f}}分钟 </view><view class="charge-play-icon"><view class="icon-left"><image class="icon-img" src="https://www.jiubaotongxue.love/image/demo54.png" alt=""/><text>微信支付</text></view><view class="icon-right icon-active"></view></view></view><view class="charge-btnPlay"><text class="charge-btnPlay-left">支付:<text class="pricess">{{g}}</text></text><view class="plays" bindtap="{{h}}"> 去支付 </view></view></view><windows wx:if="{{i}}" bindcloSe="{{j}}" bindoks="{{k}}" u-i="7a608c0e-0" bind:__l="__l" u-p="{{l}}"></windows>

@ -0,0 +1,266 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.charge {
width: 100%;
height: 100%;
position: absolute;
background-color: #f2f2f2;
}
.charge .tops {
width: 100%;
position: fixed;
height: 318rpx;
background-image: url("https://www.jiubaotongxue.love/image/demo56.png");
background-size: 100% 100%;
}
.charge .tops .nav-img {
width: 64rpx;
height: 64rpx;
position: absolute;
top: 100rpx;
left: 20rpx;
}
.charge .tops .title {
width: 100%;
height: 50rpx;
line-height: 50rpx;
font-size: 36rpx;
position: absolute;
top: 108rpx;
left: 304rpx;
}
.charge .topss {
width: 100%;
height: 260rpx;
}
.charge .scrol {
width: 100%;
height: 60%;
}
.charge .scrol .big {
width: 100%;
height: 100%;
}
.charge .scrol .big .card {
width: 694rpx;
margin-left: 50%;
transform: translateX(-50%);
}
.charge .scrol .big .card .boxs {
width: 694rpx;
height: 208rpx;
margin-top: 20rpx;
border-radius: 20rpx 20rpx 20rpx 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
}
.charge .scrol .big .card .boxs .boxs-left {
width: 234rpx;
height: 208rpx;
background-image: url("https://www.jiubaotongxue.love/image/demo43.png");
background-size: 100% 100%;
}
.charge .scrol .big .card .boxs .boxs-left .boxs-left-top {
display: block;
width: 100%;
height: 66rpx;
line-height: 66rpx;
text-align: center;
margin-top: 46rpx;
font-size: 48rpx;
color: white;
}
.charge .scrol .big .card .boxs .boxs-left .boxs-left-tops {
display: block;
width: 100%;
height: 40rpx;
line-height: 40rpx;
text-align: center;
font-size: 28rpx;
color: white;
margin-top: 12rpx;
}
.charge .scrol .big .card .boxs .boxs-right {
width: 460rpx;
height: 208rpx;
background-image: url("https://www.jiubaotongxue.love/image/demo44.png");
background-size: 100% 100%;
box-sizing: border-box;
padding-left: 28rpx;
}
.charge .scrol .big .card .boxs .boxs-right .boxs-right-top {
width: 100%;
height: 42rpx;
font-weight: 500;
font-size: 30rpx;
color: #242526;
line-height: 42rpx;
margin-top: 34rpx;
font-weight: 700;
}
.charge .scrol .big .card .boxs .boxs-right .boxs-right-tops {
width: 100%;
height: 34rpx;
font-weight: 400;
font-size: 24rpx;
color: rgba(36, 37, 38, 0.5);
line-height: 34rpx;
font-style: normal;
margin-top: 14rpx;
}
.charge .scrol .big .card .boxs .boxs-right .line {
width: 100%;
height: 2rpx;
border-top: 1rpx solid #E6E6E6;
margin-top: 16rpx;
}
.charge .scrol .big .card .boxs .boxs-right .boxs-right-bottom {
width: 100%;
height: 34rpx;
font-weight: 400;
font-size: 24rpx;
color: rgba(36, 37, 38, 0.5);
line-height: 34rpx;
margin-top: 16rpx;
}
.charge .scrol .big .card .boxs .boxs-Btn {
position: absolute;
right: 28rpx;
top: 28rpx;
width: 88rpx;
height: 48rpx;
text-align: center;
line-height: 48rpx;
font-size: 22rpx;
color: white;
background: linear-gradient(135deg, #FEB44C 0%, #FF8833 100%);
border-radius: 25rpx 25rpx 25rpx 25rpx;
}
.charge .scrol .big .card .boxs .boxs-Btns {
position: absolute;
right: 24rpx;
top: 24rpx;
width: 88rpx;
height: 88rpx;
border-radius: 50%;
background-size: 100% 100%;
}
.charge .scrol .big .card .boxs .boxsBtnsActive {
background-image: url("https://www.jiubaotongxue.love/image/demo45.png");
}
.charge .scrol .big .card .boxs .boxsBtnsActives {
background-image: url("https://www.jiubaotongxue.love/image/demo46.png");
}
.charge .scrol .big .card .couponsActive {
border: 1rpx solid #3f95ff;
}
.charge .charge-play {
width: 92%;
height: 200rpx;
margin-left: 50%;
transform: translateX(-50%);
border-radius: 20rpx 20rpx 20rpx 20rpx;
}
.charge .charge-play .charge-body-title {
width: 100%;
height: 80rpx;
box-sizing: border-box;
line-height: 80rpx;
padding-left: 20rpx;
font-size: 32rpx;
font-weight: 700;
color: #666;
}
.charge .charge-play .charge-play-icon {
width: 100%;
height: 110rpx;
margin-top: 15rpx;
display: flex;
justify-content: space-between;
align-items: center;
background-color: white;
border-radius: 20rpx 20rpx 20rpx 20rpx;
}
.charge .charge-play .charge-play-icon .icon-left {
width: 260rpx;
height: 90rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rp;
}
.charge .charge-play .charge-play-icon .icon-left .icon-img {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
margin-left: 30rpx;
}
.charge .charge-play .charge-play-icon .icon-right {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
border: 1rpx solid #666;
margin-right: 50rpx;
}
.charge .charge-play .charge-play-icon .icon-active {
border: none;
background-size: 100% 100%;
background-image: url("https://www.jiubaotongxue.love/image/xuanzhong.png");
}
.charge .charge-btnPlay {
position: fixed;
bottom: 0rpx;
width: 100%;
height: 140rpx;
background-color: white;
line-height: 140rpx;
color: white;
display: flex;
justify-content: space-between;
box-sizing: border-box;
padding-left: 30rpx;
}
.charge .charge-btnPlay .charge-btnPlay-left {
color: black;
font-size: 30rpx;
}
.charge .charge-btnPlay .charge-btnPlay-left .pricess {
font-size: 40rpx;
color: #FF7733;
}
.charge .charge-btnPlay .plays {
width: 280rpx;
height: 96rpx;
background: linear-gradient(135deg, #4D97FF 0%, #3377FF 100%), linear-gradient(276deg, #1C9FF7 0%, #1275F7 100%);
box-shadow: 0rpx 8rpx 18rpx 0rpx rgba(5, 128, 255, 0.2);
border-radius: 50rpx;
text-align: center;
line-height: 96rpx;
margin-right: 30rpx;
margin-top: 20rpx;
}

@ -7,6 +7,13 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "",
"pathName": "pages/payCoupons/payCoupons",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/secondaryCard/secondaryCard",

@ -1,6 +1,7 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const api_api = require("../../api/api.js");
const common_baseurl = require("../../common/baseurl.js");
const coupons = common_vendor.defineStore("coupons", () => {
const couponsData = common_vendor.ref([]);
const ups = common_vendor.ref([]);
@ -10,6 +11,8 @@ const coupons = common_vendor.defineStore("coupons", () => {
const isShow = common_vendor.ref();
const que = common_vendor.ref(0);
const id = common_vendor.ref();
const p = common_vendor.ref(0);
const orderid = common_vendor.ref();
const getcouponsData = async () => {
couponsData.value = await api_api.getCouponList({
phoneNumber: common_vendor.index.getStorageSync("phoneNumber")
@ -72,15 +75,22 @@ const coupons = common_vendor.defineStore("coupons", () => {
common_vendor.index.setStorageSync("mid", mid);
console.log(mid);
}
api_api.getShopid({
mid: common_vendor.index.getStorageSync("mid"),
phone: common_vendor.index.getStorageSync("phoneNumber")
}).then((res) => {
console.log(res);
console.log(res.data.networkId);
id.value = res.data.networkId;
que.value = 1;
});
console.log(resDats.value);
if (resDats.value.amount > 0) {
common_vendor.index.navigateTo({
url: "/pages/payCoupons/payCoupons"
});
} else {
api_api.getShopid({
mid: common_vendor.index.getStorageSync("mid"),
phone: common_vendor.index.getStorageSync("phoneNumber")
}).then((res) => {
console.log(res);
console.log(res.data.networkId);
id.value = res.data.networkId;
que.value = 1;
});
}
}
};
const scanQrcode = (data) => {
@ -126,7 +136,9 @@ const coupons = common_vendor.defineStore("coupons", () => {
common_vendor.index.setStorageSync("orderid", res5);
common_vendor.index.setStorageSync("msg", "拉新券");
await api_api.getTimeOrder({
phoneNumber: common_vendor.index.getStorageSync("phoneNumber"),
phoneNumber: common_vendor.index.getStorageSync(
"phoneNumber"
),
amount: 0,
goodsId: resDats.value.id,
goodsType: 3,
@ -135,7 +147,7 @@ const coupons = common_vendor.defineStore("coupons", () => {
payType: 4,
//
deviceId: common_vendor.index.getStorageSync("mid"),
orderId: orderid.value
orderId: res5
});
common_vendor.index.redirectTo({
url: "/pages/complete/complete"
@ -166,6 +178,145 @@ const coupons = common_vendor.defineStore("coupons", () => {
}
});
};
const wxPlay = async (datas) => {
console.log(datas);
if (!common_vendor.index.getStorageSync("phoneNumber")) {
common_vendor.index.showToast({
icon: "none",
title: "账号未登录,请先登录",
duration: 1e3
});
return;
}
if (p.value == 1) {
return;
}
p.value = 1;
const res = await api_api.getTimeStamps();
orderid.value = res;
if (res === "机器正在工作") {
common_vendor.index.showToast({
icon: "none",
title: `${res}`
});
p.value = 0;
} else {
console.log("out_trade_no", res);
console.log("这是订单号" + res);
const res1 = await api_api.getWxPlay({
appId: common_baseurl.appid,
phone: common_vendor.index.getStorageSync("phoneNumber"),
openId: common_vendor.index.getStorageSync("openid"),
out_trade_no: res,
amount: datas.amount,
description: "拉新券洗车",
shopId: datas.id,
machineId: datas.networkId
});
console.log(res1);
common_vendor.index.requestPayment({
provider: "wxpay",
timeStamp: res1.timeStamp,
nonceStr: res1.nonceStr,
package: res1.package,
signType: res1.signType,
paySign: res1.paySign,
//付款成功进入执行启动设备
success: async (res2) => {
console.log("用户付款成功", res2);
const res4 = await api_api.start({
mid: common_vendor.index.getStorageSync("mid"),
price: 100,
time: datas.freeTime * 60,
description: "拉新券洗车",
orderId: orderid.value,
phone: common_vendor.index.getStorageSync("phoneNumber"),
openId: common_vendor.index.getStorageSync("openid")
});
console.log(res4);
if (res4.code == 200 || res4.code == 0) {
common_vendor.index.showToast({
icon: "none",
title: "启动设备成功",
duration: 1e3,
success: async (res3) => {
p.value = 0;
common_vendor.index.setStorageSync(
"orderid",
orderid.value
);
common_vendor.index.setStorageSync("msg", "拉新券洗车");
await api_api.getTimeOrder({
phoneNumber: common_vendor.index.getStorageSync("phoneNumber"),
amount: datas.amount,
goodsId: datas.id,
goodsType: 3,
//洗车订单
networkId: datas.networkId,
payType: 4,
//微信支付,
deviceId: common_vendor.index.getStorageSync("mid"),
orderId: orderid.value
});
common_vendor.index.redirectTo({
url: "/pages/complete/complete"
});
const qaq = await api_api.getTincheCoupons({
phoneNumber: common_vendor.index.getStorageSync("phoneNumber"),
oderId: orderid.value
});
common_vendor.index.showToast({
icon: "none",
title: `${qaq.msg}`
});
const currentDate = /* @__PURE__ */ new Date();
const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, "0");
const day = String(currentDate.getDate()).padStart(2, "0");
const hours = String(currentDate.getHours()).padStart(2, "0");
const minutes = String(currentDate.getMinutes()).padStart(2, "0");
const seconds = String(currentDate.getSeconds()).padStart(2, "0");
const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const qaq1 = await getExcellent({
time: formattedDate,
networkId: datas.networkId
});
console.log(qaq1);
}
});
} else {
console.log(res4);
common_vendor.index.showToast({
icon: "none",
title: `请在我的页面联系客服解决`,
duration: 1200,
success: (res3) => {
p.value = 0;
common_vendor.index.setStorageSync(
"orderid",
orderid.value
);
common_vendor.index.setStorageSync("msg", "拉新券洗车");
}
});
}
},
//付款失败 提示原因
fail: (err) => {
p.value = 0;
console.log("用户付款失败", err);
if (err) {
common_vendor.index.showToast({
title: "用户付款失败",
icon: "none",
duration: 1e3
});
}
}
});
}
p.value = 0;
};
return {
couponsData,
getcouponsData,
@ -175,7 +326,8 @@ const coupons = common_vendor.defineStore("coupons", () => {
quexio,
goStar,
isShowCoupons,
isShow
isShow,
wxPlay
};
});
exports.coupons = coupons;

Loading…
Cancel
Save