Zhanghumingxi.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <template>
  2. <view>
  3. <customNav :shownav="true" :title="$t('zhanghu.zhanghumingxi')" tinColor="#40AE36" jiantou="0" titledetl=''></customNav>
  4. <view class="toptalbar">
  5. <view class="contentInRowS" style="width:100%;">
  6. <view style="width: 33%;" v-for="(item,index) in tableList">
  7. <view :class="index==toptableindex?'tableselect tableLab':'tableLab'" @click="tableselct(item.value,index)">
  8. <text>{{item.text}}</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="contentInRowS" style="width: 100%;margin-top: 22rpx;">
  13. <view v-if="toptableindex==0" style="width: 20%;" v-for="(item,index) in dateList">
  14. <view class="contentColumnC" :class="index==itemSelectIndex?'itemView itemViewSel':'itemView'" @click="itemselctday(item,index)">
  15. <text style="font-size: 28rpx;">{{item.date}}</text>
  16. <text style="font-size: 28rpx;">{{item.week}}</text>
  17. </view>
  18. </view>
  19. <view v-if="toptableindex==1" style="width: 20%;" v-for="(item,index) in dayList">
  20. <view class="contentColumnC" :class="index==itemSelectIndex?'itemView itemViewSel':'itemView'" @click="itemselctweek(item,index)">
  21. <text style="font-size: 28rpx;">{{item.bdate}}</text>
  22. <text style="font-size: 28rpx;">{{item.ndate}}</text>
  23. </view>
  24. </view>
  25. <view v-if="toptableindex==2" style="width: 20%;" v-for="(item,index) in monthList">
  26. <view class="contentColumnC" :class="index==itemSelectIndex?'itemView itemViewSel':'itemView'" @click="itemselctmonth(item,index)">
  27. <text style="font-size: 28rpx;">{{item.month}}</text>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="listContent" :style="'margin-top: '+topheight+'rpx;'">
  33. <view class="contentInRowS" @click="gotomingxi" style="padding: 10rpx;background-color: antiquewhite;height: 50rpx;">
  34. <text>{{$t('zhanghu.shujutj')}}</text>
  35. <text >{{$t('zhanghu.chakanmx')}}>></text>
  36. </view>
  37. <view class="contentColumn">
  38. <text class="notTitle" style="color: chocolate;">{{$t('zhanghu.benqleijsr')}}:</text>
  39. <text class="notshuliang" style="color: chocolate;">{{$formPr(sum)}}{{$t('api.huobidanwei')}}</text>
  40. </view>
  41. <view class="contentColumn" style="margin-top: 20rpx;">
  42. <text class="notTitle" style="color: #006AFF;">{{$t('zhanghu.benqiwcdl')}}:</text>
  43. <text class="notshuliang" style="color: #006AFF;">{{shul}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import api from "@/pages/api/api.js";
  50. import {
  51. getUsbalance
  52. } from '@/pages/api/basic';
  53. export default {
  54. data() {
  55. return {
  56. tableList:[],
  57. toptableindex:0,
  58. itemSelectIndex:4,
  59. topheight:0,
  60. balanceList:'',
  61. dateList:[],
  62. dayList:[],
  63. monthList:[],
  64. riqi:'',
  65. sum:0,
  66. shul:0
  67. }
  68. },
  69. onLoad() {
  70. this.tableList=[
  71. { value: 0, text:this.$t('order.tian')},
  72. { value: 1, text:this.$t('order.xingqi')},
  73. { value: 2, text:this.$t('order.yue')},
  74. ];
  75. this.topheight=160;
  76. this.getDayList();
  77. this.getweekDay();
  78. this.getmonthList();
  79. },
  80. onShow() {
  81. this.toptableindex=0;
  82. this.itemselctday(this.dateList[4],4);
  83. },
  84. methods: {
  85. tableselct(id,index){
  86. this.toptableindex=index;
  87. this.itemSelectIndex=4;
  88. if(index==0){
  89. this.itemselctday(this.dateList[4],4);
  90. }
  91. if(index==1){
  92. this.itemselctweek(this.dayList[4],4);
  93. }
  94. if(index==2){
  95. this.itemselctmonth(this.monthList[4],4);
  96. }
  97. },
  98. itemselctday(item,index){
  99. this.itemSelectIndex = index;
  100. console.log(item)
  101. this.riqi=item.riqi;
  102. api('getzddaylist',{
  103. page:1,
  104. size:10,
  105. riqi:this.riqi
  106. },res=>{
  107. console.log('getzddaylist',res)
  108. if(res.data.code==200){
  109. this.shul=res.data.data.shul;
  110. this.sum=res.data.data.sum;
  111. }
  112. else{
  113. }
  114. },failc=>{
  115. //console.log('getadvertis----',failc)
  116. })
  117. },
  118. itemselctweek(item,index){
  119. this.itemSelectIndex = index;
  120. console.log(item)
  121. this.riqi=item.riqi;
  122. api('getzdmeeklist',{
  123. page:1,
  124. size:10,
  125. riqi:this.riqi
  126. },res=>{
  127. console.log('getzdmeeklist',res)
  128. if(res.data.code==200){
  129. this.shul=res.data.data.shul;
  130. this.sum=res.data.data.sum;
  131. }
  132. else{
  133. }
  134. },failc=>{
  135. //console.log('getadvertis----',failc)
  136. })
  137. },
  138. itemselctmonth(item,index){
  139. this.itemSelectIndex = index;
  140. this.riqi=item.month
  141. console.log(this.riqi)
  142. api('getzdmatlist',{
  143. page:1,
  144. size:10,
  145. riqi:this.riqi
  146. },res=>{
  147. console.log('getzdmatlist',res)
  148. if(res.data.code==200){
  149. this.shul=res.data.data.shul;
  150. this.sum=res.data.data.sum;
  151. }
  152. else{
  153. }
  154. },failc=>{
  155. //console.log('getadvertis----',failc)
  156. })
  157. },
  158. getDayList(){
  159. var weeks=[];
  160. var language = uni.getStorageSync('language');
  161. if(language==='yuenan'){
  162. weeks=['Chủ Nhật','Thứ hai','Thứ ba','Thứ Tư','Thứ năm','Thứ sáu','Thứ bảy'];
  163. }
  164. else if(language==='zh-Hant'){
  165. weeks=['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
  166. }
  167. else{
  168. weeks=['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
  169. }
  170. // 获取当前日期
  171. var today = new Date();
  172. var date = today.getDate() + "-" + (today.getMonth() + 1);
  173. var week = today.getDay();
  174. var year = today.getFullYear();
  175. this.dateList.push({
  176. date:date,
  177. year:year,
  178. week:weeks[week],
  179. riqi:year+'-'+(today.getMonth() + 1)+'-'+today.getDate()
  180. })
  181. // 获取前1天
  182. var yesterday = new Date(today);
  183. yesterday.setDate(today.getDate() - 1);
  184. date = yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  185. week = yesterday.getDay();
  186. year = yesterday.getFullYear();
  187. this.dateList.push({
  188. date:date,
  189. week:weeks[week],
  190. year:year,
  191. riqi:year+'-'+(yesterday.getMonth() + 1)+'-'+yesterday.getDate()
  192. })
  193. // 获取前2天
  194. yesterday = new Date(today);
  195. yesterday.setDate(today.getDate() - 2);
  196. date = yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  197. week = yesterday.getDay();
  198. year = yesterday.getFullYear();
  199. this.dateList.push({
  200. date:date,
  201. week:weeks[week],
  202. year:year,
  203. riqi:year+'-'+(yesterday.getMonth() + 1)+'-'+yesterday.getDate()
  204. })
  205. // 获取前3天
  206. yesterday = new Date(today);
  207. yesterday.setDate(today.getDate() - 3);
  208. date = yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  209. week = yesterday.getDay();
  210. year = yesterday.getFullYear();
  211. this.dateList.push({
  212. date:date,
  213. week:weeks[week],
  214. year:year,
  215. riqi:year+'-'+(yesterday.getMonth() + 1)+'-'+yesterday.getDate()
  216. })
  217. // 获取前2天
  218. yesterday = new Date(today);
  219. yesterday.setDate(today.getDate() - 4);
  220. date = yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  221. week = yesterday.getDay();
  222. year = yesterday.getFullYear();
  223. this.dateList.push({
  224. date:date,
  225. week:weeks[week],
  226. year:year,
  227. riqi:year+'-'+(yesterday.getMonth() + 1)+'-'+yesterday.getDate()
  228. })
  229. this.dateList.reverse();
  230. console.log(this.dateList)
  231. },
  232. getweekDay(index){
  233. // 获取当前日期
  234. var today = new Date();
  235. var week = today.getDay();
  236. var yesterday = new Date(today);
  237. yesterday.setDate(today.getDate() - week);
  238. var bdate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  239. yesterday.setDate(today.getDate() + 6-week);
  240. var ndate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  241. var year = yesterday.getFullYear();
  242. this.dayList.push({
  243. bdate:bdate,
  244. ndate:ndate,
  245. year:year,
  246. riqi:year+'-'+(yesterday.getMonth() + 1)+'-'+yesterday.getDate()
  247. })
  248. var yesterday = new Date(today);
  249. yesterday.setDate(today.getDate() - week-7*1);
  250. var bdate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  251. yesterday.setDate(today.getDate() + 6-week-7*1);
  252. var ndate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  253. year = yesterday.getFullYear();
  254. this.dayList.push({
  255. bdate:bdate,
  256. ndate:ndate,
  257. year:year,
  258. riqi:year+'-'+(yesterday.getMonth() + 1)+'-'+yesterday.getDate()
  259. })
  260. var yesterday = new Date(today);
  261. yesterday.setDate(today.getDate() - week-7*2);
  262. var bdate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  263. yesterday.setDate(today.getDate() + 6-week-7*2);
  264. var ndate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  265. year = yesterday.getFullYear();
  266. this.dayList.push({
  267. bdate:bdate,
  268. ndate:ndate,
  269. year:year,
  270. riqi:year+'-'+(yesterday.getMonth() + 1)+'-'+yesterday.getDate()
  271. })
  272. var yesterday = new Date(today);
  273. yesterday.setDate(today.getDate() - week-7*3);
  274. var bdate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  275. yesterday.setDate(today.getDate() + 6-week-7*3);
  276. var ndate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  277. year = yesterday.getFullYear();
  278. this.dayList.push({
  279. bdate:bdate,
  280. ndate:ndate,
  281. year:year,
  282. riqi:year+'-'+(yesterday.getMonth() + 1)+'-'+yesterday.getDate()
  283. })
  284. var yesterday = new Date(today);
  285. yesterday.setDate(today.getDate() - week-7*4);
  286. var bdate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  287. yesterday.setDate(today.getDate() + 6-week-7*4);
  288. var ndate=yesterday.getDate() + "-" + (yesterday.getMonth() + 1);
  289. year = yesterday.getFullYear();
  290. this.dayList.push({
  291. bdate:bdate,
  292. ndate:ndate,
  293. year:year,
  294. riqi:year+'-'+(yesterday.getMonth() + 1)+'-'+yesterday.getDate()
  295. })
  296. this.dayList.reverse();
  297. console.log(this.dayList)
  298. },
  299. getmonthList(){
  300. this.monthList.push(this.getMonthInfo(-4));
  301. this.monthList.push(this.getMonthInfo(-3));
  302. this.monthList.push(this.getMonthInfo(-2));
  303. this.monthList.push(this.getMonthInfo(-1));
  304. this.monthList.push(this.getMonthInfo(0));
  305. console.log(this.monthList);
  306. },
  307. getMonthInfo(num) {
  308.     //起止日期数组
  309.     var startStop = new Array();
  310.     //当前时间
  311.     var currentDate = new Date();
  312.     var month = currentDate.getMonth() + num;
  313.     if (month < 0) {
  314.         var n = parseInt(-month / 12);
  315.         month += n * 12;
  316.         currentDate.setFullYear(currentDate.getFullYear() - n);
  317.     }
  318.     currentDate = new Date(currentDate.setMonth(month));
  319.     //获得当前月份0-11
  320.     var currentMonth = currentDate.getMonth();
  321.     //获得当前年份4位年
  322.     var currentYear = currentDate.getFullYear();
  323.     //获得上一个月的第一天
  324.     var currentMonthFirstDay = new Date(currentYear, currentMonth, 1);
  325.     //获得上一月的最后一天
  326.     var currentMonthLastDay = new Date(currentYear, currentMonth + 1, 0);
  327. //     startStop.push(getDate(currentMonthFirstDay));
  328. //     startStop.push(getDate(currentMonthLastDay));
  329. var tmoth = (currentMonth+1)<10?'0'+(currentMonth+1):currentMonth+1;
  330. var month={
  331. month:currentYear+'-'+tmoth,
  332. start:this.getDate(currentMonthFirstDay),
  333. end:this.getDate(currentMonthLastDay)
  334. }
  335.     return month;
  336. },
  337. getDate(date) {
  338.     var year = '';
  339.     var month = '';
  340.     var day = '';
  341.     var now = date;
  342.     year = '' + now.getFullYear();
  343.     if (now.getMonth() + 1 < 10) {
  344.         month = '0' + (now.getMonth() + 1);
  345.     } else {
  346.         month = '' + (now.getMonth() + 1);
  347.     }
  348.     if (now.getDate() < 10) {
  349.         day = '0' + now.getDate();
  350.     } else {
  351.         day = '' + now.getDate();
  352.     }
  353.     return year + '-' + month + '-' + day;
  354. },
  355. async getorderList(page,type){
  356. await this.$http.get(`${getUsbalance}`, {
  357. type:type,
  358. sort:false,
  359. page:page,
  360. size:20,
  361. },true)
  362. .then(async r => {
  363. console.log(r);
  364. this.balanceList=r.data.data.list;
  365. uni.stopPullDownRefresh();
  366. })
  367. .catch(err => {
  368. console.log(err)
  369. uni.stopPullDownRefresh();
  370. })
  371. },
  372. gotomingxi(){
  373. uni.navigateTo({
  374. url:'/pages/order/Mingxiqingdan?riqi='+this.riqi+'&type='+this.toptableindex
  375. })
  376. },
  377. /**
  378. * 下拉刷新回调函数
  379. */
  380. onPullDownRefresh() {
  381. },
  382. /**
  383. * 上拉加载回调函数
  384. */
  385. onReachBottom() {
  386. },
  387. },
  388. }
  389. </script>
  390. <style lang="scss">
  391. @import '@/common/common.scss';
  392. page{
  393. background-color: whitesmoke;
  394. }
  395. .toptalbar{
  396. width: 94%;
  397. margin-left: 3%;
  398. display: flex;
  399. flex-direction: column;
  400. justify-content:flex-start;
  401. align-items:center;
  402. background-color:white;
  403. padding-top: 30rpx;
  404. height: 70rpx;
  405. }
  406. .tableLab{
  407. height: 60rpx;
  408. width: 100%;
  409. text-align:center;
  410. font-size: 32rpx;
  411. color: dimgray;
  412. }
  413. .tableselect{
  414. border: solid #006AFF;
  415. border-width: 0px 0px 6rpx 0px;
  416. color: #006AFF;
  417. font-weight: 600;
  418. }
  419. .itemView{
  420. height: 100rpx;
  421. width: 100%;
  422. text-align:center;
  423. font-size: 32rpx;
  424. color: dimgray;
  425. }
  426. .itemViewSel{
  427. border: solid darkgoldenrod;
  428. border-width: 0px 0px 6rpx 0px;
  429. color:darkgoldenrod;
  430. font-weight: 600;
  431. }
  432. .listContent{
  433. width: 94%;
  434. margin-left: 3%;
  435. background-color: white;
  436. }
  437. .ruzhangNote{
  438. padding-left: 10rpx;
  439. overflow:hidden;
  440. text-overflow:ellipsis;
  441. display:-webkit-box;
  442. -webkit-line-clamp:2;
  443. -webkit-box-orient:vertical;
  444. }
  445. .timeText{
  446. color: #1A1A1A;
  447. font-size: 26rpx;
  448. padding-left: 20rpx;
  449. }
  450. .yujidzText{
  451. color: sandybrown;
  452. font-size: 26rpx;
  453. padding-left: 20rpx;
  454. }
  455. .notTitle{
  456. padding-left: 10rpx;
  457. line-height: 70rpx;
  458. font-size: 26rpx;
  459. }
  460. .notshuliang{
  461. margin-left: 60rpx;
  462. line-height: 70rpx;
  463. font-size: 32rpx;
  464. font-weight: 600;
  465. }
  466. </style>