historySpend.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  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,danState3:item.PayState == 0}" v-if="item.SheetState == 0">待施工</view>
  21. <view class="danState" :class="{danState2:item.PayState == 2,danState3:item.PayState == 0}" v-if="item.SheetState == 1">施工中</view>
  22. <view class="danState" :class="{danState2:item.PayState == 2,danState3:item.PayState == 0}" v-if="item.SheetState == 2">已完工</view>
  23. <view class="danState" :class="{danState2:item.PayState == 2,danState3:item.PayState == 0}" v-if="item.SheetState == 3">已质检</view>
  24. <view class="danState" v-if="item.SheetState == 4">已作废</view>
  25. <!-- 结算状态 -->
  26. <view v-if="item.SheetState == 4">
  27. <view class="danState" v-if="item.PayState == 0">/未结算</view>
  28. <view class="danState" v-if="item.PayState == 2">/已结算</view>
  29. </view>
  30. <view v-else>
  31. <view class="danState3" v-if="item.PayState == 0">/未结算</view>
  32. <view class="danState2" v-if="item.PayState == 2">/已结算</view>
  33. </view>
  34. </view>
  35. <view class="stateBox" v-if="item.SheetType == 2">
  36. <!-- 0待施工(已保存)1施工中(已派工)2已审核 3已质检 4 已作废 -->
  37. <view class="danState" :class="{danState3:item.PayState == 2}" v-if="item.SheetState < 2 ">未审核</view>
  38. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 2">已审核</view>
  39. <view class="danState" v-if="item.SheetState == 4">已作废</view>
  40. <!-- 结算状态 -->
  41. <view v-if="item.SheetState == 4">
  42. <view class="danState" v-if="item.PayState == 0">/未结算</view>
  43. <view class="danState" v-if="item.PayState == 2">/已结算</view>
  44. </view>
  45. <view v-else>
  46. <view class="danState3" v-if="item.PayState == 0">/未结算</view>
  47. <view class="danState2" v-if="item.PayState == 2">/已结算</view>
  48. </view>
  49. </view>
  50. <view class="stateBox" v-if="item.SheetType == 3">
  51. <!-- 0待施工(已保存)1施工中(已派工)2已完工 3已质检 4 已作废 -->
  52. <view class="danState" :class="{danState2:item.PayState == 2}" v-if="item.SheetState == 0">已保存</view>
  53. <view class="danState" v-if="item.SheetState == 4">已作废</view>
  54. <!-- 结算状态 -->
  55. <view v-if="item.SheetState == 4">
  56. <view class="danState" v-if="item.PayState == 0">/未结算</view>
  57. <view class="danState" v-if="item.PayState == 2">/已结算</view>
  58. </view>
  59. <view v-else>
  60. <view class="danState" v-if="item.PayState == 0">/未结算</view>
  61. <view class="danState2" v-if="item.PayState == 2">/已结算</view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="carPlate">
  66. <view class="plateBox">
  67. <view class="plate">{{item.PlateNumber}}</view>
  68. <view class="mileage" v-if="item.CurrentMileage>0">{{item.CurrentMileage}}km</view>
  69. </view>
  70. <view v-if="ReceiptsMoney" class="price"><span style="font-size: 22rpx;">¥</span>{{item.money?item.money:0}}</view>
  71. </view>
  72. <view class="time">{{item.time}}</view>
  73. <view class="shopName">{{item.ShopName}}</view>
  74. <!-- <view class="itemN" v-if="item.listItems.length != 0">
  75. <view class="itemContent" v-if="item.listItems.length != 0" v-for="(v,i) in item.listItems">{{v.ItemName}},</view>
  76. </view>
  77. <view class="itemN" v-if="item.listParts.length != 0">
  78. <view class="itemContent" v-if="item.listParts.length != 0" v-for="(v,i) in item.listParts">{{v.GoodsName}},</view>
  79. </view> -->
  80. <view class="itemN" v-if="item.ItemName">
  81. <view class="itemContent" >{{item.ItemName}}</view>
  82. </view>
  83. <view class="itemN" v-if="item.GoodsName">
  84. <view class="itemContent" >{{item.GoodsName}}</view>
  85. </view>
  86. <view v-if="((item.PayState == 2) && (appraise == true) && ((item.lastDay <= 30 && item.EvaluateState == 0) || item.EvaluateState == 1))" class="bottom">
  87. <view v-if="(item.EvaluateState == 0) && (item.lastDay <= 30) && appraise == true && item.PayState == 2" @click.stop="goAppraise(item)" class="ping">评价</view>
  88. <view v-if="item.EvaluateState == 1" @click.stop="goAppraiseDetail(item)" class="kan">查看评价</view>
  89. </view>
  90. </view>
  91. <view class="itemHistory" v-for="(item,index) in oldlist" :key="index" @click="goDetail2(item)">
  92. <view class="topBox">
  93. <view class="dan">{{item.Code}}</view>
  94. <!-- SheetType单据类型(1维修单 2销售单3洗车单4销售退货) -->
  95. <view class="stateBox" >
  96. <view class="danState2">{{item.CheckoutState?item.CheckoutState:''}}</view>
  97. </view>
  98. </view>
  99. <view class="carPlate">
  100. <view class="plateBox">
  101. <view class="plate">{{item.PlateNumber}}</view>
  102. <view class="mileage" v-if="item.CurrentMileage>0">{{item.CurrentMileage}}km</view>
  103. </view>
  104. <view v-if="ReceiptsMoney&&item.CheckoutMoney" class="price"><span style="font-size: 22rpx;">¥</span>{{item.CheckoutMoney}}</view>
  105. </view>
  106. <view class="time">{{item.time}}</view>
  107. <view class="shopName">{{item.ShopName}}</view>
  108. <view class="itemN" v-if="item.ItemName">
  109. <view class="itemContent" >{{item.ItemName}}</view>
  110. </view>
  111. <view class="itemN" v-if="item.GoodsName">
  112. <view class="itemContent" >{{item.GoodsName}}</view>
  113. </view>
  114. </view>
  115. <!-- 上拉 加载更多 -->
  116. <view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
  117. <!-- 无数据空白页 -->
  118. <nodata v-if="itemData.length==0&&oldlist.length==0"></nodata>
  119. <!-- 手机号授权 -->
  120. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  121. <view class="authorizCont" @click.stop="">
  122. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  123. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  124. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  125. </view>
  126. <view style="text-align: center;padding-top: 56rpx;">
  127. <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  128. </view>
  129. </view>
  130. </view>
  131. </template>
  132. <script>
  133. import nodata from '../../components/nodata/nodata.vue'
  134. import homenav from "../../components/homenav/nav.vue"
  135. export default {
  136. components: {
  137. nodata,homenav
  138. },
  139. data() {
  140. return {
  141. page: 1,
  142. itemData: [],
  143. oldlist:[],
  144. noMoreShow: false,
  145. appraise:false,
  146. ReceiptsMoney:false,//支付金额
  147. iStatusBarHeight:'',
  148. array: [],
  149. index: 0,
  150. wxOpenData: '',
  151. plateNumber:'',
  152. ext:'',
  153. authorizShow:false,
  154. userInfo: '',
  155. code:'',
  156. }
  157. },
  158. onLoad() {
  159. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  160. this.page = 1
  161. this.userInfo=this.$store.state.userInfo;
  162. this.ext=this.$common.getExtStoreId();
  163. if(this.userInfo){
  164. this.myOrderCoupon()
  165. this.myPower()
  166. this.showPower()
  167. this.getplateNumber()
  168. }else{
  169. this.$common.automaticlogin().then(val => {
  170. this.userInfo=this.$store.state.userInfo;
  171. this.wxOpenData=this.$store.state.wxOpenData;
  172. if(!this.userInfo){
  173. this.authorizShow=true
  174. }else{
  175. this.myOrderCoupon()
  176. this.myPower()
  177. this.showPower()
  178. this.getplateNumber()
  179. }
  180. })
  181. }
  182. },
  183. methods: {
  184. decryptPhoneNumber: function(e) {
  185. console.log(e);
  186. this.code=e.detail.code
  187. this.wxPhoneLogin()
  188. this.authorizShow=false;
  189. },
  190. wxPhoneLogin(){
  191. var that=this;
  192. this.$http('miniApp2/sys/wxPhoneLogin', {
  193. appId:this.ext.appId,
  194. unionId:this.ext.unionId,
  195. code:this.code,
  196. openId:this.wxOpenData.openid
  197. },'POST').then(res => {
  198. var data = res.data;
  199. if(data.loginInfo){
  200. this.userInfo=data.loginInfo.openUser;
  201. this.wxOpenData=data.loginInfo;
  202. this.$store.commit('mutationswxOpenData', data)
  203. this.$store.commit('mutationsuserInfo', this.userInfo)
  204. this.myOrderCoupon()
  205. this.myPower()
  206. this.showPower()
  207. this.getplateNumber()
  208. }
  209. })
  210. },
  211. bindPickerChange: function(e) {
  212. console.log('picker发送选择改变,携带值为', e.detail)
  213. this.index = e.detail.value
  214. this.plateNumber=this.array[this.index]
  215. if(this.index==0){
  216. this.plateNumber=''
  217. }
  218. this.myOrderCoupon()
  219. },
  220. getplateNumber(){
  221. console.log("444")
  222. this.wxOpenData= this.$store.state.wxOpenData;
  223. this.$http('openweiXinCardInfoController/plateNumber-by-customerId', {
  224. customerId:this.wxOpenData.loginInfo.uid
  225. }, 'GET').then(res => {
  226. this.array=res.data.split(',')
  227. this.array.unshift('全部')
  228. })
  229. },
  230. //显示权限
  231. showPower() {
  232. this.$http('openweiXinCardInfoController/getShowSetting', {
  233. }, 'GET').then(res => {
  234. var list = res.data
  235. list.forEach((item, index) => {
  236. if (item.fieldValue == 'ReceiptsMoney') {
  237. this.ReceiptsMoney = item.isChecked
  238. }
  239. })
  240. })
  241. },
  242. //评价权限
  243. myPower() {
  244. this.$http('openMiniEvaluate/getEvaluateSetting', {
  245. }, 'GET').then(res => {
  246. // var list = res.data.Items
  247. this.appraise = res.data
  248. })
  249. },
  250. goAppraiseDetail(item) {
  251. uni.navigateTo({
  252. url: 'myAppraiseDetail?sheetId=' + item.id
  253. })
  254. },
  255. goAppraise(item){
  256. uni.navigateTo({
  257. url: 'appraise?sheetID=' + item.id + '&shopID=' + item.shopID
  258. })
  259. },
  260. goDetail(item) {
  261. uni.navigateTo({
  262. url: 'historyDetail?id=' + item.id + '&lastDay=' + item.lastDay
  263. })
  264. },
  265. goDetail2(item){
  266. uni.navigateTo({
  267. url: '../subPack/oldhistoryDetail?id=' + item.id + '&lastDay=' + item.lastDay
  268. })
  269. },
  270. myOrderCoupon() {
  271. let that = this
  272. uni.showLoading({
  273. title: '加载中'
  274. })
  275. /* this.$http('openweiXinCardInfoController/queryConsumptionList', {
  276. plateNumber:this.plateNumber
  277. // page: this.page,
  278. // limit: 10,
  279. }, 'POST').then(res => {
  280. uni.hideLoading();
  281. // var list = res.data.Items
  282. var list = res.data
  283. if (this.page == 1) {
  284. this.itemData = list
  285. } else {
  286. this.itemData = this.itemData.concat(list)
  287. }
  288. if (list.length < 10) {
  289. this.noMoreShow = true
  290. } else {
  291. this.noMoreShow = false
  292. }
  293. }) */
  294. this.$http('openweiXinCardInfoController/queryConsumptionListV2', {
  295. plateNumber:this.plateNumber
  296. // page: this.page,
  297. // limit: 10,
  298. }, 'POST').then(res => {
  299. uni.hideLoading();
  300. var list = res.data.list
  301. this.oldlist=res.data.oldlist
  302. this.itemData = list
  303. if (list.length < 10) {
  304. this.noMoreShow = true
  305. } else {
  306. this.noMoreShow = false
  307. }
  308. })
  309. },
  310. //时间对比
  311. getDateBeforeNow(stringTime) {
  312. console.log("传参未格式化", stringTime);
  313. stringTime = new Date(stringTime.replace(/-/g, '/'))
  314. // 统一单位换算
  315. var minute = 1000 * 60;
  316. var hour = minute * 60;
  317. var day = hour * 24;
  318. var week = day * 7;
  319. var month = day * 30;
  320. var year = month * 12;
  321. var time1 = new Date().getTime(); //当前的时间戳
  322. console.log("当前时间", time1);
  323. // 对时间进行毫秒单位转换
  324. var time2 = new Date(stringTime).getTime(); //指定时间的时间戳
  325. console.log("传过来的时间", time2);
  326. var time = time1 - time2;
  327. console.log("计算后的时间", time);
  328. var result = null;
  329. // if (time < 0) {
  330. // // alert("传过来的时间的时间不能晚于当前时间!");
  331. // result = stringTime;
  332. // } else if (time / year >= 1) {
  333. // result = parseInt(time / year) + "年前";
  334. // } else if (time / month >= 1) {
  335. // result = parseInt(time / month) + "月前";
  336. // } else if (time / week >= 1) {
  337. // result = parseInt(time / week) + "周前";
  338. // } else if (time / day >= 1) {
  339. // result = parseInt(time / day) + "天前";
  340. // } else if (time / hour >= 1) {
  341. // result = parseInt(time / hour) + "小时前";
  342. // } else if (time / minute >= 1) {
  343. // result = parseInt(time / minute) + "分钟前";
  344. // } else {
  345. // result = "刚刚";
  346. // }
  347. if (time < 0) {
  348. // alert("传过来的时间的时间不能晚于当前时间!");
  349. result = -1;
  350. } else if (time / day >= 0) {
  351. result = parseInt(time / day);//多少天前
  352. }
  353. console.log("多少天前", result);
  354. return result;
  355. },
  356. },
  357. // 下拉刷新
  358. onPullDownRefresh() {
  359. this.page = 1
  360. this.myOrderCoupon()
  361. setTimeout(function() {
  362. uni.stopPullDownRefresh();
  363. }, 1000);
  364. },
  365. // 上拉加载更多
  366. onReachBottom() {
  367. // this.page++;
  368. this.myOrderCoupon()
  369. },
  370. }
  371. </script>
  372. <style scoped>
  373. .box {
  374. min-height: 100vh;
  375. background-color: #F4F5F7;
  376. padding-top: 20rpx;
  377. }
  378. .jtImg{
  379. width: 12rpx;height: 20rpx;
  380. margin-top: 10rpx;
  381. }
  382. .screenBox{
  383. background: #FFFFFF;
  384. margin-bottom: 20rpx;
  385. position: fixed;
  386. width: 100vw;
  387. top: 0;left: 0;
  388. }
  389. .screenName{
  390. padding: 24rpx;font-size: 28rpx;
  391. display: flex;
  392. justify-content: space-between;
  393. }
  394. .itemHistory {
  395. margin: 0rpx 24rpx 20rpx;
  396. padding: 20rpx;
  397. background-color: #FFFFFF;
  398. border-radius: 10rpx;
  399. }
  400. .topBox{
  401. display: flex;
  402. justify-content: space-between;
  403. align-items: center;
  404. }
  405. .dan {
  406. font-size: 24rpx;
  407. color: #999999;
  408. }
  409. .stateBox{
  410. display: flex;
  411. }
  412. .danState{
  413. font-size: 24rpx;
  414. color: #999999;
  415. }
  416. .danState2{
  417. font-size: 24rpx;
  418. color: #00A040;
  419. }
  420. .danState3{
  421. font-size: 24rpx;
  422. color: #FF4F00;
  423. }
  424. .time {
  425. font-size: 24rpx;
  426. color: #999999;
  427. }
  428. .carPlate {
  429. margin: 20rpx 0rpx 15rpx;
  430. display: flex;
  431. align-items: center;
  432. justify-content: space-between;
  433. }
  434. .plateBox {
  435. display: flex;
  436. }
  437. .plate {
  438. font-size: 30rpx;
  439. color: #3C3C3C;
  440. font-weight: bold;
  441. margin-right: 20rpx;
  442. }
  443. .mileage {
  444. font-size: 24rpx;
  445. color: #F19D01;
  446. padding: 0rpx 10rpx;
  447. border: 1px solid #F19D01;
  448. border-radius: 4rpx;
  449. height: 33rpx;
  450. }
  451. .price{
  452. font-size: 32rpx;
  453. font-weight: 500;
  454. color: #FF0000;
  455. }
  456. .itemN {
  457. margin-top: 15rpx;
  458. display: flex;
  459. /* 隐藏文字显示 ...不换行 */
  460. overflow: hidden;
  461. text-overflow: ellipsis;
  462. white-space: nowrap;
  463. }
  464. .shopName{
  465. color: #666666;
  466. font-size: 24rpx;
  467. margin-top: 15rpx;
  468. /* 隐藏文字显示 ...不换行 */
  469. overflow: hidden;
  470. text-overflow: ellipsis;
  471. white-space: nowrap;
  472. }
  473. .itemContent {
  474. color: #666666;
  475. font-size: 24rpx;
  476. }
  477. .bottom{
  478. padding-top: 20rpx;
  479. border-top: 1rpx solid #EEEEEE;
  480. margin-top: 20rpx;
  481. display: flex;
  482. justify-content: flex-end;
  483. font-size: 28rpx;
  484. margin-left: -24rpx;
  485. margin-right: -24rpx;
  486. }
  487. .ping{
  488. text-align: center;
  489. color: #666666;
  490. width: 150rpx;
  491. height: 56rpx;
  492. line-height: 56rpx;
  493. border-radius: 36rpx;
  494. border: 2rpx solid #DDDDDD;
  495. margin-right: 24rpx;
  496. }
  497. .kan{
  498. text-align: center;
  499. color: #666666;
  500. width: 150rpx;
  501. height: 56rpx;
  502. line-height: 56rpx;
  503. border-radius: 36rpx;
  504. border: 2rpx solid #DDDDDD;
  505. margin-right: 24rpx;
  506. }
  507. .noMore {
  508. text-align: center;
  509. line-height: 50rpx;
  510. color: #999999;
  511. font-size: 28rpx;
  512. }
  513. .authorizBox{
  514. width: 100vw;
  515. height: 100vh;
  516. background: rgba(0, 0, 0, 0.5);
  517. position: fixed;
  518. top: 0;
  519. left: 0;
  520. }
  521. .authorizCont{
  522. margin-top: 30vh;
  523. width: 564rpx;
  524. height: 408rpx;
  525. background: #FFFFFF;
  526. border-radius: 24rpx;
  527. margin-left: 93rpx;
  528. position: relative;
  529. }
  530. .authorizCloseImg{
  531. width: 62rpx;
  532. height: 62rpx;
  533. }
  534. .sqLogoBox{
  535. width: 180rpx;
  536. height: 180rpx;
  537. background: #FFFFFF;
  538. border-radius: 90rpx;
  539. text-align: center;
  540. position: absolute;
  541. top: -50rpx;
  542. left: 192rpx;
  543. }
  544. .authorizName{
  545. color: #333333;
  546. line-height: 42rpx;
  547. font-size: 30rpx;
  548. text-align: center;
  549. padding-top: 58rpx;
  550. }
  551. .authorizMs{
  552. color: #999999;
  553. line-height: 36rpx;
  554. font-size: 26rpx;
  555. width: 452rpx;
  556. padding-top: 24rpx;
  557. text-align: center;
  558. margin-left: 56rpx;
  559. }
  560. .authorizContbutton{
  561. width: 422rpx;
  562. height: 88rpx;
  563. background: #D53533;
  564. border-radius: 44rpx;
  565. line-height: 88rpx;
  566. text-align: center;
  567. font-size:30rpx;
  568. color: #FFFFFF;
  569. margin-top: 62rpx;
  570. margin-left:71rpx;
  571. }
  572. </style>