historySpend.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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. var arr=res.data.split(',')
  228. this.array=this.array.concat(arr)
  229. //this.array.unshift('全部')
  230. })
  231. },
  232. //显示权限
  233. showPower() {
  234. this.$http('openweiXinCardInfoController/getShowSetting', {
  235. }, 'GET').then(res => {
  236. var list = res.data
  237. list.forEach((item, index) => {
  238. if (item.fieldValue == 'ReceiptsMoney') {
  239. this.ReceiptsMoney = item.isChecked
  240. }
  241. })
  242. })
  243. },
  244. //评价权限
  245. myPower() {
  246. this.$http('openMiniEvaluate/getEvaluateSetting', {
  247. }, 'GET').then(res => {
  248. // var list = res.data.Items
  249. this.appraise = res.data
  250. })
  251. },
  252. goAppraiseDetail(item) {
  253. uni.navigateTo({
  254. url: 'myAppraiseDetail?sheetId=' + item.id
  255. })
  256. },
  257. goAppraise(item){
  258. uni.navigateTo({
  259. url: 'appraise?sheetID=' + item.id + '&shopID=' + item.shopID
  260. })
  261. },
  262. goDetail(item) {
  263. uni.navigateTo({
  264. url: 'historyDetail?id=' + item.id + '&lastDay=' + item.lastDay
  265. })
  266. },
  267. goDetail2(item){
  268. uni.navigateTo({
  269. url: '../subPack/oldhistoryDetail?id=' + item.id + '&lastDay=' + item.lastDay
  270. })
  271. },
  272. myOrderCoupon() {
  273. let that = this
  274. uni.showLoading({
  275. title: '加载中'
  276. })
  277. /* this.$http('openweiXinCardInfoController/queryConsumptionList', {
  278. plateNumber:this.plateNumber
  279. // page: this.page,
  280. // limit: 10,
  281. }, 'POST').then(res => {
  282. uni.hideLoading();
  283. // var list = res.data.Items
  284. var list = res.data
  285. if (this.page == 1) {
  286. this.itemData = list
  287. } else {
  288. this.itemData = this.itemData.concat(list)
  289. }
  290. if (list.length < 10) {
  291. this.noMoreShow = true
  292. } else {
  293. this.noMoreShow = false
  294. }
  295. }) */
  296. this.$http('openweiXinCardInfoController/queryConsumptionListV2', {
  297. plateNumber:this.plateNumber
  298. // page: this.page,
  299. // limit: 10,
  300. }, 'POST').then(res => {
  301. uni.hideLoading();
  302. var list = res.data.list
  303. this.oldlist=res.data.oldlist
  304. this.itemData = list
  305. if (list.length < 10) {
  306. this.noMoreShow = true
  307. } else {
  308. this.noMoreShow = false
  309. }
  310. })
  311. },
  312. //时间对比
  313. getDateBeforeNow(stringTime) {
  314. console.log("传参未格式化", stringTime);
  315. stringTime = new Date(stringTime.replace(/-/g, '/'))
  316. // 统一单位换算
  317. var minute = 1000 * 60;
  318. var hour = minute * 60;
  319. var day = hour * 24;
  320. var week = day * 7;
  321. var month = day * 30;
  322. var year = month * 12;
  323. var time1 = new Date().getTime(); //当前的时间戳
  324. console.log("当前时间", time1);
  325. // 对时间进行毫秒单位转换
  326. var time2 = new Date(stringTime).getTime(); //指定时间的时间戳
  327. console.log("传过来的时间", time2);
  328. var time = time1 - time2;
  329. console.log("计算后的时间", time);
  330. var result = null;
  331. // if (time < 0) {
  332. // // alert("传过来的时间的时间不能晚于当前时间!");
  333. // result = stringTime;
  334. // } else if (time / year >= 1) {
  335. // result = parseInt(time / year) + "年前";
  336. // } else if (time / month >= 1) {
  337. // result = parseInt(time / month) + "月前";
  338. // } else if (time / week >= 1) {
  339. // result = parseInt(time / week) + "周前";
  340. // } else if (time / day >= 1) {
  341. // result = parseInt(time / day) + "天前";
  342. // } else if (time / hour >= 1) {
  343. // result = parseInt(time / hour) + "小时前";
  344. // } else if (time / minute >= 1) {
  345. // result = parseInt(time / minute) + "分钟前";
  346. // } else {
  347. // result = "刚刚";
  348. // }
  349. if (time < 0) {
  350. // alert("传过来的时间的时间不能晚于当前时间!");
  351. result = -1;
  352. } else if (time / day >= 0) {
  353. result = parseInt(time / day);//多少天前
  354. }
  355. console.log("多少天前", result);
  356. return result;
  357. },
  358. },
  359. // 下拉刷新
  360. onPullDownRefresh() {
  361. this.page = 1
  362. this.myOrderCoupon()
  363. setTimeout(function() {
  364. uni.stopPullDownRefresh();
  365. }, 1000);
  366. },
  367. // 上拉加载更多
  368. onReachBottom() {
  369. // this.page++;
  370. this.myOrderCoupon()
  371. },
  372. }
  373. </script>
  374. <style scoped>
  375. .box {
  376. min-height: 100vh;
  377. background-color: #F4F5F7;
  378. padding-top: 20rpx;
  379. }
  380. .jtImg{
  381. width: 12rpx;height: 20rpx;
  382. margin-top: 10rpx;
  383. }
  384. .screenBox{
  385. background: #FFFFFF;
  386. margin-bottom: 20rpx;
  387. position: fixed;
  388. width: 100vw;
  389. top: 0;left: 0;
  390. }
  391. .screenName{
  392. padding: 24rpx;font-size: 28rpx;
  393. display: flex;
  394. justify-content: space-between;
  395. }
  396. .itemHistory {
  397. margin: 0rpx 24rpx 20rpx;
  398. padding: 20rpx;
  399. background-color: #FFFFFF;
  400. border-radius: 10rpx;
  401. }
  402. .topBox{
  403. display: flex;
  404. justify-content: space-between;
  405. align-items: center;
  406. }
  407. .dan {
  408. font-size: 24rpx;
  409. color: #999999;
  410. }
  411. .stateBox{
  412. display: flex;
  413. }
  414. .danState{
  415. font-size: 24rpx;
  416. color: #999999;
  417. }
  418. .danState2{
  419. font-size: 24rpx;
  420. color: #00A040;
  421. }
  422. .danState3{
  423. font-size: 24rpx;
  424. color: #FF4F00;
  425. }
  426. .time {
  427. font-size: 24rpx;
  428. color: #999999;
  429. }
  430. .carPlate {
  431. margin: 20rpx 0rpx 15rpx;
  432. display: flex;
  433. align-items: center;
  434. justify-content: space-between;
  435. }
  436. .plateBox {
  437. display: flex;
  438. }
  439. .plate {
  440. font-size: 30rpx;
  441. color: #3C3C3C;
  442. font-weight: bold;
  443. margin-right: 20rpx;
  444. }
  445. .mileage {
  446. font-size: 24rpx;
  447. color: #F19D01;
  448. padding: 0rpx 10rpx;
  449. border: 1px solid #F19D01;
  450. border-radius: 4rpx;
  451. height: 33rpx;
  452. }
  453. .price{
  454. font-size: 32rpx;
  455. font-weight: 500;
  456. color: #FF0000;
  457. }
  458. .itemN {
  459. margin-top: 15rpx;
  460. display: flex;
  461. /* 隐藏文字显示 ...不换行 */
  462. overflow: hidden;
  463. text-overflow: ellipsis;
  464. white-space: nowrap;
  465. }
  466. .shopName{
  467. color: #666666;
  468. font-size: 24rpx;
  469. margin-top: 15rpx;
  470. /* 隐藏文字显示 ...不换行 */
  471. overflow: hidden;
  472. text-overflow: ellipsis;
  473. white-space: nowrap;
  474. }
  475. .itemContent {
  476. color: #666666;
  477. font-size: 24rpx;
  478. }
  479. .bottom{
  480. padding-top: 20rpx;
  481. border-top: 1rpx solid #EEEEEE;
  482. margin-top: 20rpx;
  483. display: flex;
  484. justify-content: flex-end;
  485. font-size: 28rpx;
  486. margin-left: -24rpx;
  487. margin-right: -24rpx;
  488. }
  489. .ping{
  490. text-align: center;
  491. color: #666666;
  492. width: 150rpx;
  493. height: 56rpx;
  494. line-height: 56rpx;
  495. border-radius: 36rpx;
  496. border: 2rpx solid #DDDDDD;
  497. margin-right: 24rpx;
  498. }
  499. .kan{
  500. text-align: center;
  501. color: #666666;
  502. width: 150rpx;
  503. height: 56rpx;
  504. line-height: 56rpx;
  505. border-radius: 36rpx;
  506. border: 2rpx solid #DDDDDD;
  507. margin-right: 24rpx;
  508. }
  509. .noMore {
  510. text-align: center;
  511. line-height: 50rpx;
  512. color: #999999;
  513. font-size: 28rpx;
  514. }
  515. .authorizBox{
  516. width: 100vw;
  517. height: 100vh;
  518. background: rgba(0, 0, 0, 0.5);
  519. position: fixed;
  520. top: 0;
  521. left: 0;
  522. }
  523. .authorizCont{
  524. margin-top: 30vh;
  525. width: 564rpx;
  526. height: 408rpx;
  527. background: #FFFFFF;
  528. border-radius: 24rpx;
  529. margin-left: 93rpx;
  530. position: relative;
  531. }
  532. .authorizCloseImg{
  533. width: 62rpx;
  534. height: 62rpx;
  535. }
  536. .sqLogoBox{
  537. width: 180rpx;
  538. height: 180rpx;
  539. background: #FFFFFF;
  540. border-radius: 90rpx;
  541. text-align: center;
  542. position: absolute;
  543. top: -50rpx;
  544. left: 192rpx;
  545. }
  546. .authorizName{
  547. color: #333333;
  548. line-height: 42rpx;
  549. font-size: 30rpx;
  550. text-align: center;
  551. padding-top: 58rpx;
  552. }
  553. .authorizMs{
  554. color: #999999;
  555. line-height: 36rpx;
  556. font-size: 26rpx;
  557. width: 452rpx;
  558. padding-top: 24rpx;
  559. text-align: center;
  560. margin-left: 56rpx;
  561. }
  562. .authorizContbutton{
  563. width: 422rpx;
  564. height: 88rpx;
  565. background: #D53533;
  566. border-radius: 44rpx;
  567. line-height: 88rpx;
  568. text-align: center;
  569. font-size:30rpx;
  570. color: #FFFFFF;
  571. margin-top: 62rpx;
  572. margin-left:71rpx;
  573. }
  574. </style>