withdraw.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <view :class="[AppTheme]" id="withdraw">
  3. <view class="block">
  4. <view class="zh">提现金额</view>
  5. <view class="money">
  6. <u--input placeholder="请输入提现金额" fontSize="25" color="#000000" prefixIcon="rmb" v-model="money"
  7. border="bottom" prefixIconStyle="font-size: 20px;color: #909399"></u--input>
  8. </view>
  9. </view>
  10. <view class="tx">
  11. <view class="title">提现方式</view>
  12. <view class="uni-list">
  13. <radio-group @change="radioChange">
  14. <label class="uni-list-cell uni-list-cell-pd"
  15. v-if="item.isopen && ((item.value=='weixin' && weixin) || (item.value=='zfb' && zfb)) || (item.value == 'bank' && zfb)"
  16. v-for="(item, index) in items" :key="item.value">
  17. <u-icon :name="item.img" :color="item.color" size="40"></u-icon>
  18. <view>{{ item.name }}</view>
  19. <view>
  20. <radio :value="item.value" :checked="index === current" :color="primary" />
  21. </view>
  22. </label>
  23. </radio-group>
  24. </view>
  25. <view v-if="sitem.value=='zfb'" class="u-demo-block">
  26. <view style="padding-bottom: 30rpx;">支付宝姓名</view>
  27. <u--input placeholder="支付宝姓名" prefixIcon="account" v-model="apply_name"
  28. prefixIconStyle="font-size: 22px;color: #909399"></u--input>
  29. <view style="padding: 30rpx 0rpx;">支付宝账号</view>
  30. <u--input placeholder="支付宝账号" prefixIcon="zhifubao" v-model="apply_account"
  31. prefixIconStyle="font-size: 22px;color: #909399"></u--input>
  32. <view class="bor_solp"></view>
  33. </view>
  34. <view v-if="sitem.value=='bank'" class="u-demo-block">
  35. <view style="padding-bottom: 30rpx;">姓名</view>
  36. <u--input placeholder="姓名" prefixIcon="account" v-model="bank_name"
  37. prefixIconStyle="font-size: 22px;color: #909399"></u--input>
  38. <view style="padding: 30rpx 0rpx;">银行卡号</view>
  39. <u--input placeholder="银行卡号" prefixIcon="zhifubao" v-model="bank_number"
  40. prefixIconStyle="font-size: 22px;color: #909399"></u--input>
  41. <view class="bor_solp"></view>
  42. <view style="padding: 30rpx 0rpx;">所属银行</view>
  43. <u--input placeholder="所属银行" prefixIcon="zhifubao" v-model="branch"
  44. prefixIconStyle="font-size: 22px;color: #909399"></u--input>
  45. <view class="bor_solp"></view>
  46. </view>
  47. </view>
  48. <view class="btn">
  49. <view class="save bg-linear-gradient" @click="doSve">提交</view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import txApi from '@/api/wall/index.js';
  55. export default {
  56. name: 'Withdraw',
  57. data() {
  58. return {
  59. bank_name: '',
  60. bank_number: '',
  61. branch: '',
  62. primary: this.$theme.primary,
  63. settingFile: getApp().globalData.siteinfo,
  64. money: 0,
  65. items: [{
  66. value: 'weixin',
  67. color: '#62b900',
  68. isopen: true,
  69. name: '微信',
  70. img: 'weixin-fill'
  71. },
  72. {
  73. value: 'zfb',
  74. color: 'rgb(85, 170, 255)',
  75. isopen: true,
  76. name: '支付宝',
  77. img: 'zhifubao'
  78. },
  79. {
  80. value: 'bank',
  81. color: 'rgb(85, 170, 255)',
  82. isopen: true,
  83. name: '银行卡',
  84. img: 'rmb-circle'
  85. }
  86. ],
  87. apply_account: '',
  88. apply_name: '',
  89. sitem: {
  90. value: ''
  91. },
  92. zfb: false,
  93. weixin: false,
  94. txtype: 'vip',
  95. current: -1,
  96. systype: ''
  97. };
  98. },
  99. onLoad(options) {
  100. let that = this;
  101. if (options && options.txtype) {
  102. that.txtype = options.txtype
  103. }
  104. // #ifdef APP-PLUS
  105. that.systype = 'app'
  106. // #endif
  107. // #ifdef H5
  108. that.systype = 'h5'
  109. // #endif
  110. // #ifdef MP-WEIXIN
  111. that.systype = 'mpweixin'
  112. // #endif
  113. console.log('this.txtype', this.txtype)
  114. let config = that.$init_config(1, function(res) {
  115. if (res && res.app) {
  116. that.weixin = res.app.cash.wx.isopen;
  117. that.zfb = res.app.cash.ali.isopen;
  118. }
  119. if(res && res.bank) {
  120. that.bank_name = res.bank.bank_name
  121. that.bank_number = res.bank.bank_number
  122. that.branch = res.bank.branch
  123. }
  124. });
  125. },
  126. methods: {
  127. radioChange: function(evt) {
  128. for (let i = 0; i < this.items.length; i++) {
  129. if (this.items[i].value === evt.target.value) {
  130. this.current = i;
  131. this.sitem = this.items[i]
  132. break;
  133. }
  134. }
  135. },
  136. doSve() {
  137. // //订阅模板消息
  138. let that = this
  139. let tmplIdsone = that.$config.temlist;
  140. if (tmplIdsone) {
  141. that.$until.requestSubscribeMessage([tmplIdsone['withdrawalResult']], tmplIdsone, function() {
  142. that.doSve1()
  143. });
  144. } else {
  145. that.doSve1()
  146. }
  147. },
  148. doSve1() {
  149. let that = this;
  150. that.$u.throttle(() => {
  151. if (!that.money) {
  152. that.$api.msg('请填写金额');
  153. return;
  154. } else if (isNaN(that.money)) {
  155. that.$api.msg('请填写正确的提现金额');
  156. return;
  157. }
  158. console.log(that.sitem.value)
  159. if (that.txtype == 'farm') {
  160. let type = 0;
  161. if (that.sitem.value == 'weixin') {
  162. type = 2;
  163. } else if (that.sitem.value == 'zfb') {
  164. type = 1;
  165. } else {
  166. that.$api.msg('请选择提现方式');
  167. return;
  168. }
  169. txApi.tx_farm({
  170. cash_money: that.money,
  171. apply_name: that.apply_name,
  172. apply_account: that.apply_account,
  173. systype: that.systype,
  174. type: type,
  175. }).then(res => {
  176. if (res.status == 1) {
  177. console.log(res, "提现")
  178. this.$api.msg(res.msg);
  179. setTimeout(() => {
  180. uni.navigateTo({
  181. url: `/pagesC/pages/merchantdetails/property?id=` +
  182. this.farm_id
  183. });
  184. }, 2000);
  185. } else {
  186. this.$api.msg(res.msg);
  187. }
  188. });
  189. } else {
  190. if (that.sitem.value == 'weixin') {
  191. txApi.wxTxOrder({
  192. txprice: that.money,
  193. systype: that.systype
  194. }).then(res => {
  195. if (res.status == 200) {
  196. console.log(res, "提现")
  197. that.$api.msg(res.msg);
  198. setTimeout(() => {
  199. uni.redirectTo({
  200. url: '/pagesA/pages/mypurse/index'
  201. });
  202. }, 1000);
  203. } else {
  204. that.$api.msg(res.msg);
  205. }
  206. });
  207. } else if (that.sitem.value == 'zfb') {
  208. txApi.aliTxOrder({
  209. txprice: that.money,
  210. apply_account: that.apply_account,
  211. apply_name: that.apply_name,
  212. systype: that.systype
  213. }).then(res => {
  214. if (res.status == 200) {
  215. console.log(res, "提现")
  216. that.$api.msg(res.msg);
  217. setTimeout(() => {
  218. uni.redirectTo({
  219. url: '/pagesA/pages/mypurse/index'
  220. });
  221. }, 1000);
  222. } else {
  223. that.$api.msg(res.msg);
  224. }
  225. });
  226. } else if (that.sitem.value == 'bank') {
  227. txApi.bankTx({
  228. bank_name: that.bank_name,
  229. bank_number: that.bank_number,
  230. branch: that.branch,
  231. txprice: that.money,
  232. systype: that.systype
  233. }).then(res => {
  234. if (res.status == 200) {
  235. that.$api.msg(res.msg);
  236. setTimeout(() => {
  237. uni.redirectTo({
  238. url: '/pagesA/pages/mypurse/index'
  239. });
  240. }, 1000);
  241. } else {
  242. that.$api.msg(res.msg);
  243. }
  244. })
  245. } else {
  246. that.$api.msg('请选择提现方式');
  247. return;
  248. }
  249. }
  250. });
  251. }
  252. }
  253. };
  254. </script>
  255. <style lang="scss">
  256. page {
  257. background-color: #ffffff;
  258. }
  259. .u-demo-block {
  260. padding: 30rpx;
  261. }
  262. #withdraw {
  263. width: 100%;
  264. background-color: #ffffff;
  265. .block {
  266. overflow: hidden;
  267. .zh {
  268. font-size: 30rpx;
  269. font-family: PingFang SC;
  270. font-weight: bold;
  271. color: #333333;
  272. padding: 30rpx;
  273. }
  274. .money {
  275. display: flex;
  276. font-size: 35rpx;
  277. font-family: PingFang SC;
  278. font-weight: bold;
  279. align-items: center;
  280. padding: 30rpx;
  281. color: #000000;
  282. margin-bottom: 20rpx;
  283. }
  284. }
  285. .tx {
  286. width: 100%;
  287. background-color: #ffffff;
  288. padding-bottom: 35rpx;
  289. .title {
  290. font-size: 30rpx;
  291. font-family: PingFang SC;
  292. font-weight: bold;
  293. color: #333333;
  294. margin: 33rpx 0 33rpx 36rpx;
  295. }
  296. .flex {
  297. display: flex;
  298. }
  299. .uni-list-cell.uni-list-cell-pd {
  300. position: relative;
  301. display: flex;
  302. font-size: 30rpx;
  303. padding-left: 40rpx;
  304. font-family: PingFang SC;
  305. font-weight: 500;
  306. color: #333333;
  307. margin-bottom: 30rpx;
  308. align-items: center;
  309. image {
  310. width: 46rpx;
  311. height: 41rpx;
  312. margin-right: 25rpx;
  313. margin-left: 37rpx;
  314. }
  315. radio {
  316. position: absolute;
  317. top: 0;
  318. right: 20rpx;
  319. }
  320. }
  321. }
  322. .btn {
  323. width: 100%;
  324. height: 210rpx;
  325. display: flex;
  326. justify-content: center;
  327. align-items: center;
  328. background-color: #ffffff;
  329. .save {
  330. margin: 0 auto;
  331. width: 582rpx;
  332. height: 90rpx;
  333. font-size: 32rpx;
  334. font-family: PingFang SC;
  335. font-weight: 800;
  336. color: #ffffff;
  337. text-align: center;
  338. line-height: 90rpx;
  339. color: #ffffff;
  340. border-radius: 45rpx;
  341. }
  342. }
  343. }
  344. </style>