|
@@ -119,7 +119,8 @@
|
|
|
getCorpsAddr,
|
|
|
paramserviceDetail,
|
|
|
getParamservice,
|
|
|
- isProcurement
|
|
|
+ isProcurement,
|
|
|
+ generateOrderShare
|
|
|
} from '@/api/tabBar/shoppingCart.js'
|
|
|
import {
|
|
|
registerRuntimeCompiler
|
|
@@ -416,7 +417,7 @@
|
|
|
})
|
|
|
},
|
|
|
// 立即支付
|
|
|
- async submit() {
|
|
|
+ submit() {
|
|
|
|
|
|
if (this.selectedProduct.length == 0) {
|
|
|
uni.showToast({
|
|
@@ -428,6 +429,20 @@
|
|
|
if (this.inventoryfun(this.dataList)) {
|
|
|
return
|
|
|
}
|
|
|
+ isProcurement({
|
|
|
+ "param": "whether.open.share"
|
|
|
+ }).then(res => {
|
|
|
+ if (res.data == 1) {
|
|
|
+ //共享支付流程
|
|
|
+ this.sharedPayment()
|
|
|
+ } else {
|
|
|
+ //正常支付流程
|
|
|
+ this.normalPayment()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //原来支付流程
|
|
|
+ async normalPayment() {
|
|
|
if (this.companyValue.length > 0) {
|
|
|
let data = []
|
|
|
for (let item of this.companyValue) {
|
|
@@ -446,7 +461,6 @@
|
|
|
});
|
|
|
// 判断是否用额度支付
|
|
|
const personRef = await details()
|
|
|
- console.log(personRef.data, 349);
|
|
|
const totalPrice = Number(this.totalPrice) + Number(this.totalFreight)
|
|
|
// 是否开通额度
|
|
|
getParamservice(1, 10, {
|
|
@@ -672,6 +686,161 @@
|
|
|
|
|
|
}
|
|
|
},
|
|
|
+ sharedPayment() {
|
|
|
+ if (this.companyValue.length > 0) {
|
|
|
+ let data = []
|
|
|
+ for (let item of this.companyValue) {
|
|
|
+ for (let ite of this.dataList) {
|
|
|
+ if (item == ite.name) {
|
|
|
+ data = data.concat(ite.list)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let obj = {
|
|
|
+ address: this.addres.belongtoarea + this.addres.detailedAddress,
|
|
|
+ shoppingCartList: data,
|
|
|
+ }
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ generateOrderShare(obj).then(res => {
|
|
|
+ // res.data.type=0
|
|
|
+ let generateOrderData = res.data
|
|
|
+ //小程序支付
|
|
|
+ if (res.data.type == '0') {
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: "wxpay",
|
|
|
+ appId: generateOrderData.appId,
|
|
|
+ timeStamp: generateOrderData.timeStamp,
|
|
|
+ nonceStr: generateOrderData.nonceStr,
|
|
|
+ package: generateOrderData.package,
|
|
|
+ signType: generateOrderData.signType,
|
|
|
+ paySign: generateOrderData.paySign,
|
|
|
+ success(res) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功',
|
|
|
+ mask: true,
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.hideLoading({
|
|
|
+ noConflict: true
|
|
|
+ });
|
|
|
+ // this_.refresh(res.data.data.id)
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ fail(e) {
|
|
|
+ console.log(22222222);
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ title: "支付失败",
|
|
|
+ icon: 'none',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.hideLoading({
|
|
|
+ noConflict: true
|
|
|
+ });
|
|
|
+ // this_.refresh(res.data.id)
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //收银台支付 'w06'
|
|
|
+ if (res.data.type == '1') {
|
|
|
+ wx.openEmbeddedMiniProgram({
|
|
|
+ appId: 'wxef277996acc166c3',
|
|
|
+ extraData: {
|
|
|
+ cusid: generateOrderData.cusid,
|
|
|
+ appid: generateOrderData.appid,
|
|
|
+ orgid: generateOrderData.orgid,
|
|
|
+ version: generateOrderData.version,
|
|
|
+ trxamt: generateOrderData.trxamt,
|
|
|
+ reqsn: generateOrderData.reqsn,
|
|
|
+ notify_url: generateOrderData.notify_url,
|
|
|
+ body: generateOrderData.body,
|
|
|
+ remark: generateOrderData.remark,
|
|
|
+ validtime: generateOrderData.validtime,
|
|
|
+ // limit_pay: generateOrderData.limit_pay,
|
|
|
+ limit_pay: "",
|
|
|
+ randomstr: generateOrderData.randomstr,
|
|
|
+ paytype: generateOrderData.paytype,
|
|
|
+ signtype: generateOrderData.signtype,
|
|
|
+ sign: generateOrderData.sign,
|
|
|
+ },
|
|
|
+ success: (a) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //额度支付
|
|
|
+ if (res.data.type == '2') {
|
|
|
+ details().then(res => {
|
|
|
+ const personRef = res
|
|
|
+ const totalPrice = Number(this.totalPrice) + Number(this.totalFreight)
|
|
|
+ // 是否开通额度
|
|
|
+ isProcurement({
|
|
|
+ "param": "WeChat.shipping.notification"
|
|
|
+ }).then(res => {
|
|
|
+ if (personRef.data.ifLimitAmount == 1) {
|
|
|
+ // 额度是否够用
|
|
|
+ if (Number(personRef.data.limitAmount >= totalPrice)) {
|
|
|
+ // 额度
|
|
|
+
|
|
|
+ // this.payType='W06'
|
|
|
+ generateOrderLimit({
|
|
|
+ payType: res.data == 1 ? 'W11' : 'W06',
|
|
|
+ address: this.addres.belongtoarea +
|
|
|
+ this.addres
|
|
|
+ .detailedAddress,
|
|
|
+ list: data,
|
|
|
+ }).then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功',
|
|
|
+ mask: true,
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.hideLoading({
|
|
|
+ noConflict: true
|
|
|
+ });
|
|
|
+ }, 1000);
|
|
|
+ // 详情调用
|
|
|
+ shoppingCartList({
|
|
|
+ whetherIntegral: '0'
|
|
|
+ }).then(res => {
|
|
|
+ this.dataList = res.data
|
|
|
+ this.companyValueLength =
|
|
|
+ this.dataList.length
|
|
|
+ }).catch(err => {})
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ radioGroupChange(e) {
|
|
|
+ this.radiovalue = e
|
|
|
+ if (e.length == 0) {
|
|
|
+ this.companyValue = []
|
|
|
+ } else {
|
|
|
+ for (let li of this.dataList) {
|
|
|
+ if (!this.companyValue.includes(li.name)) {
|
|
|
+ this.companyValue.push(li.name)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.inventoryfun(this.dataList)
|
|
|
+ this.statistics()
|
|
|
+ },
|
|
|
radioGroupChange(e) {
|
|
|
this.radiovalue = e
|
|
|
if (e.length == 0) {
|