historySpend.vue 10 KB

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