邮储音视频活动

This commit is contained in:
xiaogang 2024-12-16 10:20:19 +08:00
parent 3b331fb52f
commit 360655a082
13 changed files with 120 additions and 55 deletions

8
.env
View File

@ -1,3 +1,7 @@
# 邮储奶茶活动 # 邮储奶茶活动
VITE_YCNC_APPID = '2vikrqptiia9pe9bf5ztrd' # VITE_YCNC_APPID = '2vikrqptiia9pe9bf5ztrd'
VITE_YCNC_SECRET = '6fpfwdkgcggyk0yf2yb6bt' # VITE_YCNC_SECRET = '6fpfwdkgcggyk0yf2yb6bt'
# 邮储音视频
VITE_YCNC_APPID = '2vi3695tiia9pe9bf5yyyi'
VITE_YCNC_SECRET = '6fpf26837kmgr0yf2yf643'

View File

@ -4,7 +4,6 @@
# 邮储奶茶活动(测试环境) # 邮储奶茶活动(测试环境)
# VITE_BASE_URL = 'http://milk.test.api.cdlsxd.cn' # VITE_BASE_URL = 'http://milk.test.api.cdlsxd.cn'
# VITE_YCNC_MERCH_CODE = '100310100018908' # VITE_YCNC_MERCH_CODE = '100310100018908'
# VITE_YCNC_MERCH_CODE = '100610100019042'
# 邮储奶茶活动(正式环境) # 邮储奶茶活动(正式环境)
# VITE_BASE_URL = 'https://milk.api.cdlsxd.cn' # VITE_BASE_URL = 'https://milk.api.cdlsxd.cn'
# VITE_YCNC_MERCH_CODE = '100510102303326' # VITE_YCNC_MERCH_CODE = '100510102303326'

View File

@ -20,4 +20,5 @@ vite打包配置文件主要是一些插件
### 各个模块的说明 ### 各个模块的说明
ycnc 邮储奶茶活动 ycnc 邮储奶茶活动
xyyk 兴业半价优酷的活动 xyyk 兴业半价优酷的活动
ycysp 邮储音视频活动------>测试环境下vite.config.js配置base,http配置请求content-type

View File

@ -5,6 +5,7 @@ import path from 'path'
const config = { const config = {
pages:'./src/pages', pages:'./src/pages',
pagesInclude:['ycysp/home.vue','ycysp/pay.vue','ycysp/order.vue','ycysp/orderDetail.vue',] pagesInclude:['ycysp/home.vue','ycysp/pay.vue','ycysp/order.vue','ycysp/orderDetail.vue',]
// pagesInclude:['ycnc',]
} }
const { pages, pagesInclude } = config const { pages, pagesInclude } = config
@ -37,7 +38,8 @@ const getPages = () => {
const targetExclude = targetPages.filter(elem => !targetModule[ele].includes(elem)).map(current => `${ele}/${current}`) const targetExclude = targetPages.filter(elem => !targetModule[ele].includes(elem)).map(current => `${ele}/${current}`)
excludePages.push(...targetExclude) excludePages.push(...targetExclude)
}) })
console.log('排除的模块以及页面',[...excludeModule,...excludePages]); console.log('打包的模块以及页面',[...config.pagesInclude]);
console.error('排除的模块以及页面',[...excludeModule,...excludePages]);
return { return {
exclude:[...excludeModule,...excludePages], exclude:[...excludeModule,...excludePages],
} }

View File

@ -16,16 +16,17 @@
<body> <body>
<div id="app"><!--app-html--></div> <div id="app"><!--app-html--></div>
<script type="module" src="/src/main.js"></script> <script type="module" src="/src/main.js"></script>
<script src="./static/YT_Client_api.js"></script>
<script> <script>
document.addEventListener('touchmove', function(e) { // document.addEventListener('touchmove', function(e) {
e.preventDefault(); // e.preventDefault();
}, {passive: false}) // }, {passive: false})
</script> </script>
<!-- <script src="https://fastly.jsdelivr.net/npm/eruda"></script> <script src="https://fastly.jsdelivr.net/npm/eruda"></script>
<script> <script>
eruda.init() eruda.init()
</script> --> </script>
<script> <!-- <script>
var clickCount = 0 var clickCount = 0
var timer = null var timer = null
var isShow = false var isShow = false
@ -62,7 +63,7 @@
clickCount = 0 // 重置点击计数 clickCount = 0 // 重置点击计数
} }
} }
}) }) -->
</script> </script>
</body> </body>
</html> </html>

View File

@ -7,9 +7,9 @@ export default {
onHide: function () { onHide: function () {
}, },
created(){ created(){
const script = document.createElement('script'); // const script = document.createElement('script');
script.src = './static/YT_Client_api.js'; // JS // script.src = './static/YT_Client_api.js'; // JS
document.body.appendChild(script); // document.body.appendChild(script);
} }
} }
</script> </script>

View File

@ -49,7 +49,7 @@
import { useMessage } from 'wot-design-uni' import { useMessage } from 'wot-design-uni'
import OrderItem from './components/order-item'; import OrderItem from './components/order-item';
import usePay from './hooks/usePay'; import usePay from './hooks/usePay';
import { getOrderList,deleteOrder,refundOrder } from '../../api/ycnc'; import { getOrderList,deleteOrder,refundOrder,queryOrderDetail } from '../../api/ycnc';
import { onMounted, ref, unref,reactive,computed } from 'vue'; import { onMounted, ref, unref,reactive,computed } from 'vue';
import { tabs } from './config'; import { tabs } from './config';
import {deepClone} from '../../utils/utils' import {deepClone} from '../../utils/utils'
@ -117,9 +117,20 @@
} }
function pay(orderData){ async function pay(orderData){
console.log(orderData); console.log(orderData);
const {order_no,notify_url,price,brand,sign,plain_text} = orderData; const {order_no,notify_url,price,brand,sign,plain_text} = orderData;
const queryParams = {order_no}
const res = await queryOrderDetail({queryParams})
if(res.third_status === '03'){
uni.showToast({
title: '当前订单已支付成功,无需再支付~',
icon: 'none'
});
replace.value = true;
queryOrderList()
return
}
const {payFunc} = usePay(); const {payFunc} = usePay();
payFunc({order_no,notify_url,TranAmt:price,MerName:brand,sign,plain_text}) payFunc({order_no,notify_url,TranAmt:price,MerName:brand,sign,plain_text})
} }
@ -193,7 +204,6 @@
}) })
function queryNext(){ function queryNext(){
console.log(unref(isLastPage));
if(unref(isLastPage)){ if(unref(isLastPage)){
console.error('已经是最后一页'); console.error('已经是最后一页');
return false; return false;

View File

@ -155,9 +155,19 @@ const goRefund = () => {
}) })
} }
function pay(orderData) { async function pay(orderData) {
console.log(orderData); console.log(orderData);
const { order_no, notify_url, price,brand,sign,plain_text } = orderData; const { order_no, notify_url, price,brand,sign,plain_text } = orderData;
const queryParams = {order_no}
const res = await queryOrderDetail({queryParams})
if(res.third_status === '03'){
uni.showToast({
title: '当前订单已支付成功,无需再支付~',
icon: 'none'
});
getDetail()
return
}
const { payFunc } = usePay(); const { payFunc } = usePay();
payFunc({ order_no, notify_url, TranAmt: price,MerName:brand,sign,plain_text }) payFunc({ order_no, notify_url, TranAmt: price,MerName:brand,sign,plain_text })
} }

View File

@ -1,3 +1,30 @@
const config = {
1:{
name:'优酷',
},
2:{
name:'腾讯',
},
3:{
name:'网易云',
},
4:{
name:'芒果TV',
},
5:{
name:'QQ音乐',
},
6:{
name:'喜马拉雅',
},
7:{
name:'哔哩哔哩',
},
8:{
name:'爱奇艺',
},
}
export const stateConfig = { export const stateConfig = {
1: "待支付", 1: "待支付",
2: "已支付", 2: "已支付",
@ -51,3 +78,5 @@ export const tabs = [
status: 7, status: 7,
}, },
]; ];
export default config

View File

@ -101,14 +101,16 @@ function handleClick({ index, name }) {
function pay(orderData) { function pay(orderData) {
console.log(orderData); console.log(orderData);
const { order_no, notify_url, price, brand, sign, plain_text } = const { order_no, notify_url, sign, plain_text } =
orderData.pay_info; orderData.pay_info;
const price = orderData.order_amount
const MerName = orderData.brandName
const { payFunc } = usePay(); const { payFunc } = usePay();
payFunc({ payFunc({
order_no, order_no,
notify_url, notify_url,
TranAmt: price, TranAmt: price,
MerName: brand, MerName: MerName,
sign, sign,
plain_text, plain_text,
}); });

View File

@ -28,7 +28,7 @@
</view> </view>
<view class="flex num"> <view class="flex num">
<view>充值账号</view> <view>充值账号</view>
<view>{{ maskPhoneNumber(orderDetail.account) }}</view> <view>{{ orderDetail.account ? maskPhoneNumber(orderDetail.account) : '' }}</view>
</view> </view>
<view class="flex flex-justify-between num"> <view class="flex flex-justify-between num">
<view>数量</view> <view>数量</view>
@ -151,13 +151,15 @@ function maskPhoneNumber(phoneNumber) {
} }
function pay(orderData) { function pay(orderData) {
const { order_no, notify_url, price, brand, sign, plain_text } = orderData; const { order_no, notify_url,sign, plain_text } = orderData;
const price = orderData.order_amount
const MerName = orderData.brandName
const { payFunc } = usePay(); const { payFunc } = usePay();
payFunc({ payFunc({
order_no, order_no,
notify_url, notify_url,
TranAmt: price, TranAmt: price,
MerName: brand, MerName: MerName,
sign, sign,
plain_text, plain_text,
}); });

View File

@ -35,7 +35,7 @@
<view class="line"></view> <view class="line"></view>
<view class="order-info"> <view class="order-info">
<view class="order-item" <view class="order-item"
>充值账户{{ maskPhoneNumber(orderDetail.account) }}</view >充值账户{{ orderDetail.account ? maskPhoneNumber(orderDetail.account) : '' }}</view
> >
<view class="order-item">充值类型{{ orderDetail.product_type }}</view> <view class="order-item">充值类型{{ orderDetail.product_type }}</view>
<!-- <view class="order-item">优惠金额{{ discount }}</view> --> <!-- <view class="order-item">优惠金额{{ discount }}</view> -->
@ -55,6 +55,7 @@ import { onShow, onLoad } from "@dcloudio/uni-app";
import { ref, reactive, unref, onMounted, computed } from "vue"; import { ref, reactive, unref, onMounted, computed } from "vue";
import { createOrder, getOrderList } from "@/api/ycysp"; import { createOrder, getOrderList } from "@/api/ycysp";
import usePay from "./hooks/usePay"; import usePay from "./hooks/usePay";
import config from './config';
const orderDetail = reactive({}); const orderDetail = reactive({});
const _order_no = ref(""); const _order_no = ref("");
@ -83,8 +84,8 @@ const goPay = () => {
payFunc({ payFunc({
order_no, order_no,
notify_url, notify_url,
TranAmt: voucherAmount, TranAmt: orderDetail.order_amount,
MerName: config[brandFlag].name, MerName: orderDetail.brandName,
sign, sign,
plain_text, plain_text,
}); });

View File

@ -1,22 +1,26 @@
const fs = require("fs-extra");
const fs = require('fs-extra') const path = require("path");
const path = require('path');
// Vite插件函数 // Vite插件函数
function vitePluginRemoveDir(options = {}) { function vitePluginRemoveDir(options = {}) {
// 默认要删除的目录名 // 默认要删除的目录名
const { dirName } = options; const { dirName } = options;
if (!dirName.length) { if (!dirName.length) {
return {} return {};
} }
return { return {
name: 'vite-plugin-remove-dir', // 插件名称 name: "vite-plugin-remove-dir", // 插件名称
closeBundle() { closeBundle() {
const distDir = path.resolve(process.cwd(), 'dist'); const distDir = path.resolve(process.cwd(), "dist");
// 构建结束后执行的逻辑 // 构建结束后执行的逻辑
for (const item of dirName) { for (const item of dirName) {
const fullPath = path.join(distDir, ['production'].includes(process.env.NODE_ENV) ? 'build' : 'dev',process.env.UNI_PLATFORM,`static/${item}`); // 构造要删除的目录的完整路径 const fullPath = path.join(
console.log('fullPath',fullPath); distDir,
["production"].includes(process.env.NODE_ENV) ? "build" : "dev",
process.env.UNI_PLATFORM,
`static/${item}`
); // 构造要删除的目录的完整路径
console.log("fullPath", fullPath);
// 尝试删除目录 // 尝试删除目录
try { try {
fs.removeSync(fullPath); fs.removeSync(fullPath);
@ -25,7 +29,7 @@ function vitePluginRemoveDir(options = {}) {
console.log(`目录${fullPath}删除失败-->${err}`); console.log(`目录${fullPath}删除失败-->${err}`);
} }
} }
} },
}; };
} }