建材商城系统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.

356 lines
8.2 KiB

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