BankPay.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <view :class="['qn-page-' + theme]">
  3. <template v-if="!shenhe">
  4. <u-navbar title="上传打款凭证" :custom-back="customBack"></u-navbar>
  5. <view class="money-view">
  6. <view class="num">
  7. <text class="icon">¥</text>
  8. {{ payAmount }}
  9. </view>
  10. <view class="label">订单金额</view>
  11. </view>
  12. <view class="bank-view">
  13. <u-form label-width="180">
  14. <u-form-item label="账户名称">
  15. <view class="form-item-in">
  16. <u-input @click="copyData(bank_data.name)" v-model="bank_data.name" disabled />
  17. <text class="copy-text">复制</text>
  18. </view>
  19. </u-form-item>
  20. <u-form-item label="开户行">
  21. <view class="form-item-in">
  22. <u-input @click="copyData(bank_data.bankName)" v-model="bank_data.bankName" disabled />
  23. <text class="copy-text">复制</text>
  24. </view>
  25. </u-form-item>
  26. <u-form-item label="开户人">
  27. <view class="form-item-in">
  28. <u-input @click="copyData(bank_data.bankAccount)" v-model="bank_data.bankAccount" disabled />
  29. <text class="copy-text">复制</text>
  30. </view>
  31. </u-form-item>
  32. <u-form-item label="银行账户">
  33. <view class="form-item-in">
  34. <u-input @click="copyData(bank_data.accountNumber)" v-model="bank_data.accountNumber"
  35. disabled />
  36. <text class="copy-text">复制</text>
  37. </view>
  38. </u-form-item>
  39. <u-form-item label="上传凭证">
  40. <QiniuUpload @uploadSuccess="uploadSuccess" :images="bank_data.image" @handleRemove="imgRemove">
  41. <!-- <div slot="cont">
  42. <view class="bank-license" v-for="item,index in bank_data.image" :key='index'>
  43. <block v-if="item">
  44. <img class="license-pic" :src="item" alt="" />
  45. <u-icon name="close" class='del-icon' size='30' @click.stop="handleRemove(item, index)">
  46. </u-icon>
  47. </block>
  48. </view>
  49. <view class="bank-license">
  50. <text>+</text>
  51. </view>
  52. </div> -->
  53. </QiniuUpload>
  54. </u-form-item>
  55. <u-form-item label="备注">
  56. <view class="form-item-in">
  57. <u-input v-model="bank_data.remark" disabled />
  58. </view>
  59. </u-form-item>
  60. </u-form>
  61. </view>
  62. <view class="confirm-btn primary-bg" @click="backConfirm">
  63. <u-loading v-if="loading" mode="circle"></u-loading>
  64. 确定
  65. </view>
  66. </template>
  67. </view>
  68. </template>
  69. <script>
  70. import QiniuUpload from '../components/qiniu/QiniuUpload.vue';
  71. export default {
  72. components: {
  73. QiniuUpload
  74. },
  75. data() {
  76. return {
  77. shenhe: true,//true->审核中 false->已过审
  78. loading: false,
  79. bank_data: {
  80. // 银行信息
  81. id: '',
  82. name: '',
  83. image: [],
  84. bankName: '',
  85. accountNumber: ''
  86. },
  87. payAmount: 0,
  88. orderId: 0,
  89. tmplIds: []
  90. };
  91. },
  92. onLoad(options) {
  93. this.payAmount = options.payAmount || '0.00';
  94. if (Array.isArray(options.orderId)) {
  95. this.orderId = options.orderId;
  96. } else {
  97. this.orderId = [options.orderId];
  98. }
  99. this.getPaymentType();
  100. // 获取订阅消息模版
  101. // #ifdef MP-WEIXIN
  102. this.getSettingDataByMessageId()
  103. // #endif
  104. this.getSh()
  105. },
  106. methods: {
  107. getSh() {
  108. this.$u.api.getBasicField({'field': ["shenhe"]}).then(({data})=> {
  109. // this.shenhe = data/
  110. // console.log(data);
  111. this.shenhe = data.shenhe
  112. })
  113. },
  114. // 复制到剪贴板
  115. copyData(data) {
  116. uni.setClipboardData({
  117. data: data,
  118. success: () => {
  119. this.$u.toast('已复制到剪贴板');
  120. }
  121. });
  122. },
  123. // 上传银行凭证
  124. uploadSuccess(imgData, uploadPicUrl) {
  125. this.bank_data.image.push(uploadPicUrl);
  126. },
  127. // 确定 订阅消息
  128. backConfirm() {
  129. // #ifdef MP-WEIXIN
  130. console.log(this.tmplIds)
  131. if (this.tmplIds.length) {
  132. uni.requestSubscribeMessage({
  133. tmplIds: this.tmplIds,
  134. success: res => {
  135. this.addOrderBankData();
  136. },
  137. fail: res => {
  138. this.addOrderBankData();
  139. }
  140. });
  141. } else {
  142. this.addOrderBankData();
  143. }
  144. // #endif
  145. // #ifdef APP-PLUS
  146. this.addOrderBankData();
  147. // #endif
  148. },
  149. // 确定
  150. addOrderBankData() {
  151. if (this.loading) {
  152. return;
  153. }
  154. if (!this.bank_data.image && !this.bank_data.image.length) {
  155. this.$u.toast('请上传打款凭证');
  156. return;
  157. }
  158. this.loading = true;
  159. this.$u.api
  160. .addOrderBankData({
  161. orderId: this.orderId,
  162. bankData: this.bank_data
  163. })
  164. .then(res => {
  165. this.loading = false;
  166. this.$u.toast('操作成功');
  167. setTimeout(res => {
  168. this.customBack();
  169. }, 1500);
  170. })
  171. .catch(err => {
  172. this.loading = false;
  173. });
  174. },
  175. customBack() {
  176. uni.redirectTo({
  177. url: '/pagesT/order/order?state=0'
  178. });
  179. },
  180. getPaymentType() {
  181. this.$u.api.getPaymentType().then(res => {
  182. const bankType = res.data.find(item => item.id === 4);
  183. if (bankType) {
  184. const accountData = bankType.accountData;
  185. this.bank_data = {
  186. id: accountData.id,
  187. name: accountData.name,
  188. image: [],
  189. bankName: accountData.bankName,
  190. accountNumber: accountData.accountNumber,
  191. bankAccount: accountData.bankAccount,
  192. remark: accountData.remark,
  193. };
  194. }
  195. });
  196. },
  197. // 获取消息模版ID
  198. getSettingDataByMessageId() {
  199. this.$u.api
  200. .getSettingDataByMessageId({
  201. id: [4]
  202. })
  203. .then(res => {
  204. if (res.data.length > 0) {
  205. this.tmplIds = res.data.map(item => {
  206. return item.weixinTemplateId;
  207. });
  208. }
  209. });
  210. },
  211. //移除图片
  212. // handleRemove(url, index) {
  213. // this.bank_data.image.splice(index, 1);
  214. // }
  215. imgRemove(arr) {
  216. this.bank_data.image = arr;
  217. }
  218. }
  219. };
  220. </script>
  221. <style scoped lang="scss">
  222. .bank-view {
  223. background-color: #ffffff;
  224. padding: 0 30rpx;
  225. width: 700rpx;
  226. margin: 0 auto;
  227. border-radius: 16rpx;
  228. .form-item-in {
  229. position: relative;
  230. .copy-text {
  231. position: absolute;
  232. right: 20rpx;
  233. display: block;
  234. top: 50%;
  235. transform: translateY(-50%);
  236. color: #999999;
  237. font-size: 24rpx;
  238. }
  239. }
  240. .bank-license {
  241. width: 124upx;
  242. height: 124upx;
  243. border-radius: 8upx;
  244. border: 2upx #999999 dashed;
  245. margin: 32upx 10rpx;
  246. background: #eee;
  247. text-align: center;
  248. line-height: 100upx;
  249. color: #666;
  250. font-size: 100rpx;
  251. font-weight: 300;
  252. display: inline-block;
  253. vertical-align: middle;
  254. position: relative;
  255. .del-icon {
  256. box-sizing: border-box;
  257. padding-left: 7rpx;
  258. position: absolute;
  259. color: #fff;
  260. right: -12rpx;
  261. top: -20upx;
  262. background-color: #FD463E;
  263. width: 40rpx;
  264. height: 40rpx;
  265. border-radius: 100%;
  266. line-height: 40rpx;
  267. }
  268. }
  269. .license-pic {
  270. width: 120upx;
  271. height: 120upx;
  272. display: block;
  273. }
  274. }
  275. .confirm-btn {
  276. color: #ffffff;
  277. line-height: 90rpx;
  278. text-align: center;
  279. position: fixed;
  280. bottom: 0;
  281. width: 100%;
  282. left: 0;
  283. }
  284. .money-view {
  285. padding: 60rpx 0;
  286. text-align: center;
  287. .num {
  288. font-family: DIN-Medium;
  289. font-weight: bold;
  290. font-size: 64rpx;
  291. .icon {
  292. font-size: 40rpx;
  293. }
  294. }
  295. .label {
  296. color: #6c6c6c;
  297. font-size: 24rpx;
  298. padding-top: 20rpx;
  299. }
  300. }
  301. </style>