orderEit.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="home-getOrder">
  3. <form class="form" @submit="orderSubmit">
  4. <view class="select-input">
  5. <input class="input" style="display:none;" />
  6. <text>账户余额:</text><input class="input" name="altMainBalance" disabled :value="altMainBalance"/>
  7. </view>
  8. <view class="select-input">
  9. <input class="input" style="display:none;" />
  10. <text>订单编号:</text><input class="input" name="sn" disabled :value="sn"/>
  11. </view>
  12. <view class="select-input">
  13. <input class="input" style="display:none;" />
  14. <text>设备编码:</text><input class="input" name="clientId" :value="clientId" />
  15. </view>
  16. <view class="select-input">
  17. <input class="input" style="display:none;" />
  18. <text>商品名称:</text><input class="input" name="productName" disabled :value="productName" />
  19. </view>
  20. <view class="select-input">
  21. <input class="input" style="display:none;" />
  22. <text>商品价格:</text><input class="input" name="price" disabled :value="price" />
  23. </view>
  24. <view class="select-input">
  25. <input class="input" style="display:none;" />
  26. <text>支付时间:</text><input class="input" name="payDate" disabled :value="payDate"/>
  27. </view>
  28. <view class="select-input">
  29. <input class="input" style="display:none;" />
  30. <text>退款时间:</text><input class="input" name="refundDate" disabled :value="refundDate"/>
  31. </view>
  32. <view class="select-input">
  33. <input class="input" style="display:none;" />
  34. <text>订单状态:</text><input class="input" name="status" disabled :value="status==1?('已支付'):(status==2?'退款中':'已退款')" />
  35. </view>
  36. <view class="btn-area">
  37. <button type="primary" formType="submit" >退款</button>
  38. </view>
  39. </form>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data(){
  45. return{
  46. order:null,
  47. sn:null,
  48. clientId:null,
  49. productName:null,
  50. price:null,
  51. payDate:null,
  52. refundDate:null,
  53. status:null,
  54. altMainBalance:0,
  55. production:0
  56. }
  57. },
  58. onLoad: function(option) {
  59. const order = JSON.parse(decodeURIComponent(option.order));
  60. this.order = order;
  61. if(order.type==1){
  62. this.production = order.agencyProportion;
  63. }
  64. if(order.type==2){
  65. this.production = order.merchantProportion;
  66. }
  67. if(order.type==3){
  68. this.production = order.personageProportion;
  69. }
  70. this.sn = order.sn;
  71. this.clientId = order.clientId;
  72. this.productName = order.productName;
  73. this.price = order.price;
  74. this.payDate = order.payDate;
  75. this.refundDate = order.refundDate;
  76. this.status = order.status;
  77. },
  78. onShow() {
  79. this.mch();
  80. // console.log("订单详情")
  81. },
  82. methods: {
  83. orderSubmit(e) {
  84. var price = this.price;
  85. var production = this.production;
  86. var altMainBalance = this.altMainBalance;
  87. var refusePrice = price*production/100;
  88. // console.log("refusePrice="+refusePrice)
  89. if(altMainBalance<refusePrice){
  90. uni.showToast({
  91. title: '余额不足',
  92. duration: 2000
  93. });
  94. return;
  95. }
  96. uni.showModal({
  97. title: '退款',
  98. content: '确定执行退款操作?',
  99. success: (res) => {
  100. if (res.confirm) {
  101. var order = this.order;
  102. var token = uni.getStorageSync("token");
  103. uni.request({
  104. url: this.serverurl + '/TOrder/refund',
  105. data: {
  106. "sn": order.sn,
  107. "id": order.id,
  108. },
  109. header: {
  110. 'token': token
  111. },
  112. method: "POST",
  113. success: (res) => {
  114. var message = res.data.message;
  115. if(res.data.code){
  116. this.status = 2;
  117. }
  118. uni.showToast({
  119. title: message,
  120. duration: 3000
  121. });
  122. },
  123. });
  124. } else if (res.cancel) {
  125. // console.log('用户点击取消');
  126. }
  127. }
  128. });
  129. },
  130. mch(){
  131. var token = uni.getStorageSync("token");
  132. var globalUser = uni.getStorageSync("globalUser");
  133. uni.request({
  134. url: this.serverurl + '/TJoinpayMch/getMch',
  135. data: {
  136. "adminId": globalUser.id,
  137. "bizCode":this.order.id
  138. },
  139. header: {
  140. 'token': token
  141. },
  142. method: "POST",
  143. success: (res) => {
  144. var date = res.data.data;
  145. this.altMainBalance = date.altMainBalance;
  146. },
  147. });
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss">
  153. .home-getOrder {
  154. padding-top: 50upx;
  155. }
  156. .select-input {
  157. display: flex;
  158. flex-direction: row;
  159. justify-content: flex-start;
  160. font-size: 16px;
  161. border-bottom: 1px solid;
  162. margin: 20upx 30upx 30upx 30upx;
  163. // box-shadow: 0upx 0upx 20upx #D3D3D3;
  164. text {
  165. margin-left: 30upx;
  166. }
  167. input {
  168. padding-left: 20upx;
  169. background-color: #FFFFFF;
  170. width: 400upx;
  171. height: 50upx;
  172. // box-shadow: 0upx 0upx 20upx #D3D3D3;
  173. // border-radius: 5upx;
  174. }
  175. }
  176. .form {
  177. width: calc(100% - 100upx);
  178. padding: 50upx;
  179. // .section{
  180. // margin:50upx 0;
  181. // }
  182. .btn-area {
  183. margin-top: 50upx;
  184. padding: 50upx;
  185. button {
  186. background-color: #007AFF;
  187. }
  188. }
  189. }
  190. </style>