record.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <!-- 吸氢记录 -->
  2. <template>
  3. <view class="record-home">
  4. <view class="top-bar">
  5. <view class="bar-item" :class="currentBar==-1 ? 'activeBar' : ''" @click="changeBar(-1)">
  6. 全部
  7. </view>
  8. <view class="bar-item" :class="currentBar==2? 'activeBar' : ''" @click="changeBar(2)">
  9. 进行中
  10. </view>
  11. <!-- <view class="bar-item" :class="currentBar==0 ? 'activeBar' : ''" @click="changeBar(0)">
  12. 已关闭
  13. </view> -->
  14. <view class="bar-item" :class="currentBar==4 ? 'activeBar' : ''" @click="changeBar(4)">
  15. 已暂停
  16. </view>
  17. <view class="bar-item" :class="currentBar==3? 'activeBar' : ''" @click="changeBar(3)">
  18. 已完成
  19. </view>
  20. <view class="bar-item" :class="currentBar==1 ? 'activeBar' : ''" @click="changeBar(1)">
  21. 待支付
  22. </view>
  23. <!-- <view class="bar-item" :class="currentBar==2 ? 'activeBar' : ''" @click="changeBar(2)">
  24. 已完成
  25. </view>
  26. <view class="bar-item" :class="currentBar==3 ? 'activeBar' : ''" @click="changeBar(3)">
  27. 已关闭
  28. </view> -->
  29. </view>
  30. <view class="list" v-for="(item,index) in orderList" :key='index'>
  31. <view class="list-title" @click="skipDeyail(item)">
  32. <text>订单编号:{{item.no}}</text><text class="iconfont icon-iconfontjiantou2"></text>
  33. </view>
  34. <view class="list-content">
  35. <image src="../../static/image/shop.png" mode=""></image>
  36. <view class="right">
  37. <view class="shop-name">
  38. {{item.shop.name}}
  39. </view>
  40. <view class="time">
  41. 吸氢{{item.work_time}}分钟
  42. </view>
  43. <!-- <view class="time">
  44. {{item.updated_at}}
  45. </view> -->
  46. <view class="day">
  47. <text>{{item.created_at}}</text>
  48. </view>
  49. <view class="pay" v-if="item.status==1" @click="payImmediately(item)">
  50. 立即支付
  51. </view>
  52. <view class="pay1" v-if="item.status==3" style="color: $mine-background-color;">
  53. 已完成
  54. </view>
  55. <view class="pay1" v-if="item.status==0" style="color: #716c6a;">
  56. 已关闭
  57. </view>
  58. <view class="pay1" v-if="item.status==2" style="color: #ff5e49;">
  59. 进行中
  60. </view>
  61. <view class="pay1" v-if="item.status==4" style="color: #ff5e49;">
  62. 已暂停
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="null" v-if="orderList.length==0">
  68. <image src="../../static/image/null.png" mode=""></image>
  69. <view class="null-text">
  70. 暂无记录!
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. var app = getApp()
  77. export default {
  78. data() {
  79. return {
  80. currentBar: -1,
  81. list: [1],
  82. orderList: [],
  83. page: 1,
  84. links: ''
  85. }
  86. },
  87. onLoad() {
  88. if (this.currentBar == -1) {
  89. let params = {
  90. page: this.page
  91. }
  92. this.getOrderList(params)
  93. } else {
  94. let params = {
  95. status: this.currentBar,
  96. page: this.page
  97. }
  98. this.getOrderList(params)
  99. }
  100. },
  101. onReachBottom() {
  102. let params
  103. if (this.links.next) {
  104. uni.showLoading()
  105. this.page++
  106. } else {
  107. uni.showToast({
  108. title: '到底了~',
  109. icon: 'none'
  110. })
  111. return
  112. }
  113. if (this.currentBar == -1) {
  114. params = {
  115. page: this.page
  116. }
  117. } else {
  118. params = {
  119. status: this.currentBar,
  120. page: this.page
  121. }
  122. }
  123. app.request('/orders', params, 'get').then(res => {
  124. let dataList = res.data.data.data
  125. uni.hideLoading()
  126. this.orderList = this.orderList.concat(dataList)
  127. this.links = res.data.data.meta.pagination.links
  128. })
  129. },
  130. methods: {
  131. //订单列表
  132. getOrderList: function(params) {
  133. uni.showLoading()
  134. app.request('/orders', params, 'get').then(res => {
  135. if (res.statusCode == 200) {
  136. let data = res.data.data.data
  137. this.orderList = this.orderList.concat(data)
  138. this.links = res.data.data.meta.pagination.links
  139. }
  140. uni.hideLoading()
  141. })
  142. },
  143. //跳转详情
  144. skipDeyail: function(e) {
  145. if (e.status == 2 || e.status == 4) {
  146. uni.setStorageSync('order_no', e.no)
  147. uni.setStorageSync('work_time', e.work_time)
  148. uni.navigateTo({
  149. url: '../index/order?order_no=' + e.no,
  150. })
  151. } else {
  152. uni.navigateTo({
  153. url: './orderDetail?order_no=' + e.no
  154. })
  155. }
  156. },
  157. //立即支付
  158. payImmediately: function(e) {
  159. uni.setStorageSync('work_time', e.work_time)
  160. let params = {
  161. no: e.no
  162. }
  163. app.request('/order/pay', params, 'post').then(res => {
  164. console.log(res)
  165. // let params=res.data.data
  166. let order_no = res.data.data.order_no
  167. uni.requestPayment({
  168. provider: 'wxpay',
  169. timeStamp: res.data.data.timeStamp,
  170. nonceStr: res.data.data.nonceStr,
  171. package: res.data.data.package,
  172. signType: res.data.data.signType,
  173. paySign: res.data.data.paySign,
  174. appId: res.data.data.appId,
  175. success: function(res) {
  176. console.log('success:' + JSON.stringify(res));
  177. uni.navigateTo({
  178. url: '../index/surePay?order_no=' + order_no
  179. // url: './?order_no=' + order_no
  180. })
  181. },
  182. fail: function(err) {
  183. console.log('fail:' + JSON.stringify(err));
  184. console.log(typeof(res.data.data.package))
  185. }
  186. });
  187. })
  188. },
  189. changeBar(e) {
  190. this.currentBar = e
  191. this.orderList = []
  192. this.page = 1
  193. if (this.currentBar == -1) {
  194. let params = {
  195. page: this.page
  196. }
  197. this.getOrderList(params)
  198. } else {
  199. let params = {
  200. status: this.currentBar,
  201. page: this.page
  202. }
  203. this.getOrderList(params)
  204. }
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="scss" scoped>
  210. .record-home {
  211. // background-color: #EEEEEE;
  212. // height: 100%;
  213. padding-bottom: 50upx;
  214. padding-top: 100upx;
  215. .top-bar {
  216. position: fixed;
  217. z-index: 9999;
  218. top: 0;
  219. display: flex;
  220. width: 100%;
  221. height: 80upx;
  222. line-height: 80upx;
  223. background-color: #FFFFFF;
  224. .bar-item {
  225. margin: 0 30upx;
  226. flex: 1;
  227. text-align: center;
  228. font-size: 26upx;
  229. font-family: PingFang SC;
  230. font-weight: 300;
  231. color: #B6B6B6;
  232. // padding: 7upx 0;
  233. }
  234. .activeBar {
  235. border-bottom: solid 6upx $mine-background-color;
  236. font-weight: 500;
  237. font-size: 28upx;
  238. color: $mine-background-color;
  239. }
  240. }
  241. .list {
  242. background: #FFFFFF;
  243. margin: 30upx 30upx 30upx;
  244. padding: 30upx;
  245. border-radius: 12upx;
  246. .list-title {
  247. padding-bottom: 20upx;
  248. font-size: 26upx;
  249. font-family: PingFang SC;
  250. // font-weight: bold;
  251. color: #000000;
  252. border-bottom: solid 1upx #e4e3e8;
  253. .icon-iconfontjiantou2 {
  254. float: right;
  255. }
  256. }
  257. .list-content {
  258. display: flex;
  259. margin-top: 20upx;
  260. image {
  261. flex: 0 0 155upx;
  262. height: 155upx;
  263. margin-right: 15upx;
  264. }
  265. .right {
  266. flex: 1;
  267. position: relative;
  268. .shop-name {
  269. font-size: 26upx;
  270. font-family: PingFang SC;
  271. font-weight: 500;
  272. color: #000000;
  273. line-height: 70upx;
  274. }
  275. .time {
  276. font-size: 24upx;
  277. font-family: PingFang SC;
  278. font-weight: 300;
  279. margin-top: 10upx;
  280. color: #B6B6B6;
  281. }
  282. .day {
  283. font-size: 24upx;
  284. font-family: PingFang SC;
  285. font-weight: 300;
  286. color: #B6B6B6;
  287. margin-top: 5upx;
  288. }
  289. .pay {
  290. position: absolute;
  291. bottom: 0upx;
  292. right: 0;
  293. height: 50upx;
  294. line-height: 50upx;
  295. z-index: 9;
  296. background-color: #d95e4e;
  297. color: #FFFFFF;
  298. border-radius: 12upx;
  299. // width: 100upx;
  300. text-align: center;
  301. font-size: 20upx;
  302. padding: 0 20upx;
  303. }
  304. .pay1 {
  305. position: absolute;
  306. bottom: 0upx;
  307. right: 0;
  308. height: 50upx;
  309. line-height: 50upx;
  310. z-index: 9;
  311. // // background-color: #d95e4e;
  312. // color: #FFFFFF;
  313. border-radius: 12upx;
  314. // width: 100upx;
  315. text-align: center;
  316. font-size: 24upx;
  317. padding: 0 20upx;
  318. }
  319. }
  320. }
  321. }
  322. .null {
  323. margin: 0 auto;
  324. width: 350upx;
  325. // padding-top: 30%;
  326. image {
  327. width: 350upx;
  328. height: 300upx;
  329. margin-top: 55%;
  330. }
  331. .null-text {
  332. text-align: center;
  333. font-size: 37upx;
  334. font-weight: 400;
  335. color: #515151;
  336. margin-top: 85upx;
  337. padding-left: 35upx;
  338. }
  339. }
  340. }
  341. </style>