extractList.vue 9.0 KB

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