index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view class="page">
  3. </view>
  4. </template>
  5. <script>
  6. export default {
  7. data() {
  8. return {
  9. showDataLoading: false,
  10. serviceTimeShow: false,
  11. show: false,
  12. mode: 'single',
  13. currentTab: 'tab1', // 当前选中的 Tab
  14. currentServiceTab: 'orderTab1', // 当前选中的 Tab
  15. searchTime: '2023-8-9',
  16. reqParm: {
  17. auth: true,
  18. pageSize: 20,
  19. pageNum: 1,
  20. dataTime: null,
  21. },
  22. value1: '',
  23. tranRecordsList: [],
  24. tranFlowstatistic: {}
  25. };
  26. },
  27. onLoad() {
  28. // 查询交易列表
  29. this.transactionRecordsList();
  30. this.value1 = Date.now();
  31. // 查询交流流水统计
  32. this.transactionFlowstatistic();
  33. },
  34. methods: {
  35. // 确定选择的服务日期
  36. sureChooseDate(){
  37. this.serviceTimeShow = false;
  38. // this.reqParm.startTime = uni.$u.timeFormat(this.value1, 'yyyy-mm-dd hh:MM:ss');
  39. this.reqParm.dataTime = uni.$u.timeFormat(this.value1, 'yyyy-mm');
  40. },
  41. // 交易列表
  42. transactionRecordsList(){
  43. let that = this;
  44. that.showDataLoading = true;
  45. this.$api.transactionRecordsList({data:this.reqParm}).then((res)=>{
  46. that.tranRecordsList = res.data.rows;
  47. that.showDataLoading = false;
  48. }).catch(() =>{
  49. uni.showToast({
  50. title: "操作失败"
  51. })
  52. });
  53. },
  54. // 查询交易流水统计
  55. transactionFlowstatistic(){
  56. let that = this;
  57. that.showDataLoading = true;
  58. this.$api.transactionFlowstatistic({data:this.reqParm}).then((res)=>{
  59. that.tranFlowstatistic = res.data.data;
  60. that.showDataLoading = false;
  61. }).catch(() =>{
  62. uni.showToast({
  63. title: "操作失败"
  64. })
  65. });
  66. },
  67. // 服务订单
  68. changeServiceTab(tab){
  69. // 交易号类型(订单号、退款单号):1 消费 2 充值 3退款
  70. if(tab == 'orderTab1'){
  71. delete this.reqParm.tradeNoType;
  72. } else if(tab == 'orderTab2'){
  73. this.reqParm.tradeNoType = '2';
  74. } else if(tab == 'orderTab3'){
  75. this.reqParm.tradeNoType = '1';
  76. } else if(tab == 'orderTab4'){
  77. this.reqParm.tradeNoType = '3';
  78. }
  79. // 处理查询参数
  80. if(!this.reqParm.dataTime){
  81. let time = this.reqParm.dataTime;
  82. this.reqParm.beginTime = time+'-01 00:00:00';
  83. this.reqParm.endTime = this.maxDate(this.reqParm.beginTime);
  84. }
  85. this.transactionFlowstatistic();
  86. this.transactionRecordsList();
  87. this.currentServiceTab = tab;
  88. },
  89. // 详情
  90. orderDetail(item){
  91. uni.$u.route({
  92. url: '/pages/transaction/transaction-detail',
  93. params: {
  94. data: JSON.stringify(item)
  95. }
  96. })
  97. },
  98. showDate(){
  99. // this.show = true;
  100. this.serviceTimeShow = true;
  101. },
  102. confirm(e) {
  103. this.searchTime = e[0];
  104. this.show = false;
  105. },
  106. close() {
  107. this.show = false;
  108. },
  109. maxDate(selectedMonth) {
  110. if (!this.$isDataEmpty(selectedMonth)) {
  111. // 将选定的月份转换为Date对象
  112. let selected = new Date(selectedMonth);
  113. // 获取下个月的第一天
  114. let nextMonth = new Date(selected.getFullYear(), selected.getMonth() + 1, 1);
  115. // 获取本月的最后一天
  116. let lastDay = new Date(nextMonth - 1);
  117. // 返回最大日期
  118. return lastDay.toISOString().slice(0, 10);
  119. } else {
  120. // 如果没有选定月份,则返回当前月份的最大日期
  121. let today = new Date();
  122. let nextMonth = new Date(today.getFullYear(), today.getMonth() + 1, 1);
  123. let lastDay = new Date(nextMonth - 1);
  124. return lastDay.toISOString().slice(0, 10);
  125. }
  126. }
  127. },
  128. };
  129. </script>
  130. <style lang="scss" scoped>
  131. /* 服务订单内容*/
  132. .service-order-tab-bar{
  133. background: #fff;
  134. display: flex;
  135. justify-content: space-around;
  136. height: 50px;
  137. background-color: #f5f5f5;
  138. .service-order-tab-item{
  139. flex: 1;
  140. display: flex;
  141. align-items: center;
  142. justify-content: center;
  143. font-size: 16px;
  144. color: #333;
  145. line-height: 26px;
  146. }
  147. .service-order-tab-item.active {
  148. color: #ff0000;
  149. }
  150. .underline {
  151. border-bottom: 2px solid #ff0000;
  152. }
  153. }
  154. .h-search{
  155. font-size: 14px;
  156. display: flex;
  157. padding-left: 12px;
  158. padding-top: 12px;
  159. padding-right: 12px;
  160. .h-time{
  161. width: 30%;
  162. display: flex;
  163. color: #333333;
  164. .time{
  165. padding-right: 2px;
  166. }
  167. }
  168. .h-name{
  169. width: 70%;
  170. text-align: right;
  171. display: flex;
  172. justify-content: flex-end;
  173. color: #999999;
  174. .name{
  175. padding-right: 6px;
  176. }
  177. }
  178. }
  179. .service-order{
  180. background: #fff;
  181. margin-top: 12px;
  182. padding-top: 12px;
  183. }
  184. /* 门店列表 */
  185. .store-wrap{
  186. border-radius: 2px;
  187. .row-list{
  188. padding-bottom: 12px;
  189. padding-left: 12px;
  190. padding-right: 12px;
  191. .store-content{
  192. display: flex;
  193. padding-bottom: 12px;
  194. font-size: 14px;
  195. font-family: PingFangSC-Regular, PingFang SC;
  196. font-weight: 400;
  197. .store-img{
  198. width: 60px;
  199. .title-name{
  200. width: 42px;
  201. height: 42px;
  202. color: #fff;
  203. border-radius: 25px;
  204. display: flex;
  205. justify-content: center;
  206. align-items: center;
  207. }
  208. .orange{
  209. background: #93D21A;
  210. }
  211. .skyblue{
  212. background: #ED569F;
  213. }
  214. .pink{
  215. background: #FFAF36;
  216. }
  217. }
  218. .content{
  219. width: 100%;
  220. padding-left: 8px;
  221. padding-top: 2px;
  222. .title-price{
  223. display: flex;
  224. .title{
  225. width: 60%;
  226. font-family: "黑体", sans-serif;
  227. }
  228. .price{
  229. text-align: right;
  230. width: 40%;
  231. color: #333333;
  232. font-weight: 600;
  233. }
  234. }
  235. .desc{
  236. display: flex;
  237. font-size: 12px;
  238. .time{
  239. color: #999999;
  240. width: 60%;
  241. }
  242. .balance{
  243. text-align: right;
  244. width: 40%;
  245. color: #999999;
  246. }
  247. }
  248. }
  249. }
  250. }
  251. }
  252. /* 产品订单 */
  253. .product-order{
  254. margin-top: 12px;
  255. }
  256. /* 底部 */
  257. .footer{
  258. margin-top: 30px;
  259. height: 120px;
  260. font-size: 12px;
  261. text-align: center;
  262. color: #666;
  263. }
  264. </style>