extractList.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <view class="box">
  3. <view style="height: 20rpx;"></view>
  4. <view class="line" v-for="(item,index) in list">
  5. <view class="linetop" v-if="type!=2">
  6. <view class="nickNameBox">
  7. <view class="amount" >¥{{item.money}}</view>
  8. </view>
  9. </view>
  10. <view class="lineCOnt" v-if="type!=2">
  11. <view class="lineline">
  12. <view class="lineContLeft">
  13. <view class="lineContLeftMs">申请时间:{{item.applyTime}}</view>
  14. </view>
  15. <view class="lineTIme" >{{jkstateMap[~~item.applyState]}}</view>
  16. <view class="lineTIme">{{stateMap[~~item.auditState]}}</view>
  17. </view>
  18. </view>
  19. <view class="linetop" v-if="type==2">
  20. <view class="name">提现金额:{{item.applyMoney}}</view>
  21. <view class="lineTIme" :style="[
  22. item.applyState === 2 && { color: 'rgb(7, 183, 91)' },
  23. item.applyState === 0 && { color: 'rgb(255, 102, 0)' },
  24. item.applyState === 1 && { color: 'red' }
  25. ]"
  26. >{{jkstateMap[~~item.applyState]}}</view>
  27. </view>
  28. <view class="lineCOnt" v-if="type==2">
  29. <view class="lineline">
  30. <view class="lineContLeft">
  31. <view class="lineContLeftMs">申请时间:{{item.applyTime}}</view>
  32. </view>
  33. <view class="lineTIme jkButton" @click="getMoney(item)" v-if="item.applyState == 2 && item.cashState == 0 && item.cashType == 0">去提现</view>
  34. <view class="lineTIme jkButton" v-if="item.applyState == 2 && item.cashState == 1 && item.cashType == 0">提现中</view>
  35. <view class="lineTIme jkButton" v-if="item.applyState == 2 && item.cashState == 2 && item.cashType == 0">提现失败</view>
  36. <view class="lineTIme jkButton" v-if="item.applyState == 2 && item.cashState == 3 && item.cashType == 0">已提现</view>
  37. <view class="lineTIme jkButton" v-if="item.applyState == 2 && item.cashType == 1">线下打款</view>
  38. </view>
  39. </view>
  40. </view>
  41. <nodata v-if="list.length==0"></nodata>
  42. </view>
  43. </template>
  44. <script>
  45. import { requestTransfer } from '@/utils/transfer';
  46. import nodata from '../../components/nodata/nodata.vue'
  47. export default {
  48. components: {
  49. nodata
  50. },
  51. data() {
  52. return {
  53. list:'',
  54. themeColor:'',
  55. userInfo:'',
  56. type:0,
  57. stateMap: ['待审核', '审核通过', '审核拒绝'],
  58. jkstateMap: ['未审核', '审核拒绝', '审核通过'],
  59. outBatchNo:'',
  60. packageInfo:'',
  61. state:'',
  62. mchId:'',
  63. appId:'',
  64. timer:'',
  65. jkcashid:'',
  66. cashState:2,
  67. showGet:1,
  68. money:0,
  69. intervalId: null
  70. }
  71. },
  72. onLoad(opt) {
  73. this.themeColor = uni.getStorageSync("themeColor");
  74. this.userInfo = uni.getStorageSync("userInfo");
  75. this.type = opt.type;
  76. if(this.type==2){
  77. this.getListByJkCashout()
  78. }else{
  79. this.getList()
  80. }
  81. },
  82. onShow() {
  83. },
  84. methods: {
  85. goRouter(url){
  86. uni.navigateTo({
  87. url:url
  88. })
  89. },
  90. getList(){
  91. uni.showLoading({
  92. title: '加载中'
  93. })
  94. this.$http('openMCustomer/getWithdrawalDetail', {
  95. }, 'GET').then(res => {
  96. uni.hideLoading();
  97. this.list = res.data;
  98. })
  99. },
  100. //推广
  101. getListByJkCashout(){
  102. uni.showLoading({
  103. title: '加载中'
  104. })
  105. this.$http('jkCashout/getJkCashoutDetail', {
  106. }, 'GET').then(res => {
  107. uni.hideLoading();
  108. this.list = res.data;
  109. })
  110. },
  111. //提现
  112. getMoney(jk){
  113. uni.showLoading({
  114. title: '加载中'
  115. })
  116. if(jk.cashState == 0){
  117. this.money = jk.applyMoney
  118. this.$http('jkCashout/jkCashout', {
  119. jkcashid:jk.id
  120. }, 'POST').then(res => {
  121. uni.hideLoading();
  122. if(res.code == 0){
  123. this.outBatchNo = res.data.outBatchNo
  124. this.packageInfo = res.data.packageInfo
  125. this.state = res.data.state
  126. this.mchId = res.data.mchId
  127. this.appId = res.data.appId
  128. this.jkcashid = jk.id
  129. uni.showLoading({
  130. title: '请稍候...'
  131. })
  132. this.stopInterval()
  133. this.intervalId = setInterval(() => {
  134. this.checkJkCashoutState()
  135. }, 2000)
  136. }else{
  137. uni.showLoading({
  138. title: res.msg
  139. })
  140. }
  141. })
  142. }else{
  143. uni.hideLoading();
  144. }
  145. },
  146. stopInterval() {
  147. if (this.intervalId) {
  148. clearInterval(this.intervalId);
  149. this.intervalId = null;
  150. }
  151. },
  152. //查询状态
  153. checkJkCashoutState(){
  154. this.$http('jkCashout/checkJkCashoutState', {
  155. outBatchNo:this.outBatchNo,
  156. jkcashid:this.jkcashid
  157. }, 'POST').then(res => {
  158. console.log(res);
  159. if(res.code == 0 && res.data.state =='WAIT_USER_CONFIRM'){
  160. uni.hideLoading();
  161. this.stopInterval();
  162. this.getWechatMoney();
  163. }
  164. if(res.code == 0 && res.data.state =='SUCCESS'){
  165. //成功页面
  166. console.log("领取成功-跳转成功页面");
  167. this.goRouter('../subPack/extractSuccess?money='+this.money);
  168. }
  169. if(res.code == 0 && res.data.state =='FAIL'){
  170. //失败页面
  171. console.log("领取失败-跳转失败页面");
  172. this.goRouter('../subPack/extractFail?money='+this.money)
  173. }
  174. })
  175. },
  176. getWechatMoney(){
  177. if (wx.canIUse('requestMerchantTransfer')) {
  178. wx.requestMerchantTransfer({
  179. mchId: this.mchId,
  180. appId: this.appId,
  181. package: this.packageInfo,
  182. success: (res) => {
  183. // res.err_msg将在页面展示成功后返回应用时返回ok,并不代表付款成功
  184. console.log(res);
  185. if (res.errMsg === 'requestMerchantTransfer:ok') {
  186. // res.err_msg将在页面展示成功后返回应用时返回success,并不代表付款成功
  187. this.checkJkCashoutState();
  188. }
  189. },
  190. fail: (res) => {
  191. }
  192. });
  193. }
  194. }
  195. },
  196. onReachBottom(){
  197. //this.page++;
  198. if(this.type==2){
  199. this.getListByJkCashout()
  200. }else{
  201. this.getList()
  202. }
  203. //console.log("shanglas")
  204. },
  205. onPullDownRefresh(){
  206. //this.page=1;
  207. //this.list=[];
  208. if(this.type==2){
  209. this.getListByJkCashout()
  210. }else{
  211. this.getList()
  212. }
  213. //this.getList();
  214. setTimeout(() => {
  215. uni.stopPullDownRefresh(); // 关闭下拉刷新
  216. }, 2000);
  217. }
  218. }
  219. </script>
  220. <style scoped lang="less">
  221. .box {
  222. width: 100vw;
  223. min-height: 100vh;
  224. background: #F4F5F7;
  225. }
  226. .nickNameBox{
  227. display: flex;
  228. }
  229. .nickName{
  230. font-weight: 400;
  231. color: #999999;
  232. font-size: 24rpx;
  233. line-height: 30rpx;
  234. padding-left: 10rpx;
  235. }
  236. .lineContLeftImg{
  237. width: 30rpx;
  238. height: 30rpx;
  239. margin-right: 10rpx;
  240. }
  241. .line{
  242. width: 702rpx;
  243. background: #FFFFFF;
  244. border-radius: 10rpx;
  245. margin-bottom: 20rpx;
  246. margin-left: 24rpx;
  247. }
  248. .linetop{
  249. display: flex;
  250. justify-content: space-between;
  251. font-size: 30rpx;
  252. padding: 20rpx;
  253. padding-bottom: 0;
  254. }
  255. .lineline{
  256. display: flex;
  257. justify-content: space-between;
  258. padding: 20rpx;
  259. font-weight: 400;
  260. color: #999999;
  261. font-size: 24rpx;
  262. line-height: 30rpx;
  263. }
  264. .lineContLeft{
  265. display: flex;
  266. }
  267. .lineTIme{
  268. font-size: 28rpx;
  269. }
  270. .name{
  271. font-weight: 500;
  272. color: #3C3C3C;
  273. }
  274. .amount{
  275. color: #EC0F0A;
  276. }
  277. .nickNameImg{
  278. width: 30rpx;
  279. height: 30rpx;
  280. }
  281. .jkButton{
  282. color: #ffffff;
  283. font-size: 28rpx;
  284. border: 1rpx solid rgb( 7,183, 91);
  285. background-color: rgb( 7,183, 91);
  286. width: 120rpx;
  287. height: 40rpx;
  288. text-align: center;
  289. line-height: 40rpx;
  290. border-radius: 50rpx;
  291. }
  292. </style>