historySpend.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <template>
  2. <view class="box">
  3. <homenav :iStatusBarHeight="iStatusBarHeight" :title="'历史消费'" ></homenav>
  4. <view class="screenBox">
  5. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  6. <view style="height: 44px;"></view>
  7. <picker @change="bindPickerChange" :value="index" :range="array">
  8. <view class="screenName"> <span>车牌号:{{array[index]}}</span>
  9. <image src="../../static/timg/icon_arrow_right.png" mode="" class="jtImg"></image>
  10. </view>
  11. </picker>
  12. </view>
  13. <view style="height: 90rpx;"></view>
  14. <view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item)">
  15. <view class="topBox">
  16. <view class="dan">{{item.code}}</view>
  17. <!-- SheetType单据类型(1维修单 2销售单3洗车单4销售退货) -->
  18. <view class="stateBox" v-if="item.SheetType == 1">
  19. <!-- 0待施工(已保存)1施工中(已派工)2已完工 3已质检 4 已作废 -->
  20. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 0">待施工</view>
  21. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 1">施工中</view>
  22. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 2">已完工</view>
  23. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 3">已质检</view>
  24. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 4">已作废</view>
  25. <!-- 结算状态 -->
  26. <view class="danState" v-if="item.PayState == 0">/未结算</view>
  27. <view class="danState2" v-if="item.PayState == 2">/已结算</view>
  28. </view>
  29. <view class="stateBox" v-if="item.SheetType == 2">
  30. <!-- 0待施工(已保存)1施工中(已派工)2已审核 3已质检 4 已作废 -->
  31. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState < 2 ">未审核</view>
  32. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 2">已审核</view>
  33. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 4">已作废</view>
  34. <!-- 结算状态 -->
  35. <view class="danState" v-if="item.PayState == 0">/未结算</view>
  36. <view class="danState2" v-if="item.PayState == 2">/已结算</view>
  37. </view>
  38. <view class="stateBox" v-if="item.SheetType == 3">
  39. <!-- 0待施工(已保存)1施工中(已派工)2已完工 3已质检 4 已作废 -->
  40. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 0">已保存</view>
  41. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 4">已作废</view>
  42. <!-- 结算状态 -->
  43. <view class="danState" v-if="item.PayState == 0">/未结算</view>
  44. <view class="danState2" v-if="item.PayState == 2">/已结算</view>
  45. </view>
  46. </view>
  47. <view class="carPlate">
  48. <view class="plateBox">
  49. <view class="plate">{{item.PlateNumber}}</view>
  50. <view class="mileage" v-if="item.CurrentMileage>0">{{item.CurrentMileage}}km</view>
  51. </view>
  52. <view v-if="ReceiptsMoney" class="price"><span style="font-size: 22rpx;">¥</span>{{item.money?item.money:0}}</view>
  53. </view>
  54. <view class="time">{{item.time}}</view>
  55. <view class="shopName">{{item.ShopName}}</view>
  56. <!-- <view class="itemN" v-if="item.listItems.length != 0">
  57. <view class="itemContent" v-if="item.listItems.length != 0" v-for="(v,i) in item.listItems">{{v.ItemName}},</view>
  58. </view>
  59. <view class="itemN" v-if="item.listParts.length != 0">
  60. <view class="itemContent" v-if="item.listParts.length != 0" v-for="(v,i) in item.listParts">{{v.GoodsName}},</view>
  61. </view> -->
  62. <view class="itemN" v-if="item.ItemName">
  63. <view class="itemContent" >{{item.ItemName}}</view>
  64. </view>
  65. <view class="itemN" v-if="item.GoodsName">
  66. <view class="itemContent" >{{item.GoodsName}}</view>
  67. </view>
  68. <view v-if="((item.PayState == 2) && (appraise == true) && ((item.lastDay <= 30 && item.EvaluateState == 0) || item.EvaluateState == 1))" class="bottom">
  69. <view v-if="(item.EvaluateState == 0) && (item.lastDay <= 30) && appraise == true && item.PayState == 2" @click.stop="goAppraise(item)" class="ping">评价</view>
  70. <view v-if="item.EvaluateState == 1" @click.stop="goAppraiseDetail(item)" class="kan">查看评价</view>
  71. </view>
  72. </view>
  73. <view class="itemHistory" v-for="(item,index) in oldlist" :key="index" @click="goDetail(item)">
  74. <view class="topBox">
  75. <view class="dan">{{item.code}}</view>
  76. <!-- SheetType单据类型(1维修单 2销售单3洗车单4销售退货) -->
  77. <view class="stateBox" >
  78. <view class="danState2">{{item.CheckoutState?item.CheckoutState:''}}</view>
  79. </view>
  80. </view>
  81. <view class="carPlate">
  82. <view class="plateBox">
  83. <view class="plate">{{item.PlateNumber}}</view>
  84. <view class="mileage" v-if="item.CurrentMileage>0">{{item.CurrentMileage}}km</view>
  85. </view>
  86. <view v-if="ReceiptsMoney" class="price"><span style="font-size: 22rpx;">¥</span>{{item.money?item.money:0}}</view>
  87. </view>
  88. <view class="time">{{item.time}}</view>
  89. <view class="shopName">{{item.ShopName}}</view>
  90. <view class="itemN" v-if="item.ItemName">
  91. <view class="itemContent" >{{item.ItemName}}</view>
  92. </view>
  93. <view class="itemN" v-if="item.GoodsName">
  94. <view class="itemContent" >{{item.GoodsName}}</view>
  95. </view>
  96. </view>
  97. <!-- 上拉 加载更多 -->
  98. <view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
  99. <!-- 无数据空白页 -->
  100. <nodata v-if="itemData.length==0&&oldlist.length==0"></nodata>
  101. </view>
  102. </template>
  103. <script>
  104. import nodata from '../../components/nodata/nodata.vue'
  105. import homenav from "../../components/homenav/nav.vue"
  106. export default {
  107. components: {
  108. nodata,homenav
  109. },
  110. data() {
  111. return {
  112. page: 1,
  113. itemData: [],
  114. oldlist:[],
  115. noMoreShow: false,
  116. appraise:false,
  117. ReceiptsMoney:false,//支付金额
  118. iStatusBarHeight:'',
  119. array: [],
  120. index: 0,
  121. wxOpenData: '',
  122. plateNumber:'',
  123. }
  124. },
  125. onLoad() {
  126. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  127. this.page = 1
  128. this.myOrderCoupon()
  129. this.myPower()
  130. this.showPower()
  131. this.getplateNumber()
  132. },
  133. methods: {
  134. bindPickerChange: function(e) {
  135. console.log('picker发送选择改变,携带值为', e.detail)
  136. this.index = e.detail.value
  137. this.plateNumber=this.array[this.index]
  138. if(this.index==0){
  139. this.plateNumber=''
  140. }
  141. this.myOrderCoupon()
  142. },
  143. getplateNumber(){
  144. console.log("444")
  145. this.wxOpenData= this.$store.state.wxOpenData;
  146. this.$http('openweiXinCardInfoController/plateNumber-by-customerId', {
  147. customerId:this.wxOpenData.loginInfo.uid
  148. }, 'GET').then(res => {
  149. this.array=res.data.split(',')
  150. this.array.unshift('全部')
  151. })
  152. },
  153. //显示权限
  154. showPower() {
  155. this.$http('openweiXinCardInfoController/getShowSetting', {
  156. }, 'GET').then(res => {
  157. var list = res.data
  158. list.forEach((item, index) => {
  159. if (item.fieldValue == 'ReceiptsMoney') {
  160. this.ReceiptsMoney = item.isChecked
  161. }
  162. })
  163. })
  164. },
  165. //评价权限
  166. myPower() {
  167. this.$http('openMiniEvaluate/getEvaluateSetting', {
  168. }, 'GET').then(res => {
  169. // var list = res.data.Items
  170. this.appraise = res.data
  171. })
  172. },
  173. goAppraiseDetail(item) {
  174. uni.navigateTo({
  175. url: 'myAppraiseDetail?sheetId=' + item.id
  176. })
  177. },
  178. goAppraise(item){
  179. uni.navigateTo({
  180. url: 'appraise?sheetID=' + item.id + '&shopID=' + item.shopID
  181. })
  182. },
  183. goDetail(item) {
  184. /* uni.navigateTo({
  185. url: 'historyDetail?id=' + item.id + '&lastDay=' + item.lastDay
  186. }) */
  187. uni.navigateTo({
  188. url: '../subPack/oldhistoryDetail?id=' + item.id + '&lastDay=' + item.lastDay
  189. })
  190. },
  191. myOrderCoupon() {
  192. let that = this
  193. uni.showLoading({
  194. title: '加载中'
  195. })
  196. /* this.$http('openweiXinCardInfoController/queryConsumptionList', {
  197. plateNumber:this.plateNumber
  198. // page: this.page,
  199. // limit: 10,
  200. }, 'POST').then(res => {
  201. uni.hideLoading();
  202. // var list = res.data.Items
  203. var list = res.data
  204. if (this.page == 1) {
  205. this.itemData = list
  206. } else {
  207. this.itemData = this.itemData.concat(list)
  208. }
  209. if (list.length < 10) {
  210. this.noMoreShow = true
  211. } else {
  212. this.noMoreShow = false
  213. }
  214. }) */
  215. this.$http('openweiXinCardInfoController/queryConsumptionListV2', {
  216. plateNumber:this.plateNumber
  217. // page: this.page,
  218. // limit: 10,
  219. }, 'POST').then(res => {
  220. uni.hideLoading();
  221. var list = res.data.list
  222. this.oldlist=res.data.oldlist
  223. this.itemData = list
  224. if (list.length < 10) {
  225. this.noMoreShow = true
  226. } else {
  227. this.noMoreShow = false
  228. }
  229. })
  230. },
  231. //时间对比
  232. getDateBeforeNow(stringTime) {
  233. console.log("传参未格式化", stringTime);
  234. stringTime = new Date(stringTime.replace(/-/g, '/'))
  235. // 统一单位换算
  236. var minute = 1000 * 60;
  237. var hour = minute * 60;
  238. var day = hour * 24;
  239. var week = day * 7;
  240. var month = day * 30;
  241. var year = month * 12;
  242. var time1 = new Date().getTime(); //当前的时间戳
  243. console.log("当前时间", time1);
  244. // 对时间进行毫秒单位转换
  245. var time2 = new Date(stringTime).getTime(); //指定时间的时间戳
  246. console.log("传过来的时间", time2);
  247. var time = time1 - time2;
  248. console.log("计算后的时间", time);
  249. var result = null;
  250. // if (time < 0) {
  251. // // alert("传过来的时间的时间不能晚于当前时间!");
  252. // result = stringTime;
  253. // } else if (time / year >= 1) {
  254. // result = parseInt(time / year) + "年前";
  255. // } else if (time / month >= 1) {
  256. // result = parseInt(time / month) + "月前";
  257. // } else if (time / week >= 1) {
  258. // result = parseInt(time / week) + "周前";
  259. // } else if (time / day >= 1) {
  260. // result = parseInt(time / day) + "天前";
  261. // } else if (time / hour >= 1) {
  262. // result = parseInt(time / hour) + "小时前";
  263. // } else if (time / minute >= 1) {
  264. // result = parseInt(time / minute) + "分钟前";
  265. // } else {
  266. // result = "刚刚";
  267. // }
  268. if (time < 0) {
  269. // alert("传过来的时间的时间不能晚于当前时间!");
  270. result = -1;
  271. } else if (time / day >= 0) {
  272. result = parseInt(time / day);//多少天前
  273. }
  274. console.log("多少天前", result);
  275. return result;
  276. },
  277. },
  278. // 下拉刷新
  279. onPullDownRefresh() {
  280. this.page = 1
  281. this.myOrderCoupon()
  282. setTimeout(function() {
  283. uni.stopPullDownRefresh();
  284. }, 1000);
  285. },
  286. // 上拉加载更多
  287. onReachBottom() {
  288. // this.page++;
  289. this.myOrderCoupon()
  290. },
  291. }
  292. </script>
  293. <style>
  294. .box {
  295. min-height: 100vh;
  296. background-color: #F4F5F7;
  297. padding-top: 20rpx;
  298. }
  299. .jtImg{
  300. width: 12rpx;height: 20rpx;
  301. margin-top: 10rpx;
  302. }
  303. .screenBox{
  304. background: #FFFFFF;
  305. margin-bottom: 20rpx;
  306. position: fixed;
  307. width: 100vw;
  308. top: 0;left: 0;
  309. }
  310. .screenName{
  311. padding: 24rpx;font-size: 28rpx;
  312. display: flex;
  313. justify-content: space-between;
  314. }
  315. .itemHistory {
  316. margin: 0rpx 24rpx 20rpx;
  317. padding: 20rpx;
  318. background-color: #FFFFFF;
  319. border-radius: 10rpx;
  320. }
  321. .topBox{
  322. display: flex;
  323. justify-content: space-between;
  324. align-items: center;
  325. }
  326. .dan {
  327. font-size: 24rpx;
  328. color: #999999;
  329. }
  330. .stateBox{
  331. display: flex;
  332. }
  333. .danState{
  334. font-size: 24rpx;
  335. color: #FF4F00;
  336. }
  337. .danState2{
  338. font-size: 24rpx;
  339. color: #999999;
  340. }
  341. .time {
  342. font-size: 24rpx;
  343. color: #999999;
  344. }
  345. .carPlate {
  346. margin: 20rpx 0rpx 15rpx;
  347. display: flex;
  348. align-items: center;
  349. justify-content: space-between;
  350. }
  351. .plateBox {
  352. display: flex;
  353. }
  354. .plate {
  355. font-size: 30rpx;
  356. color: #3C3C3C;
  357. font-weight: bold;
  358. margin-right: 20rpx;
  359. }
  360. .mileage {
  361. font-size: 24rpx;
  362. color: #F19D01;
  363. padding: 0rpx 10rpx;
  364. border: 1px solid #F19D01;
  365. border-radius: 4rpx;
  366. height: 33rpx;
  367. }
  368. .price{
  369. font-size: 32rpx;
  370. font-weight: 500;
  371. color: #FF0000;
  372. }
  373. .itemN {
  374. margin-top: 15rpx;
  375. display: flex;
  376. /* 隐藏文字显示 ...不换行 */
  377. overflow: hidden;
  378. text-overflow: ellipsis;
  379. white-space: nowrap;
  380. }
  381. .shopName{
  382. color: #666666;
  383. font-size: 24rpx;
  384. margin-top: 15rpx;
  385. /* 隐藏文字显示 ...不换行 */
  386. overflow: hidden;
  387. text-overflow: ellipsis;
  388. white-space: nowrap;
  389. }
  390. .itemContent {
  391. color: #666666;
  392. font-size: 24rpx;
  393. }
  394. .bottom{
  395. padding-top: 20rpx;
  396. border-top: 1rpx solid #EEEEEE;
  397. margin-top: 20rpx;
  398. display: flex;
  399. justify-content: flex-end;
  400. font-size: 28rpx;
  401. margin-left: -24rpx;
  402. margin-right: -24rpx;
  403. }
  404. .ping{
  405. text-align: center;
  406. color: #FF4F00;
  407. width: 150rpx;
  408. height: 56rpx;
  409. line-height: 56rpx;
  410. border-radius: 36rpx;
  411. border: 2rpx solid #FF4F00;
  412. margin-right: 24rpx;
  413. }
  414. .kan{
  415. text-align: center;
  416. color: #3C3C3C;
  417. width: 150rpx;
  418. height: 56rpx;
  419. line-height: 56rpx;
  420. border-radius: 36rpx;
  421. border: 2rpx solid #DDDDDD;
  422. margin-right: 24rpx;
  423. }
  424. .noMore {
  425. text-align: center;
  426. line-height: 50rpx;
  427. color: #999999;
  428. font-size: 28rpx;
  429. }
  430. </style>