Zhanghumingxi.vue 13 KB

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