邮储音视频更新
This commit is contained in:
parent
cbc62f1d57
commit
273a23a53c
8
.env
8
.env
|
@ -1,7 +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'
|
||||
# VITE_YCNC_APPID = '2vi3695tiia9pe9bf5yyyi'
|
||||
# VITE_YCNC_SECRET = '6fpf26837kmgr0yf2yf643'
|
|
@ -5,5 +5,5 @@ NODE_ENV = 'development'
|
|||
# VITE_BASE_URL = 'http://milk.api.test.86698.cn'
|
||||
# VITE_BASE_URL = 'http://milk.test.api.cdlsxd.cn'
|
||||
# 邮储音视频
|
||||
VITE_BASE_URL = 'http://192.168.110.128:8000/ycav'
|
||||
VITE_BASE_URL = 'https://gateway.dev.cdlsxd.cn'
|
||||
# VITE_BASE_URL = 'https://gateway.dev.cdlsxd.cn/ycav'
|
||||
|
|
|
@ -5,7 +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',]
|
||||
// pagesInclude:['ycnc']
|
||||
}
|
||||
const { pages, pagesInclude } = config
|
||||
|
||||
|
|
14
index.html
14
index.html
|
@ -18,15 +18,15 @@
|
|||
<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
|
||||
|
@ -63,7 +63,7 @@
|
|||
clickCount = 0 // 重置点击计数
|
||||
}
|
||||
}
|
||||
}) -->
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -119,9 +119,12 @@
|
|||
|
||||
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})
|
||||
const {order_no,notify_url,price,brand,sign,plain_text,id} = orderData;
|
||||
const params = {
|
||||
order_id:id,
|
||||
order_no: order_no
|
||||
}
|
||||
const res = await queryOrderDetail({params})
|
||||
if(res.third_status === '03'){
|
||||
uni.showToast({
|
||||
title: '当前订单已支付成功,无需再支付~',
|
||||
|
|
|
@ -158,9 +158,12 @@ const goRefund = () => {
|
|||
|
||||
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})
|
||||
const { order_no, notify_url, price,brand,sign,plain_text,id } = orderData;
|
||||
const params = {
|
||||
order_id:id,
|
||||
order_no: order_no
|
||||
}
|
||||
const res = await queryOrderDetail({params})
|
||||
if(res.third_status === '03'){
|
||||
uni.showToast({
|
||||
title: '当前订单已支付成功,无需再支付~',
|
||||
|
|
|
@ -95,14 +95,6 @@ function goDetail(e) {
|
|||
emits("detail-event", props.detail);
|
||||
}
|
||||
|
||||
function goPwd(e) {
|
||||
if (e.stopPropagation) {
|
||||
//W3C阻止冒泡方法
|
||||
e.stopPropagation();
|
||||
}
|
||||
emits("pwd-event", props.detail);
|
||||
}
|
||||
|
||||
function goDel(e) {
|
||||
if (e.stopPropagation) {
|
||||
//W3C阻止冒泡方法
|
||||
|
|
|
@ -35,6 +35,7 @@ export const stateConfig = {
|
|||
7: "退款成功",
|
||||
8: "充值成功",
|
||||
9: "订单作废",
|
||||
10:'支付失败'
|
||||
};
|
||||
|
||||
export const stateColor = {
|
||||
|
@ -42,7 +43,8 @@ export const stateColor = {
|
|||
3: "#FF8400",
|
||||
4: "#FF0000",
|
||||
7: "#EA722D",
|
||||
8: "#FF0000 ",
|
||||
8: "#FF0000",
|
||||
10: "#FF0000"
|
||||
};
|
||||
|
||||
export const checkedColor = {
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<view class="input-container">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="请输入手机号/QQ号充值"
|
||||
placeholder="请输入手机号充值"
|
||||
placeholder-class="pcs"
|
||||
v-model="account"
|
||||
/>
|
||||
|
@ -88,9 +88,9 @@
|
|||
>如因账号信息输入错误导致充值至他人账户,仍视为充值成功,无法补券。</view
|
||||
>
|
||||
<view class="small-text"
|
||||
>3、此权益中包含的优酷/腾讯黄金会员、芒果视频会员可在手机、电脑、平板上使用,不支持电视端,不支持投屏。<text
|
||||
>3、此权益中包含的优酷黄金会员、芒果视频会员可在手机、电脑、平板上使用,不支持电视端,不支持投屏。<text
|
||||
class="small-red"
|
||||
>腾讯视频、QQ音乐支持QQ号或手机号,</text
|
||||
>QQ音乐支持QQ号或手机号,</text
|
||||
>其余会员账号均为手机号。</view
|
||||
>
|
||||
<view class="small-text"
|
||||
|
@ -118,12 +118,12 @@ import { ref, reactive, unref, onMounted, nextTick } from "vue";
|
|||
import member from "./components/member.vue";
|
||||
import rechargeItem from "./components/recharge-item.vue";
|
||||
import { getBrandList, getProductList, login } from "@/api/ycysp";
|
||||
import { generateUUID } from "@/utils/utils";
|
||||
// import { generateUUID } from "@/utils/utils";
|
||||
import { createOrder } from "@/api/ycysp";
|
||||
import useCode from "./hooks/useCode";
|
||||
const reg =
|
||||
/^(((13[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(17[3-8]{1})|(18[0-9]{1})|(19[0-9]{1})|(14[5-7]{1}))+\d{8})$/;
|
||||
const _reg = /^[1-9][0-9]{4,}$/;
|
||||
// const reg =
|
||||
// /^(((13[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(17[3-8]{1})|(18[0-9]{1})|(19[0-9]{1})|(14[5-7]{1}))+\d{8})$/;
|
||||
// const _reg = /^[1-9][0-9]{4,}$/;
|
||||
const brandArr = ref([]);
|
||||
const productArr = ref([]);
|
||||
const account = ref("");
|
||||
|
@ -201,18 +201,18 @@ const nextEvent = () => {
|
|||
}
|
||||
if (!account.value) {
|
||||
uni.showToast({
|
||||
title: "请填写充值手机号或QQ号",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!reg.test(account.value) && !_reg.test(account.value)) {
|
||||
uni.showToast({
|
||||
title: "充值账号格式不正确",
|
||||
title: "请填写充值手机号",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
// if (!reg.test(account.value)) {
|
||||
// uni.showToast({
|
||||
// title: "充值账号格式不正确,应为手机号",
|
||||
// icon: "none",
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
addOrder(selectProduct.id);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
import md5 from 'js-md5';
|
||||
export default function useCode(){
|
||||
return new Promise((resolve,reject) => {
|
||||
const authCallback = (params) => {
|
||||
console.log('authCallback-use',params);
|
||||
const {code} = params
|
||||
resolve(code)
|
||||
}
|
||||
const getNewAuthorization = () => {
|
||||
let appId = import.meta.env.VITE_YCNC_APPID;
|
||||
let time = Date.now().toString();
|
||||
let secret = import.meta.env.VITE_YCNC_SECRET;
|
||||
let signBefore = appId + time + secret;
|
||||
let sign = md5(signBefore);//普通md5
|
||||
let param = {
|
||||
appId: appId,
|
||||
sign: sign,
|
||||
time: time,
|
||||
tran_code: "157",
|
||||
fn: "authCallback",
|
||||
needBind: ""
|
||||
};
|
||||
console.log('auth-param157-use',param);
|
||||
Fw.device.api.getNewAuthorization(param)
|
||||
};
|
||||
window.authCallback = authCallback;
|
||||
getNewAuthorization()
|
||||
})
|
||||
import md5 from "js-md5";
|
||||
export default function useCode() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const authCallback = (params) => {
|
||||
console.log("authCallback-use", params);
|
||||
const { code } = params;
|
||||
resolve(code);
|
||||
};
|
||||
const getNewAuthorization = () => {
|
||||
let appId = import.meta.env.VITE_YCNC_APPID;
|
||||
let time = Date.now().toString();
|
||||
let secret = import.meta.env.VITE_YCNC_SECRET;
|
||||
let signBefore = appId + time + secret;
|
||||
let sign = md5(signBefore); //普通md5
|
||||
let param = {
|
||||
appId: appId,
|
||||
sign: sign,
|
||||
time: time,
|
||||
tran_code: "157",
|
||||
fn: "authCallback",
|
||||
needBind: "",
|
||||
};
|
||||
console.log("auth-param157-use", param);
|
||||
Fw.device.api.getNewAuthorization(param);
|
||||
};
|
||||
window.authCallback = authCallback;
|
||||
getNewAuthorization();
|
||||
});
|
||||
}
|
|
@ -1,41 +1,45 @@
|
|||
import dayjs from "dayjs";
|
||||
import md5 from 'js-md5';
|
||||
import md5 from "js-md5";
|
||||
|
||||
const handleParams = (obj) => Object.entries(obj).reduce((total,curr) => {
|
||||
if(!total){
|
||||
total += `${curr[0]}=${curr[1]}`
|
||||
}else{
|
||||
total += `|${curr[0]}=${curr[1]}`
|
||||
const handleParams = (obj) =>
|
||||
Object.entries(obj).reduce((total, curr) => {
|
||||
if (!total) {
|
||||
total += `${curr[0]}=${curr[1]}`;
|
||||
} else {
|
||||
total += `|${curr[0]}=${curr[1]}`;
|
||||
}
|
||||
return total
|
||||
},'')
|
||||
return total;
|
||||
}, "");
|
||||
|
||||
|
||||
export default function usePay(){
|
||||
const payFunc = (args) => {
|
||||
const {order_no,notify_url,TranAmt,MerName,sign,plain_text} = args;
|
||||
const MercCode = import.meta.env.VITE_YCNC_MERCH_CODE
|
||||
const tranAmt = Number(TranAmt).toFixed(2)
|
||||
const Plain = {
|
||||
MercUrl:notify_url,
|
||||
TranAmt:tranAmt,
|
||||
TermSsn:order_no,
|
||||
BackLink:encodeURIComponent(`${window.location.origin}${window.location.pathname || ''}/#/pages/ycysp/orderDetail?order_no=${order_no}&isPayBack=true`),
|
||||
psbcmcc:'LSXD',
|
||||
TxnDt:dayjs(Date.now()).format('YYYY-MM-DD'),
|
||||
MercCode:MercCode,
|
||||
IsIntegral:'1',
|
||||
MerName:MerName,
|
||||
}
|
||||
const params = {
|
||||
Plain:handleParams(Plain),
|
||||
plainText:plain_text,
|
||||
sign:sign,
|
||||
Signature: '',
|
||||
}
|
||||
console.log('CodePay-plain',Plain);
|
||||
console.log('CodePay-params',params);
|
||||
Fw.device.api.handCodePay(params);
|
||||
}
|
||||
return {payFunc}
|
||||
export default function usePay() {
|
||||
const payFunc = (args) => {
|
||||
const { order_no, notify_url, TranAmt, MerName, sign, plain_text } = args;
|
||||
const MercCode = import.meta.env.VITE_YCNC_MERCH_CODE;
|
||||
const tranAmt = Number(TranAmt).toFixed(2);
|
||||
const Plain = {
|
||||
MercUrl: notify_url,
|
||||
TranAmt: tranAmt,
|
||||
TermSsn: order_no,
|
||||
BackLink: encodeURIComponent(
|
||||
`${window.location.origin}${
|
||||
window.location.pathname || ""
|
||||
}/#/pages/ycysp/orderDetail?order_no=${order_no}&isPayBack=true`
|
||||
),
|
||||
psbcmcc: "LSXD",
|
||||
TxnDt: dayjs(Date.now()).format("YYYY-MM-DD"),
|
||||
MercCode: MercCode,
|
||||
IsIntegral: "1",
|
||||
MerName: MerName,
|
||||
};
|
||||
const params = {
|
||||
Plain: handleParams(Plain),
|
||||
plainText: plain_text,
|
||||
sign: sign,
|
||||
Signature: "",
|
||||
};
|
||||
console.log("CodePay-plain", Plain);
|
||||
console.log("CodePay-params", params);
|
||||
Fw.device.api.handCodePay(params);
|
||||
};
|
||||
return { payFunc };
|
||||
}
|
|
@ -25,7 +25,6 @@
|
|||
:detail="ele"
|
||||
@pay-event="pay"
|
||||
@detail-event="viewDetail"
|
||||
@pwd-event="viewPwd"
|
||||
@del-event="removeOrder"
|
||||
@refund-event="refund"
|
||||
/>
|
||||
|
@ -123,16 +122,6 @@ function viewDetail(orderData) {
|
|||
});
|
||||
}
|
||||
|
||||
function viewPwd(orderData) {
|
||||
const { voucher_link } = orderData;
|
||||
if (voucher_link) {
|
||||
console.log("跳转外部链接--->", voucher_link);
|
||||
window.location.href = voucher_link;
|
||||
} else {
|
||||
console.error(`${voucher_link}无有效值`);
|
||||
}
|
||||
}
|
||||
|
||||
function removeOrder(orderData) {
|
||||
message
|
||||
.confirm({
|
||||
|
|
|
@ -90,10 +90,11 @@
|
|||
<script setup>
|
||||
import { onShow, onHide, onUnload } from "@dcloudio/uni-app";
|
||||
import { onMounted, reactive, ref, unref } from "vue";
|
||||
import { getOrderList, refundOrder } from "@/api/ycysp";
|
||||
import { getOrderList, refundOrder,login } from "@/api/ycysp";
|
||||
import { getQueryString } from "@/utils/utils";
|
||||
import { stateConfig, stateColor } from "./config";
|
||||
import usePay from "./hooks/usePay";
|
||||
import useCode from "./hooks/useCode";
|
||||
|
||||
const id = ref("");
|
||||
const orderNo = ref("");
|
||||
|
@ -156,7 +157,7 @@ function maskPhoneNumber(phoneNumber) {
|
|||
}
|
||||
|
||||
function pay(orderData) {
|
||||
const { order_no, notify_url,sign, plain_text } = orderData;
|
||||
const { order_no, notify_url,sign, plain_text } = orderData.pay_info;
|
||||
const price = orderData.order_amount
|
||||
const MerName = orderData.brandName
|
||||
const { payFunc } = usePay();
|
||||
|
@ -170,7 +171,13 @@ function pay(orderData) {
|
|||
});
|
||||
}
|
||||
|
||||
const getDetail = () => {
|
||||
const getDetail = async () => {
|
||||
const token = window.localStorage.getItem('token') || '';
|
||||
if(!token){
|
||||
const code = await useCode();
|
||||
const {token} = await login({params:{code:code}});
|
||||
window.localStorage.setItem('token',token);
|
||||
}
|
||||
const params = {
|
||||
id: unref(id),
|
||||
order_no: unref(orderNo),
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.2 KiB |
|
@ -1,8 +1,12 @@
|
|||
//邮储银行专用的
|
||||
import useCode from "../pages/ycnc/hooks/useCode";
|
||||
import {login} from '../api/ycnc'
|
||||
//邮储银行(奶茶)专用的
|
||||
// import useCode from "../pages/ycnc/hooks/useCode";
|
||||
// import {login} from '../api/ycnc'
|
||||
|
||||
//邮储音视频baseURL生产环境
|
||||
//邮储银行(音视频)专用的
|
||||
import useCode from "../pages/ycysp/hooks/useCode";
|
||||
import {login} from '../api/ycysp'
|
||||
|
||||
//邮储音视频baseURL专用
|
||||
const baseURL = '/ycav'
|
||||
|
||||
function http(options) {
|
||||
|
@ -11,9 +15,11 @@ function http(options) {
|
|||
mask: true,
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
//邮储音视频添加前缀
|
||||
const newOptions = {...options,url:baseURL + options.url}
|
||||
uni.request({
|
||||
...options,
|
||||
url:baseURL + options.url,
|
||||
...newOptions,
|
||||
// ...options
|
||||
header: {
|
||||
//邮储音视频
|
||||
'content-type': 'application/json',
|
||||
|
@ -34,17 +40,21 @@ function http(options) {
|
|||
if(res.data?.code >= 200 && res.data?.code < 300){
|
||||
setTimeout(()=>{
|
||||
uni.hideLoading()
|
||||
},500)
|
||||
},300)
|
||||
resolve(res.data.data)
|
||||
}else if(res.data?.code === 401){
|
||||
//邮储银行专用的
|
||||
const authCode = await useCode();
|
||||
const params = {code:authCode};
|
||||
const {token} = await login({params});
|
||||
window.localStorage.setItem('token',token);
|
||||
http(options).then(ress => {
|
||||
resolve(ress)
|
||||
//邮储音视频专用的
|
||||
http(newOptions).then(_res => {
|
||||
resolve(_res)
|
||||
})
|
||||
//邮储奶茶
|
||||
// http(options).then(_res => {
|
||||
// resolve(_res)
|
||||
// })
|
||||
}else{
|
||||
uni.hideLoading().then(() => {
|
||||
uni.showToast({
|
||||
|
|
|
@ -15,7 +15,6 @@ const timeStringNow = dayjs().format("MM-DD HH-mm-ss")
|
|||
export default defineConfig(({ command, mode }) => {
|
||||
const { UNI_PLATFORM } = process.env // 得到 mp-weixin, h5, app 等
|
||||
return {
|
||||
// base:'/ycvideoh5/', //ycysp
|
||||
base:'./',
|
||||
plugins: [
|
||||
UniPages({
|
||||
|
|
Loading…
Reference in New Issue