pay.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <view class="content">
  3. <view class="supplyInfo">
  4. <view class="tel flex">
  5. <label>缴费名称:</label>
  6. <input type="text" class="card input" v-model="payInfo.name" disabled/>
  7. </view>
  8. <view class="tel flex">
  9. <label>订单编号:</label>
  10. <input type="text" class="card input" v-model="payInfo.code" disabled/>
  11. </view>
  12. <view class="tel flex">
  13. <label>住宅地址:</label>
  14. <input type="text" class="card input" v-model="payInfo.address" disabled/>
  15. </view>
  16. <view class="tel flex">
  17. <label>户主姓名:</label>
  18. <input type="text" class="card input" v-model="payInfo.owner_name" disabled/>
  19. </view>
  20. <view class="tel flex">
  21. <label>住宅面积:</label>
  22. <input type="text" class="card input" v-model="payInfo.area" disabled/>
  23. </view>
  24. <view class="tel flex">
  25. <label>缴费类型:</label>
  26. <radio-group @change="payChange">
  27. <radio value="1" :checked="payInfo.type!==2" style="margin-right: 30rpx;transform: scale(0.85);">金额</radio>
  28. <radio value="2" :checked="payInfo.type===2" style="transform: scale(0.85);">空置</radio>
  29. </radio-group>
  30. </view>
  31. <view class="tel flex">
  32. <label>缴费金额:</label>
  33. <input type="text" class="card input" id="real_fee" v-model="payInfo.real_fee" disabled/>
  34. </view>
  35. </view>
  36. <button class="submit" @tap="paySubmit">{{payStatus ? '申请开票' : '缴费'}}</button>
  37. <uni-popup ref="popup" :mask-click="false">
  38. <view class="popup-box">
  39. <view>
  40. <view class="popup-title">申请开票</view>
  41. <view class="popup-content-box">
  42. <view class="popup-content">
  43. <view class="popup-type">
  44. <view>开票抬头:</view><input type="text" value="" />
  45. </view>
  46. <view class="popup-type">
  47. <view>备注:</view><input type="text" value="" />
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="popup-footer">
  53. <button class="popup-submit" @click="submitInvocie">提交</button>
  54. </view>
  55. </view>
  56. </uni-popup>
  57. </view>
  58. </template>
  59. <script>
  60. import md5 from "@/common/md5.js";
  61. export default {
  62. data() {
  63. return {
  64. payInfo: {
  65. },
  66. payStatus:0,
  67. };
  68. },
  69. onLoad(option) {
  70. this.getPayDetail(option.id)
  71. },
  72. methods: {
  73. getPayDetail(payId) {
  74. let md5Sign = md5(
  75. "method=" +
  76. "user" +
  77. "&timestamp=" +
  78. getApp().globalData.globalTimestamp +
  79. "&secret=" +
  80. getApp().globalData.secret
  81. );
  82. let url =
  83. getApp().globalData.shareUrl +
  84. "api/api.php" +
  85. "?method=user&source=user&action=get_order_info&timestamp=" +
  86. getApp().globalData.globalTimestamp +
  87. "&sign=" +
  88. md5Sign;
  89. let postData = {
  90. code:payId,
  91. openId: getApp().globalData.open_id,
  92. };
  93. uni.request({
  94. url: url,
  95. method: "POST",
  96. header: {
  97. "content-type": "application/x-www-form-urlencoded",
  98. },
  99. data: postData,
  100. success: (res) => {
  101. if (res.data.code === 200) {
  102. this.payInfo = res.data.data;
  103. this.payInfo.address = this.payInfo.estate_name + this.payInfo.building_name + this.payInfo.unit + this.payInfo.room
  104. } else {
  105. uni.showToast({
  106. title: res.data.msg,
  107. icon: "none",
  108. duration: 2500,
  109. });
  110. }
  111. },
  112. fail: () => {
  113. console.log("连接失败");
  114. },
  115. });
  116. },
  117. payChange(e){
  118. let v = e.detail.value;
  119. if (v == 2)
  120. {
  121. let value = this.payInfo.part_fee - this.payInfo.reduction;
  122. this.payInfo.real_fee = value;
  123. }
  124. else
  125. {
  126. let value = this.payInfo.total_fee - this.payInfo.reduction;
  127. this.payInfo.real_fee = value;
  128. }
  129. this.payInfo.payType = e.detail.value;
  130. },
  131. paySubmit(){
  132. this.payStatus = 1;
  133. if(this.payStatus){
  134. this.open()
  135. }
  136. },
  137. submitInvocie(){
  138. this.closePopup()
  139. },
  140. open() {
  141. this.$refs.popup.open('center')
  142. },
  143. closePopup() {
  144. this.$refs.popup.close()
  145. },
  146. },
  147. };
  148. </script>
  149. <style lang="scss" scoped>
  150. .content {
  151. font-size: 28rpx;
  152. font-weight: 200;
  153. padding: 1% 2%;
  154. .title {
  155. font-size: 30rpx;
  156. margin: 4% 0;
  157. }
  158. label {
  159. display: inline-block;
  160. width: 25%;
  161. vertical-align: middle;
  162. }
  163. .card {
  164. background-color: rgb(248, 247, 247);
  165. border-radius: 10rpx;
  166. }
  167. .flex {
  168. display: flex;
  169. align-items: center;
  170. margin-bottom: 2%;
  171. }
  172. .input {
  173. padding: 0 2%;
  174. margin: 2% 0;
  175. display: inline-block;
  176. width: 80%;
  177. height: 70rpx;
  178. }
  179. .supplyInfo {
  180. border-radius: 40rpx;
  181. padding: 4%;
  182. box-shadow: rgba(100, 100, 111, 0.2) 14rpx 14rpx 40rpx 14rpx;
  183. margin: 30rpx 0 30rpx 0;
  184. }
  185. .info {
  186. margin-top: 2%;
  187. border-radius: 40rpx;
  188. padding: 2% 4%;
  189. box-shadow: rgba(100, 100, 111, 0.2) 14rpx 14rpx 40rpx 14rpx;
  190. }
  191. .submit {
  192. color: white;
  193. font-weight: normal;
  194. width: 55%;
  195. border-radius: 20rpx;
  196. background-color: #02a7f0;
  197. margin: 120rpx auto;
  198. }
  199. }
  200. .popup-box {
  201. height: 100%;
  202. display: flex;
  203. flex-direction: column;
  204. justify-content: space-between;
  205. }
  206. .popup-title {
  207. text-align: center;
  208. font-weight: bold;
  209. height: 30px;
  210. border-bottom: 1px solid #d8d8d8;
  211. }
  212. .popup-content {
  213. font-size: 28rpx;
  214. padding: 10rpx 0 10rpx 0;
  215. }
  216. .popup-type {
  217. display: flex;
  218. height: 80rpx;
  219. align-items: center;
  220. margin-top: 60rpx;
  221. view {
  222. width: 30%;
  223. }
  224. input {
  225. border: 1px solid #d7d7d7;
  226. width: 60%;
  227. border-radius: 5rpx;
  228. padding-left: 10rpx;
  229. height: 56rpx;
  230. }
  231. }
  232. .popup-footer {
  233. display: flex;
  234. button{
  235. font-size: 26rpx;
  236. height: 60rpx;
  237. width: 150rpx;
  238. line-height: 60rpx;
  239. color: #FFFFFF;
  240. }
  241. }
  242. .popup-cancel {
  243. background-color: #AAAAAA;
  244. }
  245. .popup-submit {
  246. background-color: #249CD3;
  247. }
  248. </style>