historySpend.vue 10 KB

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