123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <view class="home-getOrder">
- <form class="form" @submit="orderSubmit">
- <view class="select-input">
- <input class="input" style="display:none;" />
- <text>账户余额:</text><input class="input" name="altMainBalance" disabled :value="altMainBalance"/>
- </view>
- <view class="select-input">
- <input class="input" style="display:none;" />
- <text>订单编号:</text><input class="input" name="sn" disabled :value="sn"/>
- </view>
- <view class="select-input">
- <input class="input" style="display:none;" />
- <text>设备编码:</text><input class="input" name="clientId" :value="clientId" />
- </view>
- <view class="select-input">
- <input class="input" style="display:none;" />
- <text>商品名称:</text><input class="input" name="productName" disabled :value="productName" />
- </view>
- <view class="select-input">
- <input class="input" style="display:none;" />
- <text>商品价格:</text><input class="input" name="price" disabled :value="price" />
- </view>
- <view class="select-input">
- <input class="input" style="display:none;" />
- <text>支付时间:</text><input class="input" name="payDate" disabled :value="payDate"/>
- </view>
- <view class="select-input">
- <input class="input" style="display:none;" />
- <text>退款时间:</text><input class="input" name="refundDate" disabled :value="refundDate"/>
- </view>
- <view class="select-input">
- <input class="input" style="display:none;" />
- <text>订单状态:</text><input class="input" name="status" disabled :value="status==1?('已支付'):(status==2?'退款中':'已退款')" />
- </view>
- <view class="btn-area">
- <button type="primary" formType="submit" >退款</button>
- </view>
- </form>
- </view>
- </template>
- <script>
- export default {
- data(){
- return{
- order:null,
- sn:null,
- clientId:null,
- productName:null,
- price:null,
- payDate:null,
- refundDate:null,
- status:null,
- altMainBalance:0,
- production:0
- }
- },
- onLoad: function(option) {
- const order = JSON.parse(decodeURIComponent(option.order));
- this.order = order;
- if(order.type==1){
- this.production = order.agencyProportion;
- }
- if(order.type==2){
- this.production = order.merchantProportion;
- }
- if(order.type==3){
- this.production = order.personageProportion;
- }
- this.sn = order.sn;
- this.clientId = order.clientId;
- this.productName = order.productName;
- this.price = order.price;
- this.payDate = order.payDate;
- this.refundDate = order.refundDate;
- this.status = order.status;
- },
- onShow() {
- this.mch();
- // console.log("订单详情")
- },
- methods: {
- orderSubmit(e) {
- var price = this.price;
- var production = this.production;
- var altMainBalance = this.altMainBalance;
- var refusePrice = price*production/100;
- // console.log("refusePrice="+refusePrice)
- if(altMainBalance<refusePrice){
- uni.showToast({
- title: '余额不足',
- duration: 2000
- });
- return;
- }
- uni.showModal({
- title: '退款',
- content: '确定执行退款操作?',
- success: (res) => {
- if (res.confirm) {
- var order = this.order;
- var token = uni.getStorageSync("token");
- uni.request({
- url: this.serverurl + '/TOrder/refund',
- data: {
- "sn": order.sn,
- "id": order.id,
- },
- header: {
- 'token': token
- },
- method: "POST",
- success: (res) => {
- var message = res.data.message;
- if(res.data.code){
- this.status = 2;
- }
- uni.showToast({
- title: message,
- duration: 3000
- });
- },
- });
-
- } else if (res.cancel) {
- // console.log('用户点击取消');
-
- }
- }
- });
- },
- mch(){
- var token = uni.getStorageSync("token");
- var globalUser = uni.getStorageSync("globalUser");
- uni.request({
- url: this.serverurl + '/TJoinpayMch/getMch',
- data: {
- "adminId": globalUser.id,
- "bizCode":this.order.id
- },
- header: {
- 'token': token
- },
- method: "POST",
- success: (res) => {
- var date = res.data.data;
- this.altMainBalance = date.altMainBalance;
- },
- });
- }
- }
- }
- </script>
- <style lang="scss">
- .home-getOrder {
- padding-top: 50upx;
- }
- .select-input {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- font-size: 16px;
- border-bottom: 1px solid;
- margin: 20upx 30upx 30upx 30upx;
- // box-shadow: 0upx 0upx 20upx #D3D3D3;
- text {
- margin-left: 30upx;
- }
- input {
- padding-left: 20upx;
- background-color: #FFFFFF;
- width: 400upx;
- height: 50upx;
- // box-shadow: 0upx 0upx 20upx #D3D3D3;
- // border-radius: 5upx;
- }
- }
- .form {
- width: calc(100% - 100upx);
- padding: 50upx;
- // .section{
- // margin:50upx 0;
- // }
- .btn-area {
- margin-top: 50upx;
- padding: 50upx;
- button {
- background-color: #007AFF;
- }
- }
- }
- </style>
|