123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <template>
- <view>
- <view v-show="showData" class="container">
- <view style="padding: 20rpx 48rpx">
- <img src="../../static/img/logo.png" class="logImg" alt="">
- <view v-if="form.status" class="container_title">
- <image src="../../static/img/w7.png" mode="widthFix" style="width: 100rpx; margin-right: 10rpx"></image>
- <text>已完成支付</text>
- </view>
- </view>
- <view class="boxList">
- <view v-for="(item, i) in list" :key="i">
- <view v-show="i != 0 && list.length > 1" class="image">
- <image src="../../static/img/line.png" style="width: 100%;" mode="widthFix" alt="">
- </view>
- <view class="box nav" :class="getStyle(i, list.length)">
- <view class="box_item">
- <text class="textL">退货人:</text>
- <text class="textR">{{ item.customer_name }}</text>
- </view>
- <view class="box_item">
- <text class="textL">手机号:</text>
- <text class="textR">{{ item.customer_phone | hideMiddle }}</text>
- </view>
- <view class="box_line" />
- <view class="box_item">
- <text class="textL">所属公司客户:</text>
- <text class="textR">{{ item.user && item.user.nickname }}</text>
- </view>
- <view class="box_item">
- <text class="textL">手机号:</text>
- <text class="textR">{{ item.user && item.user.mobile | hideMiddle }}</text>
- </view>
- <view class="box_line" />
- <view class="box_item" v-for="(v) in item.applydetail">
- <text class="textL">{{ v.good_name }}:</text>
- <text class="textR">{{ `${v.total + v.unit}` }}</text>
- </view>
- <view class="box_line" />
- <view class="box_item">
- <text class="textL">应退差价:</text>
- <text class="textR">{{ item.return_price }}</text>
- </view>
- <view class="box_item">
- <text class="textL">实退差价:</text>
- <text class="textR">{{ item.fact_money }}</text>
- </view>
- <view v-show="item.remark" class="box_item">
- <text class="textL">备注:</text>
- <text class="textR">{{ item.remark }}</text>
- </view>
- </view>
- </view>
- <view class="bottom">
- <view class="text">
- 差价总金额:
- </view>
- <view class="num">
- ¥{{ form.account }}
- </view>
- <view v-if="!form.status" class="pay" @click="toPay()">
- 立即支付
- </view>
- </view>
- </view>
- </view>
- <view v-show="!showData && finish" class="finish">
- <image src="../../static/img/w3.png" mode="widthFix"></image>
- <text>{{ message }}</text>
- </view>
- <view v-show="!showData && !finish" class="notData">
- <image src="../../static/img/no_record.png" mode="widthFix"></image>
- <!-- <text>暂无数据</text> -->
- </view>
- </view>
- </template>
- <script>
- import { getRefundInfo, CustomerReturnPay, getOpenid } from '../../api/index.js';
- export default {
- data() {
- return {
- showData: false,
- form: {},
- list: [],
- data: {},
- finish: false,
- message: '',
- openid: ''
- }
- },
- filters: {
- hideMiddle(val){ //隐藏号码
- if (val === null || !val) {
- return '';
- } else {
- return `${val.substring(0, 3)}****${val.substring(val.length - 4)}`;
- }
- }
- },
- onLoad(option) {
- let wxcode = this.getUrlParam('code')
- if (!wxcode) {
- const redirect_uri = 'http://api.app.cliu.cc'
- const wxURL = 'https://open.weixin.qq.com/connect/oauth2/authorize'
- const appid = 'wx5224793b7dc7f7b7'
- let uri = encodeURIComponent(
- `${redirect_uri}/h5/#/pages/returnedInfo/index?id=${option.id}&verify=${option.verify}`
- );
- let authURL =
- `${wxURL}?appid=${appid}&redirect_uri=${uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`;
- window.location.href = authURL;
- return false;
- }
- getOpenid({
- code: wxcode
- }).then(res => {
- if (res.code == 200) {
- this.openid = res.data.openid
- } else {
- uni.showToast({
- title: res.msg || '获取openid失败',
- icon: 'none'
- })
- }
- }).catch(err => {
- uni.showToast({
- title: err || '获取openid失败',
- icon: 'none'
- })
- })
- this.data = option
- this.getList()
- },
- methods: {
- getStyle(i, l) {
- const a = i + 1
- if (a == 1 && l == 1) {
- return 'nav1'
- } else if (a == 1 && l > 1) {
- return 'nav3'
- } else if (a == l && a != 1) {
- return 'nav2'
- }
- },
- //获取code值方法
- getUrlParam(name) {
- console.log(window.location, 'location');
- console.log(window.location.href, 'href');
- var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); //构造一个含有目标参数的正则表达式对象
- var r = window.location.search.substr(1).match(reg); //匹配目标参数
- if (r != null) return decodeURIComponent(r[2]);
- // return null; //返回参数值
- return ''; //返回参数值
- },
- getList() {
- getRefundInfo({ refund_id: this.data.id, verify: this.data.verify }).then(res => {
- if (res.code == 200) {
- if (res.data) {
- this.showData = true
- this.list = res.data.customer_return
- this.form = res.data
- }
- } else if (res.code == 450001) {
- this.finish = true
- this.message = res.message
- } else {
- uni.showModal({
- content: res.message || '获取失败',
- showCancel: false
- })
- }
- }).catch(err => {
- })
- },
- toPay() {
- CustomerReturnPay({ refund_id: this.data.id, amount: this.form.account, openid: this.openid }).then(res => {
- if (res.code === 200) {
- let callback_succ_func = res => {
- uni.showToast({
- title: '支付成功'
- })
- }
- let callback_error_func = res => {
- uni.showModal({
- content: '支付失败!',
- showCancel: false
- })
- }
- this.wxJsPay(res.data, callback_succ_func, callback_error_func)
- } else {
- uni.showToast({
- title: res.message || '失败',
- icon: 'none'
- })
- return false;
- }
- })
- .catch(err => {})
- .finally(() => {
- setTimeout(() => {}, 3000)
- })
- },
- //WeixinJSBridge判断
- wxJsPay(data, callback_succ_func, callback_error_func) {
- if (typeof WeixinJSBridge == 'undefined') {
- if (document.addEventListener) {
- document.addEventListener('WeixinJSBridgeReady', this.jsApiCall, false);
- } else if (document.attachEvent) {
- document.attachEvent('WeixinJSBridgeReady', this.jsApiCall);
- document.attachEvent('onWeixinJSBridgeReady', this.jsApiCall);
- }
- } else {
- this.jsApiCall(data, callback_succ_func, callback_error_func);
- }
- },
- //调起支付
- jsApiCall(data, callback_succ_func, callback_error_func) {
- //使用原生的,避免初始化appid问题
- WeixinJSBridge.invoke(
- 'getBrandWCPayRequest', {
- appId: data.appId,
- timeStamp: data.timestamp,
- nonceStr: data.nonceStr,
- package: data.package,
- signType: data.signType,
- paySign: data.paySign
- },
- function(res) {
- var msg = res.err_msg ? res.err_msg : res.errMsg;
- switch (msg) {
- // //支付成功时
- case 'get_brand_wcpay_request:ok':
- // if (callback_succ_func) {
- uni.showModal({
- title: '支付成功',
- showCancel: false,
- success: function(res) {
- uni.reLaunch({
- url: "/pages/payment/payment"
- })
- },
- // complete: function() {
- // that.SearchStatus()
- // }
- });
- // }
- break;
- default:
- //支付失败时
- WeixinJSBridge.log('支付失败!' + msg + ',请返回重试.');
- if (callback_error_func) {
- callback_error_func({
- msg: msg
- });
- }
- break;
- }
- }
- );
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- background-size: 100% auto;
- background-repeat: repeat-y;
- background-image: url("../../static/img/wall-min.png");
- }
- .finish {
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- color: #fff;
- padding-top: 50%;
- image {
- width: 100rpx;
- margin-bottom: 20rpx;
- }
- }
- .notData {
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- background-color: #fff;
- color: #fff;
- height: 100vh;
- image {
- width: 500rpx;
- }
- }
- .container {
- width: 100vw;
- height: 100%;
- padding-top: 40rpx !important;
- padding-bottom: 140rpx;
- &_title {
- display:flex;
- color: #fff;
- align-items: center;
- justify-content: center;
- text {
- font-size: 40rpx;
- font-weight: bold;
- }
- }
- .logImg {
- width: 100%;
- display: block;
- }
- .nav1 {
- border-radius: 16rpx;
- }
- .nav2 {
- border-radius: 0 0 16rpx 16rpx !important;
- }
- .nav3 {
- border-radius: 16rpx 16rpx 0 0 !important;
- }
- .boxList {
- padding: 0 24rpx;
- }
- .box {
- margin-top: -1rpx;
- padding: 24rpx 24rpx 0 24rpx;
- background: #FFFFFF;
- // border-radius: 16rpx;
- &_item {
- display: flex;
- justify-content: space-between;
- text {
- font-size: 32rpx;
- margin-bottom: 24rpx;
- display: block;
- }
- .textL {
- color: #999999;
- }
- .textR {
- color: #333333;
- width: 360rpx;
- text-align: end;
- word-break: break-all;
- }
- }
- &_line {
- border-bottom: 2rpx solid #EEEEEE;
- margin-bottom: 24rpx;
- }
- }
- .image {
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- }
- .bottom {
- position: fixed;
- height: 112rpx;
- left: 0;
- bottom: 0;
- width: 100%;
- border-top: 2rpx solid #EEEEEE;
- background-color: #fff;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- .pay {
- width: 30%;
- line-height: 80rpx;
- text-align: center;
- margin-right: 20rpx;
- background: linear-gradient(91deg, #F30000 0%, #FE4815 100%);
- border-radius: 44rpx 44rpx 44rpx 44rpx;
- font-size: 32rpx;
- font-weight: bold;
- color: #FFFFFF;
- }
- .text {
- font-size: 26rpx;
- color: #333333;
- }
- .num {
- font-size: 34rpx;
- color: #FB231F;
- font-weight: bold;
- margin-right: 20rpx;
- }
- }
- // .bottom {
- // position: fixed;
- // left: 0;
- // bottom: 0;
- // width: 100%;
- // background-size: 100% auto;
- // background-repeat: repeat-y;
- // background-image: url("../../static/img/wall-min.png");
- // .btn {
- // padding: 20rpx 24rpx;
- // background-color: #fff;
- // display: flex;
- // justify-content: center;
- // align-items: center;
- // .pay {
- // width: 100%;
- // line-height: 88rpx;
- // text-align: center;
- // background: linear-gradient(91deg, #F30000 0%, #FE4815 100%);
- // border-radius: 44rpx 44rpx 44rpx 44rpx;
- // font-size: 32rpx;
- // font-weight: bold;
- // color: #FFFFFF;
- // }
- // }
- // .totalMoney {
- // padding: 86rpx 0 82rpx 0;
- // margin: 24rpx 24rpx 40rpx 24rpx;
- // border-radius: 16rpx 16rpx 16rpx 16rpx;
- // background-color: #fff;
- // display: flex;
- // flex-direction: column;
- // align-items: center;
- // font-weight: bold;
- // &_text {
- // font-size: 36rpx;
- // margin-bottom: 24rpx;
- // color: #333333;
- // }
- // &_num {
- // font-size: 76rpx;
- // color: #FB231F;
- // }
- // }
- // }
- }
- </style>
|