historySpend.vue 18 KB

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