Merge branch 'feature/mall_product' of http://117.33.142.185:3000/zenghuapei/cyywl_server into feature/mall_product

pull/2/head
js199000126 2023-05-26 17:58:37 +08:00
commit 8af70137b9
4 changed files with 104 additions and 389 deletions

View File

@ -97,12 +97,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_LOGIN.getScene(), userIp));
// 获得获得注册用户
// 校验账号是否存在
MemberUserDO user = userService.getUserByMobile(reqVO.getMobile());
if (user == null) {
createLoginLog(null, reqVO.getMobile(), LoginLogTypeEnum.LOGIN_SMS, LoginResultEnum.BAD_CREDENTIALS);
throw exception(AUTH_LOGIN_BAD_CREDENTIALS);
}
MemberUserDO user = userService.createUserIfAbsent(reqVO.getMobile(),reqVO.getMobile(), userIp,reqVO.getPromoterId());
// 校验是否禁用
if (ObjectUtil.notEqual(user.getStatus(), CommonStatusEnum.ENABLE.getStatus())) {
createLoginLog(user.getId(), reqVO.getMobile(), LoginLogTypeEnum.LOGIN_SMS, LoginResultEnum.USER_DISABLED);

View File

@ -0,0 +1,50 @@
<template>
<view>
<button style="cursor: pointer;display:none;" :class="triggerName" :data-clipboard-text="alipayLink">
</button>
<!-- 支付宝支付界面 -->
<u-modal :show="show" title="支付宝支付" @confirm="handleConfirm">
<view class="slot-content">
链接已复制请到外部浏览器完成支付
</view>
</u-modal>
</view>
</template>
<script>
import Clipboard from 'clipboard'
export default {
name: 'AlipayLinkCopy',
props: {
alipayLink: {
type: String,
default: ''
},
show: {
type: Boolean,
default: false
},
triggerName: {
type: String,
default: 'clipboard'
}
},
data() {
return {
}
},
mounted() {
new Clipboard('.clipboard')
},
methods: {
handleConfirm() {
this.$emit('update:show', false)
this.$emit('confirm')
}
}
}
</script>
<style>
</style>

View File

@ -7,6 +7,11 @@ const payTypes = ['WXPAY', 'ALIPAY']
* @param payInfo // 支付下单信息
* @param payType // 支付类型
* @param createOrderFun // 预下单方法
* @param payResultHandle // 支付参数返回处理方法,不同的业务逻辑下单后返回的支付参数字段可能不一样,需要处理成统一格式
* {
jsapiResult: '', 微信jsapi支付参数
body: '', 支付宝支付参数
}
* @param wxPaySuccess // 微信支付下单支付成功回调
* @param aliPaySuccess // 支付宝支付下单成功回调
*/
@ -15,6 +20,7 @@ const unityPay = (options) => {
payInfo: {},
payType: '',
createOrderFun: () => {},
payResultHandle: (res) => res,
wxPaySuccess: () => {},
aliPaySuccess: () => {}
}
@ -35,6 +41,11 @@ const unityPay = (options) => {
})
}
_options.payInfo.openid = openId
if (_options.payType === 'WXPAY') {
_options.payInfo.payChannel = '微信支付'
} else if (_options.payType === 'ALIPAY') {
_options.payInfo.payChannel = '支付宝'
}
uni.showLoading({
title: '支付中',
mask: true
@ -43,7 +54,7 @@ const unityPay = (options) => {
..._options.payInfo,
payType: _options.payType
}).then(res => {
const payConfig = res.data
const payConfig = _options.payResultHandle(res.data)
switch (_options.payType) {
// 微信JSAPI支付
case 'WXPAY':

View File

@ -17,7 +17,7 @@
请选择支付方式
</view>
<view class="item acea-row row-between-wrapper" v-for="(item,index) in cartArr" :key="index"
v-show='item.payStatus' @click="payType(item.number || 0, item.value, index)">
v-show='item.payStatus' @click="payType(item.value, index)">
<view class="left acea-row row-between-wrapper">
<view class="iconfont" :class="item.icon"></view>
<view class="text">
@ -32,7 +32,7 @@
</view>
</view>
<view class="btn">
<view class="button acea-row row-center-wrapper pay-button" @click='goPay(number, paytype)'>确认支付</view>
<view class="button acea-row row-center-wrapper pay-button" @click='goPay'>确认支付</view>
<view class="wait-pay" @click="waitPay"></view>
</view>
<view v-show="false" v-html="formContent"></view>
@ -52,51 +52,54 @@
</view>
</view>
</u-modal>
</view>
<!-- 支付宝支付链接复制组件 -->
<alipay-link-copy :show.sync="alipayShow" :alipayLink="alipayLink"/>
</view>
</template>
<script>
import countDown from '@/components/countDown';
import numberScroll from '@/components/numberScroll.vue'
import AlipayLinkCopy from '@/components/aliPayLinkCopy'
import {
getOrderDetail,
orderPay
orderPay,
wechatOrderPay
} from '@/api/order.js';
import uniPay from '@/libs/pay.js'
export default {
components: {
countDown,
numberScroll
numberScroll,
AlipayLinkCopy
},
data() {
return {
cancelPayModalShow: false,
alipayShow: false,
alipayLink: '',
checked: false,
//
cartArr: [{
"name": '微信支付',
"icon": "icon-weixin2",
value: 'weixin',
value: 'WXPAY',
title: '使用微信快捷支付',
payStatus: 1,
},
{
"name": '支付宝支付',
"icon": "icon-zhifubao",
value: 'alipay',
value: 'ALIPAY',
title: '使用支付宝支付',
payStatus: 1,
}
],
orderId: 0,
fromType: '',
active: 0,
payPrice: 10.00,
payPriceShow: 10.00,
payPostage: 0,
offlinePostage: false,
invalidTime: 1684836534,
initIn: false,
jumpData: {
orderId: '',
msg: ''
@ -104,32 +107,14 @@
formContent: ''
}
},
watch: {
cartArr: {
handler(newV, oldValue) {
let newPayList = [];
newV.forEach((item, index) => {
if (item.payStatus) {
item.index = index;
newPayList.push(item)
}
});
this.active = newPayList[0].index;
this.paytype = newPayList[0].value;
this.number = newPayList[0].number || 0;
},
immediate: true,
deep: true
}
},
onLoad(options) {
if (options.order_id) this.orderId = options.order_id
if (options.from_type) this.fromType = options.from_type
this.getCashierOrder()
},
onShow() {
let options = wx.getEnterOptionsSync();
console.log(options)
/*
if (options.scene == '1038' && options.referrerInfo.appId == 'wxef277996acc166c3' && this.initIn) {
//
let extraData = options.referrerInfo.extraData;
@ -166,7 +151,7 @@
})
}
}
}
}*/
},
methods: {
onGiveUpPay() {
@ -178,7 +163,6 @@
title: '加载中'
});
getOrderDetail(this.orderId).then(res => {
console.log('res', res)
const orderInfo = res.data
this.payPrice = parseFloat(orderInfo.proTotalPrice).toFixed(2)
this.payPriceShow = parseFloat(orderInfo.proTotalPrice).toFixed(2)
@ -188,35 +172,9 @@
})
}).finally(uni.hideLoading)
},
payType(number, paytype, index) {
payType(paytype, index) {
this.active = index;
this.paytype = paytype;
this.number = number;
if (this.offlinePostage) {
if (paytype == 'offline') {
this.payPriceShow = this.$util.$h.Sub(this.payPrice, this.payPostage);
} else {
this.payPriceShow = this.payPrice;
}
}
},
formpost(url, postData) {
let tempform = document.createElement("form");
tempform.action = url;
tempform.method = "post";
tempform.target = "_self";
tempform.style.display = "none";
for (let x in postData) {
let opt = document.createElement("input");
opt.name = x;
opt.value = postData[x];
tempform.appendChild(opt);
}
document.body.appendChild(tempform);
this.$nextTick(e => {
tempform.submit();
})
},
waitPay() {
this.cancelPayModalShow = true
@ -225,335 +183,36 @@
// '&status=2&totalPrice=' + this.payPriceShow
// })
},
goPay(number, paytype) {
goPay() {
let that = this;
if (!that.orderId) return that.$util.Tips({
title: '请选择要支付的订单'
});
uni.showLoading({
title: `支付中`
});
orderPay({
uni: that.orderId,
paytype: paytype,
type: that.friendPay ? 1 : 0,
// #ifdef H5
quitUrl: location.port ? location.protocol + '//' + location.hostname + ':' + location
.port +
'/pages/goods/order_details/index?order_id=' + this.orderId : location.protocol +
'//' + location.hostname +
'/pages/goods/order_details/index?order_id=' + this.orderId
// #endif
// #ifdef APP-PLUS
quitUrl: '/pages/goods/order_details/index?order_id=' + this.orderId
// #endif
}).then(res => {
let status = res.data.status,
orderId = res.data.result.orderId,
jsConfig = res.data.result.jsConfig,
goPages = '/pages/goods/order_pay_status/index?order_id=' + this.orderId + '&msg=' +
res
.msg +
'&type=3' + '&totalPrice=' + this.payPriceShow,
friendPay = '/pages/users/payment_on_behalf/index?order_id=' + this.orderId +
'&spread=' +
this
.$store.state.app.uid
switch (status) {
case 'ORDER_EXIST':
case 'EXTEND_ORDER':
uni.hideLoading();
return that.$util.Tips({
title: res.msg
}, {
tab: 5,
url: goPages
});
case 'ALLINPAY_PAY':
uni.hideLoading();
// #ifdef MP
this.initIn = true
wx.openEmbeddedMiniProgram({
appId: 'wxef277996acc166c3',
extraData: {
cusid: jsConfig.cusid,
appid: jsConfig.appid,
version: jsConfig.version,
trxamt: jsConfig.trxamt,
reqsn: jsConfig.reqsn,
notify_url: jsConfig.notify_url,
body: jsConfig.body,
remark: jsConfig.remark,
validtime: jsConfig.validtime,
randomstr: jsConfig.randomstr,
paytype: jsConfig.paytype,
sign: jsConfig.sign,
signtype: jsConfig.signtype
}
})
this.jumpData = {
orderId: res.data.result.orderId,
msg: res.msg,
}
// #endif
// #ifdef APP-PLUS
plus.runtime.openURL(jsConfig.payinfo);
setTimeout(e => {
uni.reLaunch({
url: goPages
})
}, 1000)
// #endif
// #ifdef H5
this.formpost(res.data.result.pay_url, jsConfig)
// #endif
break;
case 'PAY_ERROR':
uni.hideLoading();
return that.$util.Tips({
title: res.msg
}, {
tab: 5,
url: goPages
});
break;
case 'SUCCESS':
uni.hideLoading();
if (paytype !== 'friend') {
return that.$util.Tips({
title: res.msg,
icon: 'success'
}, {
tab: 4,
url: goPages
});
} else {
return that.$util.Tips({
title: res.msg,
icon: 'success'
}, {
tab: 4,
url: friendPay
});
}
break;
case 'WECHAT_PAY':
that.toPay = true;
// #ifdef MP
/* that.toPay = true; */
let mp_pay_name = ''
if (uni.requestOrderPayment) {
mp_pay_name = 'requestOrderPayment'
} else {
mp_pay_name = 'requestPayment'
}
uni[mp_pay_name]({
timeStamp: jsConfig.timestamp,
nonceStr: jsConfig.nonceStr,
package: jsConfig.package,
signType: jsConfig.signType,
paySign: jsConfig.paySign,
success: function(res) {
uni.hideLoading();
if (that.BargainId || that.combinationId || that.pinkId ||
that
.seckillId || that.discountId)
return that.$util.Tips({
title: `支付成功`,
icon: 'success'
}, {
tab: 4,
url: goPages
});
return that.$util.Tips({
title: `支付成功`,
icon: 'success'
}, {
tab: 5,
url: goPages
});
},
fail: function(e) {
uni.hideLoading();
return that.$util.Tips({
title: `取消支付`
}, {
tab: 5,
url: goPages + '&status=2'
});
},
complete: function(e) {
uni.hideLoading();
//
if (res.errMsg == 'requestPayment:cancel' || e.errMsg ==
'requestOrderPayment:cancel') return that.$util
.Tips({
title: `取消支付`
}, {
tab: 5,
url: goPages + '&status=2'
});
},
})
// #endif
// #ifdef H5
this.$wechat.pay(res.data.result.jsConfig).then(res => {
return that.$util.Tips({
title: `支付成功`,
icon: 'success'
}, {
tab: 5,
url: goPages
});
}).catch(res => {
if (!this.$wechat.isWeixin()) {
uni.redirectTo({
url: goPages + '&msg=' + `支付失败` +
'&status=2'
// '&msg=&status=2'
})
}
if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
title: `取消支付`
}, {
tab: 5,
url: goPages + '&status=2'
});
})
// #endif
// #ifdef APP-PLUS
uni.requestPayment({
provider: 'wxpay',
orderInfo: jsConfig,
success: (e) => {
let url = goPages;
uni.showToast({
title: `支付成功`
})
setTimeout(res => {
uni.redirectTo({
url: url
})
}, 2000)
},
fail: (e) => {
let url = '/pages/goods/order_pay_status/index?order_id=' +
orderId +
'&msg=' + `支付失败`;
uni.showModal({
content: `支付失败`,
showCancel: false,
success: function(res) {
if (res.confirm) {
uni.redirectTo({
url: url
})
} else if (res.cancel) {}
}
})
},
complete: () => {
uni.hideLoading();
},
});
// #endif
break;
case 'PAY_DEFICIENCY':
uni.hideLoading();
//
return that.$util.Tips({
title: res.msg
}, {
tab: 5,
url: goPages + '&status=1'
});
break;
case "WECHAT_H5_PAY":
uni.hideLoading();
that.$util.Tips({
title: `等待支付中`
}, {
tab: 4,
url: goPages + '&status=0'
});
setTimeout(() => {
location.href = res.data.result.jsConfig.h5_url;
}, 1500);
break;
case 'ALIPAY_PAY':
//#ifdef H5
uni.hideLoading();
that.$util.Tips({
title: `等待支付中`
}, {
tab: 4,
url: goPages + '&status=0'
});
that.formContent = res.data.result.jsConfig;
setTimeout(() => {
document.getElementById('alipaysubmit').submit();
}, 1500);
//#endif
// #ifdef MP
uni.navigateTo({
url: `/pages/users/alipay_invoke/index?id=${orderId}&link=${jsConfig.qrCode}`
});
// #endif
// #ifdef APP-PLUS
uni.requestPayment({
provider: 'alipay',
orderInfo: jsConfig,
success: (e) => {
uni.showToast({
title: `支付成功`
})
let url = '/pages/goods/order_pay_status/index?order_id=' +
orderId +
'&msg=' + `支付成功`;
setTimeout(res => {
uni.redirectTo({
url: url
})
}, 2000)
},
fail: (e) => {
let url = '/pages/goods/order_pay_status/index?order_id=' +
orderId +
'&msg=' + `支付失败`;
uni.showModal({
content: `支付失败`,
showCancel: false,
success: function(res) {
if (res.confirm) {
uni.redirectTo({
url: url
})
} else if (res.cancel) {}
}
})
},
complete: () => {
uni.hideLoading();
},
});
// #endif
break;
title: '支付中'
})
uniPay({
payInfo: {
orderNo: that.orderId
},
payType: that.paytype,
createOrderFun: wechatOrderPay,
payResultHandle: (res) => {
return {
jsapiResult: res.jsapiConfig,
body: res.data
}
},
wxPaySuccess: () => {
// window.location.reload()
},
aliPaySuccess: (link) => {
that.alipayLink = link
setTimeout(() => {
document.querySelector(".clipboard").click();
that.alipayShow = true
}, 500)
}
}).catch(err => {
uni.hideLoading();
return that.$util.Tips({
title: err
}, () => {
that.$emit('onChangeFun', {
action: 'pay_fail'
});
});
})
}
}