建材商城系统20241014
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

355 lines
8.1 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="running-water">
  3. <navbar :title="title[status]" leftClick @leftClick="leftClick"
  4. bgColor="#DC2828"
  5. color="#fff"
  6. />
  7. <view style="background-color: #DC2828;height: 150rpx;">
  8. </view>
  9. <view class="card-wrapper">
  10. <view class="card">
  11. <view class="card-section">
  12. <view class="amount-title">总积分</view>
  13. <view class="amount-value">¥ {{ info.lj_money }}</view>
  14. <!-- <view class="action-btn" @click="goWithdraw">提现</view> -->
  15. </view>
  16. <view class="card-divider"></view>
  17. <view class="card-section">
  18. <view class="amount-title">累计提现</view>
  19. <view class="amount-value">¥ {{ info.lj_price }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="date-filter">
  24. <text class="filter-title">金额明细</text>
  25. <view class="filter-actions">
  26. <view class="date-select" @click="openCalendar">
  27. <text class="date-text">{{queryParams.year || '全部'}} {{queryParams.month || ''}}</text>
  28. <uv-icon name="calendar" size="32rpx" color="#666"></uv-icon>
  29. </view>
  30. <view v-if="queryParams.year" class="reset-btn" @click="resetFilter">
  31. <uv-icon name="trash" size="28rpx" color="#999"></uv-icon>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="tab-box">
  36. <!-- <view class="tab-box1" v-if="agentFlow.records.length>0 && agentFlow.total>0">
  37. <uv-cell center border :title="item.title" v-for="(item, index) in agentFlow.records" :key="item.id"
  38. :value="x[item.type] + item.money" :label="item.createTime" />
  39. </view> -->
  40. <view class="tab-box1" v-if="agentFlow.records.length>0 && agentFlow.total>0">
  41. <uv-cell center border
  42. :key="item.id"
  43. :title="item.title" v-for="(item, index) in agentFlow.records"
  44. :label="item.createTime">
  45. <template #value>
  46. <view class="info">
  47. <view class="price">
  48. {{ x[item.type] + (item.money) }}
  49. </view>
  50. <view class="uni-color-btn"
  51. @click="requestMerchantTransfer(item)"
  52. v-if="item.type == 2 && item.status == 1"
  53. >
  54. 领取 <text v-if="item.money">{{ item.money }}</text>
  55. </view>
  56. <view class="status"
  57. v-else-if="item.state_dictText">
  58. {{ item.state_dictText }}<text v-if="item.money">到账 {{ item.money }}</text>
  59. </view>
  60. </view>
  61. </template>
  62. </uv-cell>
  63. </view>
  64. <view style="padding: 100rpx 0;" v-else>
  65. <uv-empty mode="history" textSize="28rpx" iconSize="100rpx" />
  66. </view>
  67. </view>
  68. <quick-order-entry
  69. ref="quickOrderEntry"
  70. />
  71. <!-- 日历选择器 -->
  72. <uv-calendars
  73. ref="calendar"
  74. :insert="false"
  75. mode="year-month"
  76. color="#DC2828"
  77. @confirm="calendarConfirm"
  78. ></uv-calendars>
  79. </view>
  80. </template>
  81. <script>
  82. export default {
  83. data() {
  84. return {
  85. queryParams: {
  86. pageNo: 1,
  87. pageSize: 10,
  88. year: '',
  89. month: ''
  90. },
  91. title: ['收入记录', '支出记录'],
  92. agentFlow: {
  93. total: 1,
  94. records: []
  95. },
  96. x: ['+', '-', '-', '+'],
  97. status: 0,
  98. info : {},
  99. }
  100. },
  101. onPullDownRefresh() {
  102. this.getAgentFlow()
  103. },
  104. onReachBottom() {
  105. this.loadMoreData()
  106. },
  107. onLoad(e) {
  108. this.status = e.status || 0;
  109. // 加载数据
  110. this.getAgentFlow();
  111. this.$store.commit('getUserInfo');
  112. this.getTeamInfo();
  113. },
  114. methods: {
  115. // 获取团队信息
  116. getTeamInfo() {
  117. this.$api('getTeamHeader', res => {
  118. if (res.code == 200) {
  119. this.info = res.result;
  120. }
  121. })
  122. },
  123. loadMoreData(){
  124. if(this.queryParams.pageSize < this.total){
  125. this.queryParams.pageSize += 10
  126. this.getAgentFlow()
  127. }
  128. },
  129. leftClick() { //返回钱包
  130. uni.navigateBack(-1)
  131. },
  132. getAgentFlow() { //获取流水记录
  133. let type = this.status;
  134. const params = {
  135. type,
  136. pageNo: this.queryParams.pageNo,
  137. pageSize: this.queryParams.pageSize
  138. };
  139. // 只有当年份有值时才添加年份筛选
  140. if (this.queryParams.year) {
  141. // 提取数字部分
  142. const year = this.queryParams.year.replace('年', '');
  143. params.year = year;
  144. // 如果月份有值,添加月份筛选
  145. if (this.queryParams.month) {
  146. const month = this.queryParams.month.replace('月', '');
  147. params.month = month;
  148. }
  149. }
  150. this.$api('getLogList', params, res => {
  151. if (res.code == 200) {
  152. this.agentFlow = res.result;
  153. }
  154. })
  155. },
  156. goWithdraw() {
  157. // 跳转到提现页面
  158. uni.navigateTo({
  159. url: '/pages_order/mine/withdraw'
  160. });
  161. },
  162. // 日历选择器相关方法
  163. openCalendar() {
  164. this.$refs.calendar.open();
  165. },
  166. calendarConfirm(e) {
  167. // 判断是否有值
  168. if (e.year && e.month) {
  169. this.queryParams.year = e.year + '年';
  170. this.queryParams.month = e.month + '月';
  171. } else {
  172. // 重置为全部
  173. this.queryParams.year = '';
  174. this.queryParams.month = '';
  175. }
  176. // 重置页码
  177. this.queryParams.pageNo = 1;
  178. // 更新数据
  179. this.getAgentFlow();
  180. },
  181. // 重置筛选
  182. resetFilter() {
  183. this.queryParams.year = '';
  184. this.queryParams.month = '';
  185. this.queryParams.pageNo = 1;
  186. this.getAgentFlow();
  187. },
  188. requestMerchantTransfer(item) {
  189. if (!wx.canIUse('requestMerchantTransfer')) {
  190. wx.showModal({
  191. content: '你的微信版本过低,请更新至最新版本。',
  192. showCancel: false,
  193. });
  194. return
  195. }
  196. wx.requestMerchantTransfer({
  197. mchId: '1673516176',//万能墙商户号
  198. appId: wx.getAccountInfoSync().miniProgram.appId,
  199. package: item.packageInfo,
  200. success: (res) => {
  201. // res.err_msg将在页面展示成功后返回应用时返回ok,并不代表提款成功
  202. console.log('success:', res);
  203. this.getAgentFlow()
  204. this.$api('requestMerchantTransfer', {
  205. id : item.id,
  206. })
  207. },
  208. fail: (res) => {
  209. console.log('fail:', res);
  210. this.getAgentFlow()
  211. },
  212. });
  213. },
  214. }
  215. }
  216. </script>
  217. <style lang="scss" scoped>
  218. .running-water {
  219. width: 750rpx;
  220. margin: 0 auto;
  221. min-height: 100vh;
  222. position: relative;
  223. background: #F5F5F5;
  224. .card-wrapper {
  225. position: relative;
  226. padding: 0 30rpx;
  227. margin-top: -90rpx;
  228. z-index: 10;
  229. .card {
  230. display: flex;
  231. background-color: #fff;
  232. border-radius: 20rpx;
  233. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
  234. overflow: hidden;
  235. .card-section {
  236. flex: 1;
  237. display: flex;
  238. flex-direction: column;
  239. align-items: center;
  240. padding: 30rpx 0;
  241. .amount-title {
  242. font-size: 28rpx;
  243. color: #666;
  244. margin-bottom: 16rpx;
  245. }
  246. .amount-value {
  247. font-size: 42rpx;
  248. font-weight: bold;
  249. color: #DC2828;
  250. margin-bottom: 30rpx;
  251. }
  252. .action-btn {
  253. width: 160rpx;
  254. height: 70rpx;
  255. line-height: 70rpx;
  256. text-align: center;
  257. border: 1px solid #DC2828;
  258. color: #DC2828;
  259. font-size: 28rpx;
  260. border-radius: 35rpx;
  261. }
  262. }
  263. .card-divider {
  264. width: 1px;
  265. background-color: #eee;
  266. }
  267. }
  268. }
  269. .date-filter {
  270. display: flex;
  271. align-items: center;
  272. justify-content: space-between;
  273. margin: 0 20rpx;
  274. margin-top: 30rpx;
  275. padding: 30rpx;
  276. background-color: #fff;
  277. border-radius: 10rpx;
  278. .filter-title {
  279. font-size: 28rpx;
  280. color: #333;
  281. font-weight: 500;
  282. }
  283. .filter-actions {
  284. display: flex;
  285. align-items: center;
  286. }
  287. .date-select {
  288. display: flex;
  289. align-items: center;
  290. padding: 12rpx 20rpx;
  291. border: 1px solid #ddd;
  292. border-radius: 8rpx;
  293. .date-text {
  294. margin-right: 10rpx;
  295. font-size: 26rpx;
  296. color: #333;
  297. }
  298. }
  299. .reset-btn {
  300. margin-left: 20rpx;
  301. padding: 12rpx;
  302. }
  303. }
  304. .tab-box {
  305. margin: 20rpx;
  306. background-color: #fff;
  307. border-radius: 20rpx;
  308. overflow: hidden;
  309. }
  310. .uni-color-btn{
  311. background: $uni-color;
  312. color: #fff;
  313. text-align: center;
  314. margin: 0;
  315. border-radius: 10rpx;
  316. padding: 6px;
  317. font-size: 22rpx;
  318. }
  319. }
  320. </style>