orderEit.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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="note" disabled :value="note"/>
  31. </view>
  32. <view class="select-input">
  33. <input class="input" style="display:none;" />
  34. <text>退款时间:</text><input class="input" name="refundDate" disabled :value="refundDate"/>
  35. </view>
  36. <view class="select-input">
  37. <input class="input" style="display:none;" />
  38. <text>已退款金额:</text><input class="input" name="refundPrice" disabled :value="refundPrice" />
  39. </view>
  40. <view class="select-input">
  41. <input class="input" style="display:none;" />
  42. <text>订单状态:</text><input class="input" name="status" disabled :value="status==1?('已支付'):(status==2?'退款中':'已退款')" />
  43. </view>
  44. <view class="select-input">
  45. <input class="input" style="display:none;" />
  46. <text>退款金额:</text><input class="input2" @focus="setStyle()" @blur="setStyle2()" v-model="refundAmount" />
  47. </view>
  48. <p id="p2" class="p2" :style="{display:showOrNo}">请慎重对待!</p>
  49. <view class="select-input">
  50. <input class="input" style="display:none;" />
  51. <text>PS:退款金额可修改</text>
  52. </view>
  53. <view class="btn-area">
  54. <button type="primary" formType="submit" >退款</button>
  55. </view>
  56. </form>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data(){
  62. return{
  63. order:null,
  64. sn:null,
  65. clientId:null,
  66. productName:null,
  67. price:null,
  68. payDate:null,
  69. refundDate:null,
  70. status:null,
  71. altMainBalance:0,
  72. refundAmount:0,
  73. refundPrice:0,
  74. showOrNo: null,
  75. note:null,
  76. production:0
  77. }
  78. },
  79. onLoad: function(option) {
  80. const order = JSON.parse(decodeURIComponent(option.order));
  81. this.order = order;
  82. if(order.type==1){
  83. this.production = order.agencyProportion;
  84. }
  85. if(order.type==2){
  86. this.production = order.merchantProportion;
  87. }
  88. if(order.type==3){
  89. this.production = order.personageProportion;
  90. }
  91. this.sn = order.sn;
  92. this.clientId = order.clientId;
  93. this.productName = order.productName;
  94. this.price = order.price;
  95. this.payDate = order.payDate;
  96. this.refundDate = order.refundDate;
  97. this.status = order.status;
  98. this.note = order.note;
  99. this.refundPrice = order.refundAmount;
  100. this.refundAmount = order.price;
  101. },
  102. onShow() {
  103. this.mch();
  104. // console.log("订单详情")
  105. },
  106. methods: {
  107. orderSubmit(e) {
  108. var price = this.price;
  109. var production = this.production;
  110. var altMainBalance = this.altMainBalance;
  111. var refusePrice = price*production/100;
  112. console.log("refusePrice="+refusePrice)
  113. if(altMainBalance<refusePrice.toFixed(2)){
  114. uni.showToast({
  115. title: '余额不足',
  116. duration: 2000
  117. });
  118. return;
  119. }
  120. uni.showModal({
  121. title: '退款',
  122. content: '确定执行退款操作?',
  123. success: (res) => {
  124. if (res.confirm) {
  125. var order = this.order;
  126. var refundAmount = this.refundAmount;
  127. var token = uni.getStorageSync("token");
  128. if(order.payPlatform == '3') {
  129. //如果为直接对接微信支付
  130. uni.request({
  131. url: this.serverurl + '/tWeixinPay/refund',
  132. data: {
  133. "sn": order.sn,
  134. "refusePrice":refundAmount
  135. },
  136. header: {
  137. 'token': token
  138. },
  139. method: "GET",
  140. success: (res) => {
  141. var message = res.data.message;
  142. if(res.data.code){
  143. this.status = 2;
  144. }
  145. uni.showToast({
  146. title: message,
  147. duration: 3000
  148. });
  149. },
  150. });
  151. }else{
  152. uni.request({
  153. url: this.serverurl + '/TOrder/refund',
  154. data: {
  155. "sn": order.sn,
  156. "id": order.id,
  157. "refundAmount":refundAmount
  158. },
  159. header: {
  160. 'token': token
  161. },
  162. method: "POST",
  163. success: (res) => {
  164. var message = res.data.message;
  165. if(res.data.code){
  166. this.status = 2;
  167. }
  168. uni.showToast({
  169. title: message,
  170. duration: 3000
  171. });
  172. },
  173. });
  174. }
  175. } else if (res.cancel) {
  176. // console.log('用户点击取消');
  177. }
  178. }
  179. });
  180. },
  181. mch(){
  182. var token = uni.getStorageSync("token");
  183. var globalUser = uni.getStorageSync("globalUser");
  184. uni.request({
  185. url: this.serverurl + '/TJoinpayMch/getMch',
  186. data: {
  187. "adminId": globalUser.id,
  188. "bizCode":this.order.id
  189. },
  190. header: {
  191. 'token': token
  192. },
  193. method: "POST",
  194. success: (res) => {
  195. var date = res.data.data;
  196. this.altMainBalance = date.altMainBalance;
  197. },
  198. });
  199. },
  200. setStyle() {
  201. this.showOrNo = "block";
  202. },
  203. setStyle2() {
  204. this.showOrNo = "none";
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="scss">
  210. .home-getOrder {
  211. padding-top: 50upx;
  212. }
  213. .select-input {
  214. display: flex;
  215. flex-direction: row;
  216. justify-content: flex-start;
  217. font-size: 16px;
  218. border-bottom: 1px solid;
  219. margin: 20upx 30upx 30upx 30upx;
  220. // box-shadow: 0upx 0upx 20upx #D3D3D3;
  221. text {
  222. margin-left: 30upx;
  223. }
  224. input {
  225. padding-left: 20upx;
  226. background-color: #FFFFFF;
  227. width: 400upx;
  228. height: 50upx;
  229. // box-shadow: 0upx 0upx 20upx #D3D3D3;
  230. // border-radius: 5upx;
  231. }
  232. }
  233. .form {
  234. width: calc(100% - 100upx);
  235. padding: 50upx;
  236. // .section{
  237. // margin:50upx 0;
  238. // }
  239. .btn-area {
  240. margin-top: 50upx;
  241. padding: 50upx;
  242. button {
  243. background-color: #007AFF;
  244. }
  245. }
  246. }
  247. .input2{
  248. box-shadow: 0upx 0upx 20upx #D3D3D3;
  249. border-radius: 5upx;
  250. }
  251. .p2 {
  252. color: #DD524D;
  253. display: none;
  254. width: 300upx;
  255. height: 50upx;
  256. border: 1px;
  257. margin-left: auto;
  258. margin-right: auto;
  259. padding-left: 30upx;
  260. }
  261. </style>