Browse Source

fix all

dev
刘嘉炜 1 week ago
parent
commit
3b69f8b621
  1. 1
      src/api/index.js
  2. 3
      src/subpackage/authorize/pages/index.vue
  3. 1
      src/subpackage/groupon/api/index.js
  4. 5
      src/subpackage/groupon/pages/confirm_order/ticket.vue
  5. 52
      src/subpackage/groupon/pages/confirm_order/venue.vue
  6. 4
      src/subpackage/groupon/pages/list.vue
  7. 2
      src/subpackage/order/pages/detail.vue

1
src/api/index.js

@ -8,3 +8,4 @@ export const login = params => server.post({ url: '/Admino/AdminUser/login', ...
export const stadiumFind = params => server.post({ url: '/stadium/find', ...params }); // 登录
export const stadiumBookList = params => server.post({ url: '/stadium/book/list', ...params }); // 订场列表
export const orderList = params => server.post({ url: '/stadium/order/list', ...params }); // 预约订单列表

3
src/subpackage/authorize/pages/index.vue

@ -142,7 +142,8 @@ function successOperate(res){
console.log(res);
showNone(res?.message || '登陆成功!');
let _data = res?.data ?? {};
uni.setStorageSync('token',_data?.token ?? '');
uni.setStorageSync('token', _data?.token ?? '');
uni.setStorageSync('userInfo', _data?.user ?? {});
setTimeout(routeOperate, 1200);
}

1
src/subpackage/groupon/api/index.js

@ -13,6 +13,7 @@ export const orderPayMini = params => server.post({ url: '/stadium/order/pay/min
export const getOrder = params => server.post({ url: '/douyinMiniapp/202506/getOrder', ...params }); // 轮询获取订单号, 轮询了多久以后就直接放弃了
export const orderGet = params => server.post({ url: '/stadium/order/get', ...params }); // 预约订单详情
export const computedPayInfo = params => server.post({ url: '/stadium/order/pay/info', ...params }); // 订单支付接口-积分优惠券计算
export const userCurrent = params => server.post({ url: '/user/current', ...params }); // 获取当前用户信息

5
src/subpackage/groupon/pages/confirm_order/ticket.vue

@ -9,6 +9,7 @@ import { formatDate } from "@/utils";
const stadiumInfo = ref({}); //
const ticketInfo = ref({}); //
const verify_token = ref('');
const POI_ID = ref('');
onLoad(() => {
});
@ -48,8 +49,8 @@ function pvc_func({
})
.then(res=>{
// routeTo(`/subpackage/groupon/pages/exchange_success`);
console.log('jsapiPreVerifyCertificates', res);
verify_token.value = res?.data?.verify_token ?? '';
POI_ID.value = res?.data?.poi_id ?? '';
})
}
function confirmBtn(){
@ -57,7 +58,7 @@ function confirmBtn(){
let _sVal = stadiumInfo.value;
const _query = {
verifyToken: verify_token.value ?? '',
poiId: _tVal?.poi_id ?? '',
poiId: POI_ID.value ?? '',
orderList: [{
orderId: _tVal?.order_id ?? '',
certificateList: [{

52
src/subpackage/groupon/pages/confirm_order/venue.vue

@ -4,26 +4,29 @@ import { reactive, ref, onMounted, getCurrentInstance } from "vue";
import confirmTemplate from "../../components/confirm_template.vue";
import ticketItem from "../../components/ticket_item.vue";
import venueInfo from "../../components/venue_info.vue";
import { jsapiPreVerifyCertificates, orderAdd, orderPayMini, computedPayInfo } from "../../api";
import { jsapiPreVerifyCertificates, orderAdd, orderPayMini, computedPayInfo, userCurrent } from "../../api";
import { routeTo, showModal, showLoad, hideLoad } from '@/utils/polish';
import { accAdd } from "@/utils/calculation";
const stadiumInfo = ref({});
const ticketInfo = ref({});
const venueData = ref({});
const verify_token = ref('');
const POI_ID = ref('');
const APPID = tt.getEnvInfoSync()?.microapp?.appId ?? '';
const computedPrice = ref(-1);
const MobileNum = ref(''); //
onMounted(() =>{
setDefaultMobileNum();
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel();
eventChannel.on('dataFromGrouponSiteSelect', data => {
eventChannel.on('dataFromGrouponSiteSelect', async data => {
let { stadium, ticket, venueInfo } = data;
stadiumInfo.value = stadium ?? {};
ticketInfo.value = ticket ?? {};
venueData.value = venueInfo ?? {};
console.warn('dataFromGrouponSiteSelect data', data);
let _classTags = (venueInfo?.venues ?? []).map(e=>e?._class_tag ?? '');
pvc_func({
let _token = await pvc_func({
appid: APPID,
brand_id: stadium?.brand_id ?? '',
stadium_id: stadium?.id ?? '',
@ -35,12 +38,15 @@ onMounted(() =>{
classify: venueInfo?.classify ?? '',
class_tags: _classTags.filter(e=>e!=='').join(','),
})
if(!_token)return;
let _totalPrice = 0;
venueInfo.venues.forEach(e=>{
_totalPrice = accAdd(_totalPrice, e?.price ?? 0);
});
// 0
computedPayInfo({
data: {
appid: APPID,
brand_id: stadium?.brand_id ?? '',
stadium_id: stadium?.id ?? '',
amount: _totalPrice,
@ -55,32 +61,37 @@ onMounted(() =>{
start: `${_date} ${start}:00`,
end: `${_date} ${end}:00`,
tag: e?._class_tag ?? '',
price: e?.price ?? 0,
price: +(e?.price ?? 0),
}
}),
douyin_groupon_coupon_code: ticket?.certificate_id ?? ''
}
})
.then(res=>{
console.warn('computedPayInfo--->', res);
computedPrice.value = res?.data?.pay_amount ?? -1;
})
})
})
function pvc_func(data){
jsapiPreVerifyCertificates({ data })
return jsapiPreVerifyCertificates({ data })
.then(res=>{
// routeTo(`/subpackage/groupon/pages/exchange_success`);
console.log('jsapiPreVerifyCertificates', res);
verify_token.value = res?.data?.verify_token ?? '';
let _token = res?.data?.verify_token ?? '';
verify_token.value = _token;
POI_ID.value = res?.data?.poi_id ?? '';
return _token
})
}
function confirmBtn(){
if(computedPrice.value !== 0)return;
if(!isPhoneNumber(MobileNum.value))return showModal({ content: '请输入正确的手机号码' });
let _tVal = ticketInfo.value;
const _query = {
verifyToken: verify_token.value ?? '',
poiId: _tVal?.poi_id ?? '',
poiId: POI_ID.value ?? '',
orderList: [{
orderId: _tVal?.order_id ?? '',
certificateList: [ _tVal?.certificate_id ?? '' ]
@ -128,6 +139,7 @@ function createServerOrder(){
verify_token: verify_token.value ?? '',
douyin_merchant_pay_amount: _tVal?.douyin_merchant_pay_amount ?? 0,
douyin_groupon_coupon_code: _tVal?.certificate_id ?? '',
mobile: MobileNum.value ?? '',
})
.then(cRes=>{
console.log('createBookOrder', cRes);
@ -157,6 +169,15 @@ function createBookOrder(data){
})
}
function setDefaultMobileNum(e){
let _user = uni.getStorageSync('userInfo') || {};
MobileNum.value = _user?.mobile ?? '';
}
function isPhoneNumber(number) {
return /^1[3-9]\d{9}$/.test(number);
}
</script>
<template>
@ -194,12 +215,12 @@ function createBookOrder(data){
<view class="vc-txt">温馨提示团购券需一次性使用完一经使用不退不换</view>
</view>
<!-- 没有这个字段 -->
<view class="vc-box vc-contact" v-if="false">
<view class="vc-box vc-contact">
<view class="vc-title">*联系方式</view>
<view class="vc-txt">为了场馆更好地为您服务请准确填写您的联系方式</view>
<view class="vc-phone">
<view class="vp-name">手机号码</view>
<input type="phone" class="vp-ipt" />
<input type="phone" class="vp-ipt" v-model="MobileNum" />
</view>
</view>
<view class="vc-box vc-notice">
@ -210,11 +231,12 @@ function createBookOrder(data){
</view>
<template #fixed>
<view class="ti-fixed">
<view class="cf-price" v-if="0 >= 0">
<text class="cp-txt">应付金额</text> ¥{{ 0 }}
<view class="ti-fixed" v-if="computedPrice >= 0">
<view class="cf-price">
<text class="cp-txt">应付金额</text> ¥{{ computedPrice }}
</view>
<button v-if="verify_token" class="cf-btn" :class="{ 'cf-full': 0 < 0 }" @click="confirmBtn" data-eventsync>确认兑换</button>
<!-- 后台 如果你从接口获取的金额如果超过0就不给下订单 -->
<button v-if="verify_token&&computedPrice === 0" class="cf-btn" :class="{ 'cf-full': 0 < 0 }" @click="confirmBtn" data-eventsync>确认兑换</button>
</view>
</template>
</confirm-template>

4
src/subpackage/groupon/pages/list.vue

@ -10,7 +10,7 @@ onLoad(() => {
data: {
appid: tt.getEnvInfoSync()?.microapp?.appId ?? '',
data: JSON.stringify({
"account_id": "7419147144797358116",
"account_id": "-",
"open_id": "-",
})
}
@ -36,7 +36,6 @@ function ticketClick(e){
// tt.verifyCertificates
order_id: e?.order_id ?? '',
verify_token: `${new Date().getTime()}`,
poi_id: '7174984639059068985',
certificate_id: certificates?.certificate_id ?? '',
//
encrypted_codes: certificates?.encrypted_code ?? '',
@ -54,7 +53,6 @@ function ticketClick(e){
}
});
}
</script>
<template>

2
src/subpackage/order/pages/detail.vue

@ -295,7 +295,7 @@ function imError(e){
<view class="oib-icon">&#xe625;</view>
<view class="oib-txt">客服</view>
</button>
<view class="of-refund" @click="refundBtn" v-if="orderInfo.pay_status == 1&&orderInfo.is_refundable">申请退款</view>
<!-- <view class="of-refund" @click="refundBtn" v-if="orderInfo.pay_status == 1&&orderInfo.is_refundable">申请退款</view> -->
<!-- <view class="of-refund">申请退款</view> -->
</view>
</view>

Loading…
Cancel
Save