Merge remote-tracking branch 'origin/master'

pull/3/head
owen 2023-09-30 22:07:12 +08:00
commit 40ae9ca1c4
4 changed files with 136 additions and 236 deletions

View File

@ -9,3 +9,13 @@ export function getPayWallet() {
export function getWalletTransactionPage(data) { export function getWalletTransactionPage(data) {
return request.get("app-api/pay/wallet-transaction/page", data); return request.get("app-api/pay/wallet-transaction/page", data);
} }
// 获得钱包充值套餐列表
export function getWalletRechargePackageList() {
return request.get("app-api/pay/wallet-recharge-package/list");
}
// 创建钱包充值记录(发起充值)
export function createWalletRecharge(data) {
return request.post("app-api/pay/wallet-recharge/create", data);
}

View File

@ -14,12 +14,6 @@ export function getAfterSalePage(data) {
return request.get("app-api/trade/after-sale/page", data); return request.get("app-api/trade/after-sale/page", data);
} }
export function getAfterSaleReasonList(way) {
return request.get("app-api/trade/after-sale/get-reason-list", {
way
});
}
export function createAfterSale(data) { export function createAfterSale(data) {
return request.post("app-api/trade/after-sale/create", data); return request.post("app-api/trade/after-sale/create", data);
} }

View File

@ -79,6 +79,7 @@
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import * as TradeOrderApi from '@/api/trade/order.js'; import * as TradeOrderApi from '@/api/trade/order.js';
import * as AfterSaleApi from '@/api/trade/afterSale.js'; import * as AfterSaleApi from '@/api/trade/afterSale.js';
import * as TradeConfigApi from '@/api/trade/config.js';
export default { export default {
data() { data() {
return { return {
@ -94,6 +95,8 @@
reasonIndex: 0, // reasons reasonIndex: 0, // reasons
applyPicUrls: [], // applyPicUrls: [], //
tradeConfig: {}, //
}; };
}, },
computed: mapGetters(['isLogin']), computed: mapGetters(['isLogin']),
@ -125,11 +128,13 @@
this.orderItemId = parseInt(options.orderItemId); this.orderItemId = parseInt(options.orderItemId);
this.getOrderInfo(); this.getOrderInfo();
this.getRefundReason(); this.getRefundReason();
this.getTradeConfig();
}, },
methods: { methods: {
onLoadFun:function() { onLoadFun:function() {
this.getOrderInfo(); this.getOrderInfo();
this.getRefundReason(); this.getRefundReason();
this.getTradeConfig();
}, },
/** /**
* 获取订单详情 * 获取订单详情
@ -147,6 +152,7 @@
}); });
}) })
}, },
/** /**
* 更改售后方式 * 更改售后方式
*/ */
@ -165,9 +171,11 @@
*/ */
getRefundReason: function() { getRefundReason: function() {
const way = this.getWay(); const way = this.getWay();
AfterSaleApi.getAfterSaleReasonList(way).then(res => { if (way === 10) {
this.reasons = res.data; this.reasons = this.tradeConfig.afterSaleRefundReasons || [];
}) } else {
this.reasons = this.tradeConfig.afterSaleReturnReasons || [];
}
}, },
/** /**
* 选择售后原因 * 选择售后原因
@ -175,6 +183,13 @@
bindPickerChange: function(e) { bindPickerChange: function(e) {
this.$set(this, 'reasonIndex', e.detail.value); this.$set(this, 'reasonIndex', e.detail.value);
}, },
getTradeConfig: function () {
TradeConfigApi.getTradeConfig().then(res => {
this.tradeConfig = res.data || {};
this.getRefundReason();
});
},
/** /**
* 删除图片 * 删除图片
*/ */

View File

@ -4,23 +4,26 @@
<view class="payment-top acea-row row-column row-center-wrapper"> <view class="payment-top acea-row row-column row-center-wrapper">
<span class="name">我的余额</span> <span class="name">我的余额</span>
<view class="pic"> <view class="pic">
<span class="pic-font">{{ userInfo.nowMoney || 0 }}</span> <span class="pic-font">{{ fen2yuan(wallet.balance || 0) }}</span>
</view> </view>
</view> </view>
<view class="payment"> <view class="payment">
<view class="nav acea-row row-around row-middle"> <view class="nav acea-row row-around row-middle">
<view class="item" :class="active==index?'on':''" v-for="(item,index) in navRecharge" :key="index" @click="navRecharges(index)">{{item}}</view> <view class="item" :class="active==index?'on':''" v-for="(item,index) in navRecharge" :key="index" @click="navRecharges(index)">{{item}}</view>
</view> </view>
<!-- 充值 -->
<view class='tip picList' v-if='!active'> <view class='tip picList' v-if='!active'>
<view class="pic-box pic-box-color acea-row row-center-wrapper row-column" :class="activePic === index ? 'pic-box-color-active' : ''" <view class="pic-box pic-box-color acea-row row-center-wrapper row-column" :class="activePic === index ? 'pic-box-color-active' : ''"
v-for="(item, index) in picList" :key="index" @click="picCharge(index, item)"> v-for="(item, index) in picList" :key="index" @click="picCharge(index, item)">
<view class="pic-number-pic"> <view class="pic-number-pic">
{{ item.price }}<span class="pic-number"> </span> {{ fen2yuan(item.payPrice) }}<span class="pic-number"> </span>
</view> </view>
<view class="pic-number">赠送{{ item.giveMoney }} </view> <view class="pic-number">赠送{{ fen2yuan(item.bonusPrice) }} </view>
</view> </view>
<view class="pic-box pic-box-color acea-row row-center-wrapper" :class="parseFloat(activePic)===parseFloat(picList.length)?'pic-box-color-active':''" @click="picCharge(picList.length)"> <view class="pic-box pic-box-color acea-row row-center-wrapper" :class="parseFloat(activePic)===parseFloat(picList.length)?'pic-box-color-active':''"
<input type="number" placeholder="其他" v-model="money" :maxlength="50000" class="pic-box-money pic-number-pic uni-input" :class="parseFloat(activePic) === parseFloat(picList.length) ? 'pic-box-color-active' : ''" /> @click="picCharge(picList.length)">
<input type="number" placeholder="其他" v-model="money" :maxlength="50000" class="pic-box-money pic-number-pic uni-input"
:class="parseFloat(activePic) === parseFloat(picList.length) ? 'pic-box-color-active' : ''" />
</view> </view>
<view class="tips-box"> <view class="tips-box">
<view class="tips mt-30">注意事项</view> <view class="tips mt-30">注意事项</view>
@ -28,13 +31,16 @@
{{ item }} {{ item }}
</view> </view>
</view> </view>
<button class='but' formType="submit"> 立即充值 </button>
</view> </view>
<!-- 佣金提现 -->
<view class="tip" v-else> <view class="tip" v-else>
<view class='input'><text></text><input placeholder="0.00" type='number' placeholder-class='placeholder' :value="number" <view class='input'><text></text><input placeholder="0.00" type='number' placeholder-class='placeholder' :value="number"
name="number"></input></view> name="number"></input></view>
<view class="tips-title"> <view class="tips-title">
<view style="font-weight: bold; font-size: 26rpx;">提示</view> <view style="font-weight: bold; font-size: 26rpx;">提示</view>
<view style="margin-top: 10rpx;">当前佣金为 <text class='font-color'>{{userInfo.brokeragePrice || 0}}</text></view> <view style="margin-top: 10rpx;">当前佣金为 <text class='font-color'>{{ fen2yuan(spreadInfo.brokeragePrice || 0) }}</text></view>
</view> </view>
<view class="tips-box"> <view class="tips-box">
<view class="tips mt-30">注意事项</view> <view class="tips mt-30">注意事项</view>
@ -42,60 +48,46 @@
{{ item }} {{ item }}
</view> </view>
</view> </view>
<button class='but' formType="submit"> 立即转入 </button>
</view> </view>
<button class='but' formType="submit"> {{active ? '立即转入': '立即充值' }}</button>
</view> </view>
</form> </form>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home> <home></home>
</view> </view>
</template> </template>
<script> <script>
import { import * as WalletApi from '@/api/pay/wallet.js';
rechargeRoutine, import * as BrokerageAPI from '@/api/trade/brokerage.js'
rechargeWechat, import * as Util from '@/utils/util.js';
getRechargeApi, import { toLogin } from '@/libs/login.js';
transferIn, import { mapGetters } from "vuex";
appWechat
} from '@/api/user.js';
import { wechatQueryPayResult } from '@/api/order.js';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
import home from '@/components/home'; import home from '@/components/home';
export default { export default {
components: { components: {
// #ifdef MP
authorize,
// #endif
home home
}, },
data() { data() {
let that = this;
return { return {
wallet: {},
spreadInfo: {},
now_money: 0, now_money: 0,
navRecharge: ['账户充值', '佣金转入'], navRecharge: ['账户充值', '佣金转入'],
active: 0, active: 0,
number: '', number: '',
placeholder: "0.00", placeholder: "0.00",
from: '', from: '',
isAuto: false, //
isShowAuth: false, //
picList: [], picList: [],
activePic: 0, activePic: 0,
money: "", money: "",
numberPic: '', rechar_id: 0, //
rechar_id: 0, rechargeAttention: [
rechargeAttention: [] '1、充值金额最少为 1 元',
'2、充值后只能用于消费',
'3、提现金额需要有手续费',
'4、提现到账需要 2~3 天时间'
]
}; };
}, },
computed: mapGetters(['isLogin', 'systemPlatform','userInfo']), computed: mapGetters(['isLogin', 'systemPlatform','userInfo']),
@ -110,23 +102,13 @@
} }
}, },
onLoad(options) { onLoad(options) {
// #ifdef H5 if (!this.isLogin) {
this.from = this.$wechat.isWeixin() ? "public" : "weixinh5"; toLogin();
// #endif
if (true) {
alert('充值功能暂未实现!预期 10 月份');
return; return;
} }
if (this.isLogin) {
this.getRecharge(); this.getRecharge();
} else {
toLogin();
}
}, },
methods: { methods: {
/** /**
* 选择金额 * 选择金额
*/ */
@ -134,47 +116,46 @@
this.activePic = idx; this.activePic = idx;
if (item === undefined) { if (item === undefined) {
this.rechar_id = 0; this.rechar_id = 0;
this.numberPic = "";
} else { } else {
this.money = ""; this.money = "";
this.rechar_id = item.id; this.rechar_id = item.id;
this.numberPic = item.price;
} }
}, },
/** /**
* 充值额度选择 * 充值额度选择
*/ */
getRecharge() { getRecharge() {
getRechargeApi() //
.then(res => { WalletApi.getPayWallet().then(res=>{
this.picList = res.data.rechargeQuota; this.wallet = res.data;
if (this.picList[0]) {
this.rechar_id = this.picList[0].id;
this.numberPic = this.picList[0].price;
}
this.rechargeAttention = res.data.rechargeAttention || [];
}) })
.catch(res => { //
BrokerageAPI.getBrokerageUser().then(res => {
this.$set(this,'spreadInfo',res.data);
});
//
WalletApi.getWalletRechargePackageList().then(res => {
this.picList = res.data;
if (this.picList.length > 0) {
this.rechar_id = this.picList[0].id;
}
}).catch(res => {
this.$dialog.toast({ this.$dialog.toast({
mes: res mes: res
}); });
}); });
}, },
onLoadFun: function() { onLoadFun: function() {
this.getRecharge(); this.getRecharge();
}, },
//
authColse: function(e) {
this.isShowAuth = e
},
navRecharges: function(index) { navRecharges: function(index) {
this.active = index; this.active = index;
}, },
/*
/**
* 用户充值 * 用户充值
*/ */
submitSub: function(e) { submitSub: function(e) {
@ -182,7 +163,7 @@
let value = e.detail.value.number; let value = e.detail.value.number;
// //
if (that.active) { if (that.active) {
if (parseFloat(value) < 0 || parseFloat(value) == NaN || value == undefined || value == "") { if (parseFloat(value) < 0 || parseFloat(value) === NaN || value === undefined || value === "") {
return that.$util.Tips({ return that.$util.Tips({
title: '请输入金额' title: '请输入金额'
}); });
@ -191,14 +172,15 @@
title: '转入余额', title: '转入余额',
content: '转入余额后无法再次转出,确认是否转入余额', content: '转入余额后无法再次转出,确认是否转入余额',
success(res) { success(res) {
if (res.confirm) { if (!res.confirm) {
transferIn({ return that.$util.Tips({
price: parseFloat(value) title: '已取消'
}).then(res => {
that.$store.commit("changInfo", {
amount1: 'brokeragePrice',
amount2: that.$util.$h.Sub(that.userInfo.brokeragePrice, parseFloat(value))
}); });
}
BrokerageAPI.createBrokerageWithdraw({
type: 1,
price: parseFloat(value) * 100
}).then(res => {
return that.$util.Tips({ return that.$util.Tips({
title: '转入成功', title: '转入成功',
icon: 'success' icon: 'success'
@ -211,11 +193,6 @@
title: err title: err
}); });
}) })
} else if (res.cancel) {
return that.$util.Tips({
title: '已取消'
});
}
}, },
}) })
} else { } else {
@ -223,7 +200,7 @@
title: '正在支付', title: '正在支付',
}) })
let money = parseFloat(this.money); let money = parseFloat(this.money);
if (this.rechar_id == 0) { if (this.rechar_id === 0) {
if (Number.isNaN(money)) { if (Number.isNaN(money)) {
return that.$util.Tips({ return that.$util.Tips({
title: '充值金额必须为数字' title: '充值金额必须为数字'
@ -239,47 +216,14 @@
title: '充值金额最大值为 50000' title: '充值金额最大值为 50000'
}); });
} }
} else {
money = this.numberPic
} }
// #ifdef MP WalletApi.createWalletRecharge({
rechargeRoutine({ payPrice: money ? money * 100 : undefined,
price: money, packageId: this.rechar_id
type: 0,
rechar_id: this.rechar_id
}).then(res => { }).then(res => {
uni.hideLoading(); const returnUrl = encodeURIComponent('/pages/users/user_payment/index');
let jsConfig = res.data.data.jsConfig; uni.navigateTo({
uni.requestPayment({ url: `/pages/goods/cashier/index?order_id=${res.data.payOrderId}&returnUrl=${returnUrl}`
timeStamp: jsConfig.timeStamp,
nonceStr: jsConfig.nonceStr,
package: jsConfig.packages,
signType: jsConfig.signType,
paySign: jsConfig.paySign,
success: function(res) {
that.$store.commit("changInfo", {
amount1: 'nowMoney',
amount2: that.$util.$h.Add(value, that.userinfo.nowMoney)
});
//that.$set(that, 'userinfo.nowMoney', that.$util.$h.Add(value, that.userinfo.nowMoney));
return that.$util.Tips({
title: '支付成功',
icon: 'success'
}, {
tab: 5,
url: '/pages/users/user_money/index'
});
},
fail: function(err) {
return that.$util.Tips({
title: '支付失败'
});
},
complete: function(res) {
if (res.errMsg == 'requestPayment:cancel') return that.$util.Tips({
title: '取消支付'
});
}
}) })
}).catch(err => { }).catch(err => {
uni.hideLoading(); uni.hideLoading();
@ -287,74 +231,11 @@
title: err title: err
}) })
}); });
// #endif
// #ifdef H5
rechargeWechat({
price: money,
from: that.from,
rechar_id: that.rechar_id,
payType: 0
}).then(res => {
let jsConfig = res.data.jsConfig;
let orderNo = res.data.orderNo;
let data = {
timestamp:jsConfig.timeStamp,
nonceStr:jsConfig.nonceStr,
package:jsConfig.packages,
signType:jsConfig.signType,
paySign:jsConfig.paySign
};
if (that.from == "weixinh5") {
let domain = encodeURIComponent(location.href.split('/pages')[0]);
let urls = jsConfig.mwebUrl + '&redirect_url='+ domain + '/pages/users/user_money/index';
location.replace(urls);
return that.$util.Tips({
tab: 5,
url: '/pages/users/user_money/index'
});
// return that.$util.Tips({
// title: '',
// icon: 'success'
// }, {
// tab: 5,
// url: '/pages/users/user_money/index'
// });
} else {
that.$wechat.pay(data)
.finally(() => {
that.$store.commit("changInfo", {
amount1: 'nowMoney',
amount2: that.$util.$h.Add(value, that.userinfo.nowMoney)
});
// that.$set(that, 'userinfo.nowMoney', that.$util.$h.Add(value, that.userinfo.nowMoney));
wechatQueryPayResult(orderNo).then(res => {
return that.$util.Tips({
title: '支付成功',
icon: 'success'
}, {
tab: 5,
url: '/pages/users/user_money/index'
});
}).cache(err => {
return that.$util.Tips({
title: err
});
})
})
.catch(function(err) {
return that.$util.Tips({
title: '支付失败'
});
});
}
}).catch(res=>{
uni.hideLoading();
return that.$util.Tips({
title: res
});
})
// #endif
} }
},
fen2yuan(price) {
return Util.fen2yuan(price)
} }
} }
} }