邮储音视频活动

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_SECRET = '6fpfwdkgcggyk0yf2yb6bt'
# VITE_YCNC_APPID = '2vikrqptiia9pe9bf5ztrd'
# 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_YCNC_MERCH_CODE = '100310100018908'
# VITE_YCNC_MERCH_CODE = '100610100019042'
# 邮储奶茶活动(正式环境)
# VITE_BASE_URL = 'https://milk.api.cdlsxd.cn'
# VITE_YCNC_MERCH_CODE = '100510102303326'

View File

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

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@
import { useMessage } from 'wot-design-uni'
import OrderItem from './components/order-item';
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 { tabs } from './config';
import {deepClone} from '../../utils/utils'
@ -117,9 +117,20 @@
}
function pay(orderData){
async function pay(orderData){
console.log(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();
payFunc({order_no,notify_url,TranAmt:price,MerName:brand,sign,plain_text})
}
@ -193,7 +204,6 @@
})
function queryNext(){
console.log(unref(isLastPage));
if(unref(isLastPage)){
console.error('已经是最后一页');
return false;

View File

@ -155,9 +155,19 @@ const goRefund = () => {
})
}
function pay(orderData) {
async function pay(orderData) {
console.log(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();
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 = {
1: "待支付",
2: "已支付",
@ -51,3 +78,5 @@ export const tabs = [
status: 7,
},
];
export default config

View File

@ -101,14 +101,16 @@ function handleClick({ index, name }) {
function pay(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;
const price = orderData.order_amount
const MerName = orderData.brandName
const { payFunc } = usePay();
payFunc({
order_no,
notify_url,
TranAmt: price,
MerName: brand,
MerName: MerName,
sign,
plain_text,
});

View File

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

View File

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

View File

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