diff --git a/components/successDialog.vue b/components/successDialog.vue index 4d5e46e..86ffb63 100644 --- a/components/successDialog.vue +++ b/components/successDialog.vue @@ -1,262 +1,282 @@ - \ No newline at end of file +::v-deep .u-form-item__body__left__content__label { + font-size: 24rpx; + font-family: Source Han Sans CN; + font-weight: 400; + color: #999999; +} + diff --git a/config/goods.js b/config/goods.js index f3cc23a..145ea18 100644 --- a/config/goods.js +++ b/config/goods.js @@ -5,83 +5,115 @@ * @Date: 2022-11-23 11:10:29 */ /* -* @Descripttion: -* @version: -* @Author: kBank -* @Date: 2022-11-23 11:10:29 -*/ + * @Descripttion: + * @version: + * @Author: kBank + * @Date: 2022-11-23 11:10:29 + */ const http = uni.$u.http //商品列表 -export const getAllGoods = (params) => http.post('/sale/api/wares/query-spe-wares', params) +export const getAllGoods = params => + http.post('/sale/api/wares/query-spe-wares', params) //商品详情 // export const waresDetail = (params) => http.post('/sale/api/wares/query-spe-wares-detail', params) -export const waresDetail = (params) => http.post('/sale/api/retail-wares/wares-detail', params) +export const waresDetail = params => + http.post('/sale/api/retail-wares/wares-detail', params) //嗨粉海粉短信 -export const verification = (params) => http.get('/member/api/sms/fans-verification', { params }) +export const verification = params => + http.get('/member/api/sms/fans-verification', { params }) //嗨粉选择省市区 -export const getAllAreaList = (params) => http.get('system/api/area/provinceList', { params }) +export const getAllAreaList = params => + http.get('system/api/area/provinceList', { params }) //嗨粉选择国家 -export const getCountry = (params) => http.get('system/api/country/list', { params }) +export const getCountry = params => + http.get('system/api/country/list', { params }) //海粉注册 -export const regShareMember = (params) => http.post('/member/api/member/reg-share-member', params) +export const regShareMember = params => + http.post('/member/api/member/reg-share-member', params) //hi粉注册 -export const hiRegister = (params) => http.post('/member/api/fans/register', params) +export const hiRegister = params => + http.post('/member/api/fans/register', params) //幂等性 -export const generate = (params) => http.get('/system/api/idempotent/generate', { params }) +export const generate = params => + http.get('/system/api/idempotent/generate', { params }) //发货 -export const deliveryList = (params) => http.get('/system/pub/enums/delivery-list', { params }) +export const deliveryList = params => + http.get('/system/pub/enums/delivery-list', { params }) //海粉渠道 -export const jxhhSource = (params) => http.get('/sale/api/t-source/list/' + params) +export const jxhhSource = params => + http.get('/sale/api/t-source/list/' + params) //海粉分类 -export const optionList = (params) => http.post('/sale/api/twares-category-category/option-list', params ) +export const optionList = params => + http.post('/sale/api/twares-category-category/option-list', params) //海粉商品 -export const sharingWares = (params) => http.get('/sale/api/wares/sharing-zone-wares', { params }) +export const sharingWares = params => + http.get('/sale/api/wares/sharing-zone-wares', { params }) //分享邮费查询 -export const queryAdressPostage = (params) => http.post('/sale/api/order/self-order-postage', params) +export const queryAdressPostage = params => + http.post('/sale/api/order/self-order-postage', params) //嗨粉分享确认订单 -export const confirmFunShareOrder = (params) => http.post('/sale/api/order/confirm-self-fun-order', params) +export const confirmFunShareOrder = params => + http.post('/sale/api/order/confirm-self-fun-order', params) //海粉商品详情 -export const sharingWaresDetail = (params) => http.get('/sale/api/wares/query-spe-sharing-wares-detail', { params }) +export const sharingWaresDetail = params => + http.get('/sale/api/wares/query-spe-sharing-wares-detail', { params }) //海粉订单确认 -export const confirmShareOrder = (params) => http.post('/sale/api/order/confirm-share-order', params) +export const confirmShareOrder = params => + http.post('/sale/api/order/confirm-share-order', params) //获取购物车 -export const getShopping = (params) => http.get('/sale/api/shopping/getShopping', { params }) +export const getShopping = params => + http.get('/sale/api/shopping/getShopping', { params }) //分类列表 -export const classifyList = (params) => http.get('/sale/api/area-classify/list', { params }) +export const classifyList = params => + http.get('/sale/api/area-classify/list', { params }) //加减购物车 -export const plusReduceShopping = (params) => http.post('/sale/api/shopping/plusReduceShopping', params) +export const plusReduceShopping = params => + http.post('/sale/api/shopping/plusReduceShopping', params) //多删购物车 -export const batchDelShopping = (params) => http.post('/sale/api/shopping/batchDelShopping', params) +export const batchDelShopping = params => + http.post('/sale/api/shopping/batchDelShopping', params) //添加购物车 -export const addShopping = (params) => http.post('/sale/api/shopping/addShopping', params) +export const addShopping = params => + http.post('/sale/api/shopping/addShopping', params) //菜单权限 -export const menuList = (params) => http.get('/system/api/menu/list', { params }) +export const menuList = params => http.get('/system/api/menu/list', { params }) //海粉分享 -export const shareCode = (params) => http.get('/member/api/share/share-code-h5', { params }) +export const shareCode = params => + http.get('/member/api/share/share-code-h5', { params }) //嗨粉分享 -export const fansCode = (params) => http.get('/member/api/share/fans-code-h5', { params }) +export const fansCode = params => + http.get('/member/api/share/fans-code-h5', { params }) //获取购物车数量 -export const getShoppingCount = (params) => http.get('/sale/api/shopping/getShoppingCount', { params }) +export const getShoppingCount = params => + http.get('/sale/api/shopping/getShoppingCount', { params }) //获取购物车数小 -export const getSmallCount = (params) => http.get('/sale/api/shopping/getAreaShoppingCount', { params }) +export const getSmallCount = params => + http.get('/sale/api/shopping/getAreaShoppingCount', { params }) //获取分享前缀 -export const prefix = (params) => http.get('/member/api/member/query-country-prefix/' + params, ) +export const prefix = params => + http.get('/member/api/member/query-country-prefix/' + params) //校验分享编号 -export const validateMember = (params) => http.get('/member/api/member/validate-share-member/' + params, ) +export const validateMember = params => + http.get('/member/api/member/validate-share-member/' + params) //获取国家 -export const currencyList = (params) => http.get('/system/api/country/list' , {params} ) +export const currencyList = params => + http.get('/system/api/country/list', { params }) //0元注册时 -export const checkShare = (params) => http.get('/member/api/share/check-share-code' , {params} ) +export const checkShare = params => + http.get('/member/api/share/check-share-code', { params }) //海粉订单详情 -export const waresinfo = (params) => http.post('/sale/api/wares/query-confirm-waresinfo', params) +export const waresinfo = params => + http.post('/sale/api/wares/query-confirm-waresinfo', params) -//hi粉确认订单 -export const fansConfirm = (params) => http.post('/sale/api/order/fans-confirm-order', params) +export const fansConfirm = params => + http.post('/sale/api/retail-order/fans-confirm-order', params) //购物车注册下单校验弹框 -export const energyShop = (params) => http.post('/sale/api/wares/query-energy-silo', params) +export const energyShop = params => + http.post('/sale/api/wares/query-energy-silo', params) //hi粉确认订单 -export const energyShopSilo = (params) => http.post('/sale/api/order/valid-silo', params) +export const energyShopSilo = params => + http.post('/sale/api/order/valid-silo', params) diff --git a/config/login.js b/config/login.js index a473e35..ec7f805 100644 --- a/config/login.js +++ b/config/login.js @@ -99,12 +99,16 @@ export const indexPopScreen = params => export const getMenuList = params => http.get('/system/api/menu/list', { params }) -//海粉默认登录(H5扫码使用) export const autoLogin = params => - http.post('/retail-member/auth/api/auto-login', params) + http.post('/member/api/retail-auth/auto-login', params) + +// 分享注册后自动登录 +// registered-auto-login +export const registeredAutoLogin = params => + http.post('/member/api/retail-auth/registered-auto-login', params) //海粉商品 export const queryWares = params => - http.post('/sale/api/wares/query-spe-wares-copy', params) + http.get('/sale/api/wares/list-wares-share', { params }) //保存礼品地址 export const saveGiftAddress = params => http.post('/retail-member/api/retail-member-gift/update-gift', params) @@ -117,7 +121,7 @@ export const getUserAwards = params => //获取安置人编号 export const fansConvertCode = params => - http.get('/retail-member/api/retail-member/fans-convert-code/' + params) + http.get('/member/api/member/fans-convert-code/' + params) //获取荣誉奖衔 export const getIndexAwards = params => diff --git a/config/pay.js b/config/pay.js index 849cf9c..472fa51 100644 --- a/config/pay.js +++ b/config/pay.js @@ -72,10 +72,9 @@ export const payPickOrder = params => //解绑银行卡 export const unBind = params => http.post('/pay/ada-fast/un-bind', params) - //查询注册信息 export const registerInfo = params => - http.get('/member/api/member/register-order/' + params) + http.get('/member/api/member/fans-order/' + params) // 升级支付 export const upgradePay = params => diff --git a/config/request.js b/config/request.js index a3863ea..b319c7b 100644 --- a/config/request.js +++ b/config/request.js @@ -20,7 +20,7 @@ module.exports = vm => { //#ifdef DEV_SERVER console.log('DEV_SERVER') - config.baseURL = 'http://t-app.beida777.com/prod-api' + config.baseURL = 'http://192.168.0.86:8080' //#endif //#ifdef QA_SERVER diff --git a/pages/index/index.vue b/pages/index/index.vue index 6dd4eb7..86dc468 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -49,7 +49,7 @@ ref="child2" @childMethodTrigger="callChildMethod" > - + - + {{ '我的订单' }} - - + /> --> @@ -480,9 +476,9 @@ export default { return } this.isNormal = isNormal - this.getRegionSelect() - this.getMemberBoxCount() - this.getMarketDynamicBoxCount() + // this.getRegionSelect() + // this.getMemberBoxCount() + // this.getMarketDynamicBoxCount() // this.getUserAwardss() }) }, diff --git a/pages/pay/hiPay.vue b/pages/pay/hiPay.vue index 4848cc1..001aa28 100644 --- a/pages/pay/hiPay.vue +++ b/pages/pay/hiPay.vue @@ -11,164 +11,247 @@ - - - - - - {{ '在线支付' }} + + + + + {{ '在线支付' }} + + + + + {{ '宝付微信支付' }} - - - - {{ '宝付微信支付' }} - - - - - + + + + + + + + + {{ '宝付微信扫码' }} - - - - {{ '宝付微信扫码' }} - - - - - + + + + + + + + + {{ '汇付微信支付' }} + + + + + + + + + + {{ '微信支付' }} + + + + + + + + + + + {{ '支付宝支付' }} + + + + + + + + + + {{ '汇付银行卡' }} + + + + + {{ item.bankName }} ({{ item.bankNo }}) + 解绑 + - - - - {{ '汇付微信支付' }} + + + + - - - - - - - - - {{ '汇付银行卡' }} ({{ '暂不支持信用卡' }}) - - - - - {{ item.bankName }} ({{ item.bankNo }}) - - - - - - - - - {{ '绑定银行卡' }} - + + + {{ '绑定银行卡' }} - - - - 通联微信支付 - - - - - + + + + + 通联微信支付 - - - - {{ '通联银行卡' }} ({{ '暂不支持信用卡' }}) + + + + + + + + + {{ '京东银行卡' }} + + + + + {{ item.bankName }} ({{ item.bankNo }}) + + + + + - - - - {{ item.bankName }} ({{ item.bankNo }}) - - - - - - - - - {{ '绑定银行卡' }} - + + + {{ '绑定银行卡' }} - - - - {{ '京东银行卡' }} ({{ '暂不支持信用卡' }}) + + + + + 京东收银台 + + + + + + + + + + {{ '通联银行卡' }} + + + + + {{ item.bankName }} ({{ item.bankNo }}) + + + + + - - - - {{ item.bankName }} ({{ item.bankNo }}) - - - - - - - - - {{ '绑定银行卡' }} - + + + {{ '绑定银行卡' }} - - + + @@ -225,7 +308,10 @@
- + @@ -234,15 +320,24 @@ import * as api from '@/config/pay.js' import QRCode from 'qrcodejs2' import { removeToken } from '@/config/auth.js' -import hiSuccess from '@/components/hiSuccess.vue' +import successDialog from '@/components/successDialog.vue' import * as act from '@/config/activity.js' +import { + PAY_REDIRECT_URL, + PAY_TYPE, + PAY_CHANEL, + PAY_AUTH, +} from '@/util/constant.js' var payStatus +let getRegisterInfoTimeoutFlag = null export default { components: { - hiSuccess, + successDialog, }, data() { return { + PAY_TYPE, + PAY_AUTH, payList: {}, isLoading: false, clockTime: '', @@ -257,12 +352,12 @@ export default { }, paramsPost: '', isShare: false, //分享用户第一次爆单 - userInfo: '', + userInfo: uni.getStorageSync('User'), activeNames: 1, whatPay: '', hfList: [], jdList: [], - businessType: '', + businessType: 1, isBank: '', isPw: false, codeValue: '', @@ -271,9 +366,7 @@ export default { sucPay: 0, content: '支付成功', wxPopup: false, - luckydrawData: {}, isRecharge: false, - czJe: '', tlList: [], } }, @@ -286,74 +379,22 @@ export default { ) this.pkCountry = uni.getStorageSync('pkCountry') - // if (this.paramsPost.isRecharge) { - // this.isRecharge = this.paramsPost.isRecharge - // this.businessType = 3 - // uni.setNavigationBarTitle({ - // title: '充值' - // }); - // } else { - // uni.setNavigationBarTitle({ - // title: '订单支付' - // }); - // this.isRecharge = false - // if (JSON.parse(options.paramsPost).orderType == 4) { + this.orderCode = this.paramsPost.orderCode - // this.luckydrawData = this.paramsPost.luckydrawData - // // 抽奖支付处理(查询订单支付信息以及显示等) - // this.businessType = 4 //抽奖 - // this.specialArea = this.paramsPost.specialArea - // this.getLuckdrawDetail() - // } else { - // this.userInfo = uni.getStorageSync('User') - // if ( - // this.userInfo.registerFans == 0 - // ) { - // this.isShare = true - // } - - // this.specialArea = - // this.paramsPost.specialArea || this.paramsPost.orderType - // this.orderCode = this.paramsPost.orderCode - // this.businessType = options.businessType - // // this.getInfo() - - // // 获取订单信息 - // this.getOrderInfo() - // if (!this.isShare) { - // // 获取消费信息 - // this.getSpendInfo() - // } - // } - // } // 获取支付配置 this.getPayConfig() - this.downTime() - // clearInterval(this.clockTime) }, onShow() { // 获取银行卡 // this.getBankList() }, + onUnload() { + clearTimeout(getRegisterInfoTimeoutFlag) + clearInterval(payStatus) + }, methods: { - //查询充值抽奖次数 - getLuckdrawDetail() { - // 抽奖支付处理(查询订单支付信息以及显示等) - act - .getLuckdrawDetail({ - pkBaseId: this.luckydrawData.pkBaseId, - payNum: this.luckydrawData.payNum, - }) - .then(res => { - if (res.code == 200) { - this.orderData.orderAmount = res.data.toBePaidMoney - this.payDetail = res.data - // this.downTime() - } - }) - }, closewxPopup() { this.wxPopup = false this.$refs.qrCodeUrlWx.innerHTML = '' @@ -384,10 +425,18 @@ export default { }, fansOrder() { api.fansOrder(this.orderCode).then(res => { - this.isLoading = false - this.isPw = false - removeToken() - this.$refs.hiSuccess.showSuccess(res.data) + if (res.data) { + this.isLoading = false + this.isPw = false + uni.hideLoading() + removeToken() + + this.$refs.successDialog.showSuccess(res.data) + } else { + getRegisterInfoTimeoutFlag = setTimeout(() => { + this.fansOrder() + }, 3000) + } }) }, payPw() { @@ -411,7 +460,7 @@ export default { url(obj).then(res => { if (res.code == 200) { // this.isPw = false - // this.$refs.hiSuccess.showSuccess(res.data) + // this.$refs.successDialog.showSuccess(res.data) uni.showToast({ title: res.msg, icon: 'none', @@ -431,66 +480,50 @@ export default { } }) }, - quickPay(cz) { - // 非银行卡 - if (typeof this.whatPay == 'number') { - if (this.whatPay == 12) { - this.scanPayBfWx(5) - } else if (this.whatPay == 13) { - this.scanPayBfWx(6) - } else if (this.whatPay == 11) { - this.scanPayBfWxJump(5) - } else if (this.whatPay == 32) { - this.scanPayTlWxJump(3) + async quickPay() { + if ( + ![ + PAY_TYPE.HUI_FU_BANK_CARD, + PAY_TYPE.JING_DONG_BANK_CARD, + PAY_TYPE.TONG_LIAN_BANK_CARD, + ].includes(this.whatPay.slice(0, 2)) + ) { + if ([PAY_TYPE.JING_DONG_H5].includes(this.whatPay)) { + this.redirectPay(PAY_CHANEL[this.whatPay]) + } else if ( + [PAY_TYPE.BAO_FU_WECHAT_SCAN, PAY_TYPE.HUI_FU_WECHAT].includes( + this.whatPay + ) + ) { + this.scanPayBfWx(PAY_CHANEL[this.whatPay]) + } else if (this.whatPay == PAY_TYPE.WECHAT_PAY) { + this.scanPayWx(PAY_CHANEL[this.whatPay]) + } else if (this.whatPay == PAY_TYPE.ALI_PAY) { + this.scanPayAl(PAY_CHANEL[this.whatPay]) } } else { - if (this.whatPay.slice(0, 2) == 'hf') { - let indexed = this.whatPay.slice(2, 4) - let params = { - businessType: 1, //订单类型 - businessCode: this.orderCode, - payChannel: 6, //汇付 - payType: 3, //银行卡 - bindCode: this.hfList[indexed].bindCode, - } - api.unifiedorder(params).then(response => { - this.isBank = 'hf' - this.bindCode = this.hfList[indexed].bindCode - this.isPw = true - }) - this.checkPayStatus(params) - } else if (this.whatPay.slice(0, 2) == 'jd') { - let indexed = this.whatPay.slice(2, 4) - - let params = { - businessType: 1, //订单类型 - businessCode: this.orderCode, - payChannel: 4, //京东 - payType: 3, //银行卡 - bindCode: this.jdList[indexed].bindCode, - } - api.unifiedorder(params).then(response => { - this.isBank = 'jd' - this.bindCode = this.jdList[indexed].bindCode - this.isPw = true - }) - this.checkPayStatus(params) - } else if (this.whatPay.slice(0, 2) == 'tl') { - let indexed = this.whatPay.slice(2, 4) - let params = { - businessType: 1, //订单类型 - businessCode: this.orderCode, - payChannel: 3, //通联 - payType: 3, //银行卡 - bindCode: this.tlList[indexed].bindCode, - } - api.unifiedorder(params).then(response => { - this.isBank = 'tl' - this.bindCode = this.tlList[indexed].bindCode - this.isPw = true - }) - this.checkPayStatus(params) + const indexed = this.whatPay.slice(2, 4) + const payTypeEnum = this.whatPay.slice(0, 2) + const bankListMap = { + [PAY_TYPE.HUI_FU_BANK_CARD]: this.hfList[indexed].bindCode, + [PAY_TYPE.JING_DONG_BANK_CARD]: this.jdList[indexed].bindCode, + [PAY_TYPE.TONG_LIAN_BANK_CARD]: this.tlList[indexed].bindCode, } + this.bindCode = bankListMap[payTypeEnum] + const params = { + businessType: this.businessType, //订单类型 + payChannel: PAY_CHANEL[payTypeEnum], + payType: 3, //银行卡 + bindCode: bankListMap[payTypeEnum], + } + Object.assign(params, { + businessCode: this.orderCode, + }) + api.unifiedorder(params).then(response => { + this.isBank = this.whatPay.slice(0, 2) + this.isPw = true + this.checkPayStatus(params) + }) } }, // 宝付微信支付 @@ -527,6 +560,47 @@ export default { }) this.checkPayStatus(params) }, + redirectPay(payChannel) { + this.getPayAuthToken(payChannel).then(url => { + if (navigator.userAgent.includes('MicroMessenger')) { + window.location.href = url + } else { + window.open(url) + } + }) + }, + getPayAuthToken(payChannel) { + return new Promise((resolve, reject) => { + const extParam = { + isRecharge: false, + orderCode: this.orderCode, + specialArea: 1, + isSharePay: true, + } + // 将extParam对象转换为JSON字符串,再转换为base64编码 + const extParamBase64 = btoa(JSON.stringify(extParam)) + const params = { + payChannel: payChannel, + payType: 2, + appletFlag: 0, + businessType: this.businessType, + businessCode: this.orderCode, + extParam: extParamBase64, + } + api.unifiedorder(params).then(res => { + if (res.code === 200) { + resolve(res.data) + this.checkPayStatus(params) + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + }) + reject(res.msg) + } + }) + }) + }, scanPayBfWx(val) { let params = { businessType: 1, @@ -566,10 +640,18 @@ export default { }, getPayConfig() { api.payConfig().then(res => { - this.payList = res.data - this.$nextTick(() => { - this.$refs.collapse.init() - }) + if (res.code == 200) { + this.payList = res.data || {} + const firstPayAuth = + Object.keys(this.payList).find(key => this.payList[key] === true) || + '' + const paykey = Object.keys(PAY_AUTH).find( + key => PAY_AUTH[key] === firstPayAuth + ) + this.whatPay = paykey + } + + console.log(this.payList) this.$forceUpdate() }) }, @@ -588,18 +670,7 @@ export default { }) this.$forceUpdate() }, - getOrderInfo() { - api - .orderInfo({ - specialArea: this.specialArea, - orderCode: this.orderCode, - pkSettleCountry: this.pkCountry, - }) - .then(res => { - this.orderData = res.data - this.downTime() - }) - }, + downTime() { let that = this this.clockTime = setInterval(() => { @@ -639,7 +710,12 @@ export default { clearInterval(payStatus) this.wxPopup = false // this.showSucce = true - this.fansOrder() + uni.showLoading({ + title: '正在获取注册信息,请不要关闭当前页面', + }) + setTimeout(() => { + this.fansOrder() + }, 2000) } else { api.payStatus(data).then(res => { that.sucPay = res.data @@ -753,10 +829,9 @@ export default { .flex_ac { display: flex; align-items: center; - width: 100%; justify-content: space-between; border-bottom: 1px solid rgba(0, 0, 0, 0.1); - padding: 18rpx 0; + padding: 18rpx 20rpx; } .flex_ac1 { @@ -766,7 +841,7 @@ export default { width: 100%; justify-content: space-between; border-bottom: 1px solid rgba(0, 0, 0, 0.1); - padding: 18rpx 0; + // padding: 18rpx 0; } .flex_ac_i { @@ -786,10 +861,6 @@ export default { } } -::v-deep .u-collapse-item__content__text { - padding: 0px 15px; -} - .pad { width: 100%; display: flex; diff --git a/pages/pay/success.vue b/pages/pay/success.vue index a520336..269b65e 100644 --- a/pages/pay/success.vue +++ b/pages/pay/success.vue @@ -44,7 +44,7 @@