recordList.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <mescroll-body ref="mescrollRef" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback">
  5. <view class="logs-item" v-for="(item,index) in dataList" :key="index">
  6. <view class="left">
  7. <text class="title">
  8. 提现金额:
  9. <text class="origin">{{item.amount}}</text>
  10. </text>
  11. <view class="time">{{item.createTime}}</view>
  12. </view>
  13. <view class="right">
  14. <text :class="item.status==1?'money green':item.status==4||item.status==5?'money orange':'money red'">{{item.status==1?'已领取':item.status==4||item.status==5?'领取中':'领取失败'}}</text>
  15. <text v-if="item.status==4||item.status==5" class="remark" @click="confirmReceipt(item)">点击确认收款</text>
  16. </view>
  17. </view>
  18. </mescroll-body>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {getDictByKey} from '@/api/common.js'
  24. import {getUserIntegralLogsList,getRedPacketLogList} from '@/api/integral.js'
  25. import {getUserInfo,exchangDetail} from '@/api/user'
  26. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  27. export default {
  28. mixins: [MescrollMixin], // 使用mixin
  29. data() {
  30. return {
  31. typeOptions:[],
  32. mescroll:null,
  33. downOption: {
  34. auto:false//不要自动加载
  35. },
  36. upOption: {
  37. onScroll:false,
  38. use: true, // 是否启用上拉加载; 默认true
  39. page: {
  40. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  41. size: 20 // 每页数据的数量,默认10
  42. },
  43. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  44. textNoMore:"已经到底了",
  45. empty: {
  46. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  47. tip: '暂无数据'
  48. }
  49. },
  50. wxMerchantTransfer:null,
  51. dataList: [],
  52. }
  53. },
  54. onLoad() {
  55. //this.getDictByKey("sys_integral_log_type");
  56. this.user = this.$getUserInfo();
  57. this.wxMerchantTransfer = uni.requireNativePlugin('wxMerchantTransfer');
  58. //this.getWalletList(this.user.userId);
  59. },
  60. onShow() {
  61. this.mescroll.resetUpScroll()
  62. },
  63. methods: {
  64. getDictByKey(key){
  65. var data={key:key}
  66. getDictByKey(data).then(
  67. res => {
  68. if(res.code==200){
  69. this.typeOptions=res.data;
  70. }
  71. },
  72. err => {
  73. }
  74. );
  75. },
  76. getUserInfo(){
  77. let that=this;
  78. getUserInfo().then(res => {
  79. if(res.code==200){
  80. if(res.user!=null){
  81. uni.setStorageSync('userInfo',JSON.stringify(res.user));
  82. this.user=res.user;
  83. }
  84. else{
  85. uni.showToast({
  86. icon:'none',
  87. title: res.msg,
  88. });
  89. }
  90. }
  91. },
  92. rej => {}
  93. );
  94. },
  95. mescrollInit(mescroll) {
  96. this.mescroll = mescroll;
  97. },
  98. /*下拉刷新的回调 */
  99. downCallback(mescroll) {
  100. mescroll.resetUpScroll()
  101. },
  102. upCallback(page) {
  103. //联网加载数据
  104. var that = this;
  105. var data = {
  106. pageNum: page.num,
  107. pageSize: page.size
  108. };
  109. uni.showLoading({
  110. title:"加载中..."
  111. })
  112. getRedPacketLogList(data).then(res => {
  113. uni.hideLoading()
  114. if(res.code==200){
  115. //设置列表数据
  116. if (page.num == 1) {
  117. that.dataList = res.rows;
  118. } else {
  119. that.dataList = that.dataList.concat(res.rows);
  120. }
  121. that.mescroll.endBySize(res.rows.length, res.total);
  122. }else{
  123. uni.showToast({
  124. icon:'none',
  125. title: "请求失败",
  126. });
  127. that.dataList = null;
  128. that.mescroll.endErr();
  129. }
  130. });
  131. },
  132. // 确认收款(拉起微信收款确认页面)
  133. confirmReceipt(item) {
  134. if (!item) {
  135. uni.showToast({
  136. title: '订单信息不完整',
  137. icon: 'none'
  138. });
  139. return;
  140. }
  141. const appId = item.appId;
  142. const mchId = item.mchId;
  143. const packageValue = item.packageInfo;
  144. if (!appId || !mchId || !packageValue) {
  145. uni.showToast({
  146. title: '缺少必要参数,无法确认收款',
  147. icon: 'none'
  148. });
  149. return;
  150. }
  151. // #ifdef APP-PLUS
  152. const params = {
  153. appId: String(appId),
  154. mchId: String(mchId),
  155. package: String(packageValue)
  156. };
  157. console.log('拉起微信收款确认页面,参数:', params);
  158. this.wxMerchantTransfer.open(params, (res) => {
  159. console.log('确认收款回调结果:', res);
  160. if (res.code === 0) {
  161. // 确认收款成功,重新查询订单状态
  162. if (item.outBatchNo) {
  163. setTimeout(() => {
  164. uni.navigateTo({
  165. url: '/pages/user/wallet/success?orderCode=' + item.outBatchNo
  166. });
  167. }, 1000);
  168. }
  169. } else if (res.code === -3) {
  170. const resultMessage = (res.message || '').toLowerCase();
  171. if (resultMessage.includes('not installed') || resultMessage.includes('未安装')) {
  172. uni.showModal({
  173. title: '提示',
  174. content: '请先安装微信客户端',
  175. showCancel: false
  176. });
  177. } else {
  178. uni.showModal({
  179. title: '提示',
  180. content: res.message || '当前微信版本不支持,请升级后重试',
  181. showCancel: false
  182. });
  183. }
  184. } else {
  185. uni.showModal({
  186. title: '确认收款失败',
  187. content: res.message || '请稍后重试',
  188. showCancel: false
  189. });
  190. }
  191. });
  192. // #endif
  193. // #ifndef APP-PLUS
  194. uni.showToast({
  195. icon: 'none',
  196. title: '此功能仅在 APP 中可用',
  197. });
  198. // #endif
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. .page{
  205. background-color: #fff;
  206. }
  207. .origin{
  208. color: #FF5C03;
  209. font-weight: 600;
  210. }
  211. .content{
  212. .logs-item{
  213. width: 100%;
  214. background-color: #fff;
  215. padding:24rpx;
  216. display: flex;
  217. align-items: flex-start;
  218. justify-content: space-between;
  219. border-top: 1rpx solid #efefef;
  220. .left{
  221. display: flex;
  222. flex-direction: column;
  223. align-items: flex-start;
  224. justify-content: flex-start;
  225. .title{
  226. font-size: 28rpx;
  227. color: #111;
  228. }
  229. .time{
  230. margin-top: 20rpx;
  231. font-size: 24rpx;
  232. color: #a5a5a5;
  233. }
  234. }
  235. .right{
  236. display: flex;
  237. flex-direction: column;
  238. align-items: flex-end;
  239. justify-content: flex-end;
  240. .money{
  241. font-size: 28rpx;
  242. font-weight: bold;
  243. color: #111;
  244. }
  245. .green{
  246. color: green;
  247. }
  248. .red{
  249. color:#ff0000;
  250. }
  251. .orange{
  252. color:#FF5C03;
  253. }
  254. .remark{
  255. margin-top: 20rpx;
  256. font-size: 24rpx;
  257. color: #a5a5a5;
  258. .green{
  259. color: green;
  260. }
  261. .red{
  262. color: red;
  263. }
  264. }
  265. }
  266. }
  267. }
  268. </style>