purchase_history.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view class="page">
  3. <view v-if="showtape" class="topt flexB">
  4. <view :style="{color: params.type == 1 ? '#FB231F' : '#333'}" class="topt_item flexCC" @click="params.type = 1, cearBox()">
  5. <text>肥皂订单</text>
  6. <view :class="params.type == 1 ? 'checked_l' : 'nochecked_l'" />
  7. </view>
  8. <view class="topt_line" />
  9. <view :style="{color: params.type == 2 ? '#FB231F' : '#333'}" class="topt_item flexCC" @click="params.type = 2, cearBox()">
  10. <text>胶带订单</text>
  11. <view :class="params.type == 2 ? 'checked_l' : 'nochecked_l'" />
  12. </view>
  13. </view>
  14. <view :style="{'padding-top': showtape ? '104rpx' : '24rpx'}">
  15. <view class="soapBox" v-for="(item, index) in list" :key="index" @click="getDetail(item)">
  16. <image :src="item.express_status == 2?statusImg[2]:item.express_status == 1?statusImg[1]: statusImg[0]" class="soapBox_statusImg"></image>
  17. <view class="soapBox_top">
  18. 订单号:{{ item.order_num }}
  19. </view>
  20. <view class="soapBox_middle">
  21. <view class="flexC">
  22. <image :src="item.goods_type == 2 ? image[1] : image[0]" class="goodsImg"></image>
  23. <view class="middleFlex">
  24. <view class="middleFlex_title">
  25. {{ item.goods_type == 2 ? '【大卫博士健康内裤】专用打包胶带' : '【大卫博士健康内裤】专用洗涤皂' }}
  26. </view>
  27. <view class="middleFlex_dan">
  28. <view style="font-weight: bold;">
  29. ¥{{ item.goods_type == 2 ? 20 : 8 }}
  30. </view>
  31. <view class="num">
  32. x{{ item.num }}
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="soapBox_bottom">
  39. <text class="text1">共{{ `${item.num + (item.goods_type == 2 ? '卷' : '块')}` }},</text>
  40. <text>合计;</text>
  41. <text class="text2">¥</text>
  42. <text class="text3">{{ item.cost }}</text>
  43. </view>
  44. </view>
  45. <view class="noList"v-if="!showList">
  46. <image src="https://soap.cliu.cc/chumeng/no_record.png" mode="widthFix"></image>
  47. </view>
  48. <view style="margin: 30rpx auto 10rpx;text-align: center;" v-if="showList && showBottom">
  49. 没有更多啦~
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. import { _API_GetSoapList } from '@/api/Buy_soap_tape.js'
  56. export default {
  57. data() {
  58. return {
  59. showList: true,
  60. showBottom: false,
  61. showtape: false,
  62. statusImg: [
  63. require('../../static/Buy_soap_tape/0.png'),
  64. require('../../static/Buy_soap_tape/1.png'),
  65. require('../../static/Buy_soap_tape/2.png')
  66. ],
  67. image: [
  68. require('../../static/Buy_soap_tape/soap-s.png'),
  69. require('../../static/Buy_soap_tape/tape-s.png')
  70. ],
  71. params: {
  72. page_index: 1,
  73. page_size: 7,
  74. type: 1
  75. },
  76. type: '',
  77. totalPage: 0,
  78. list: []
  79. }
  80. },
  81. onLoad(v) {
  82. if (v.type) {
  83. this.params.type = v.type == 0 ? 2 : 1
  84. }
  85. let userInfo = uni.getStorageSync('userInfo')
  86. if (userInfo.level == 3) {
  87. this.showtape = true
  88. }
  89. this.getLowerAll()
  90. },
  91. onReachBottom() {
  92. this.more()
  93. },
  94. methods: {
  95. cearBox() {
  96. this.page_index = 1
  97. this.getLowerAll()
  98. },
  99. //获取列表
  100. getLowerAll(isMore) {
  101. uni.showLoading({ title: '加载中', mask: true })
  102. _API_GetSoapList(this.params).then(res => {
  103. uni.hideLoading()
  104. if (res.code === 200) {
  105. const { list, total } = res.data
  106. if (list.length === 0) {
  107. this.list = []
  108. this.totalPage = 0
  109. this.showList = false
  110. return false
  111. }
  112. this.showList = true
  113. this.totalPage = Math.ceil(Number(total) / 7)
  114. this.list = isMore ? this.list.concat(list) : list
  115. } else {
  116. uni.showToast({ title: res.message || '获取列表失败', icon: 'none' })
  117. }
  118. })
  119. },
  120. //加载获取更多
  121. more() {
  122. if (this.params.page_index >= this.totalPage) {
  123. this.showBottom = true
  124. return false
  125. }
  126. this.params.page_index++
  127. this.getLowerAll(true)
  128. },
  129. getDetail(item) {
  130. uni.navigateTo({
  131. url: './orderDetail?data=' + encodeURIComponent(JSON.stringify(item))
  132. })
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .page {
  139. padding: 24rpx;
  140. }
  141. .noList {
  142. margin-top: 100rpx;
  143. display: flex;
  144. align-items: center;
  145. flex-direction: column;
  146. image {
  147. width: 500rpx;
  148. margin-bottom: 20rpx;
  149. }
  150. }
  151. .topt {
  152. width: 100%;
  153. padding: 30rpx 72rpx 24rpx 72rpx;
  154. box-sizing: border-box;
  155. background-color: #fff;
  156. position: fixed;
  157. left: 0;
  158. top: 0;
  159. z-index: 10000;
  160. .checked_l {
  161. width: 32rpx;
  162. height: 4rpx;
  163. background: linear-gradient(180deg, #FF232C 0%, #FF571B 100%);
  164. border-radius: 4rpx 4rpx 4rpx 4rpx;
  165. margin-top: 5rpx;
  166. }
  167. .nochecked_l {
  168. width: 32rpx;
  169. height: 4rpx;
  170. border-radius: 4rpx 4rpx 4rpx 4rpx;
  171. margin-top: 5rpx;
  172. }
  173. &_line {
  174. height: 40rpx;
  175. border: 2rpx solid #F5F5F5;
  176. }
  177. &_item {
  178. margin-bottom: 5rpx;
  179. text {
  180. font-size: 32rpx;
  181. font-family: PingFang SC-Bold, PingFang SC;
  182. font-weight: bold;
  183. }
  184. }
  185. }
  186. .top {
  187. height: 104rpx;
  188. background: linear-gradient(90deg, #FF232C 0%, #FF571B 100%);
  189. border-radius: 16rpx 16rpx 16rpx 16rpx;
  190. display: flex;
  191. justify-content: space-between;
  192. align-items: center;
  193. padding: 0 40rpx;
  194. text {
  195. font-size: 32rpx;
  196. color: #fff;
  197. }
  198. &_btn {
  199. color: #fff;
  200. width: 144rpx;
  201. height: 56rpx;
  202. background: #FFFFFF;
  203. background-color: #fff;
  204. border-radius: 28rpx 28rpx 28rpx 28rpx;
  205. font-size: 32rpx;
  206. color: #FB231F;
  207. text-align: center;
  208. line-height: 56rpx;
  209. }
  210. }
  211. .soapBox {
  212. margin-bottom: 24rpx;
  213. padding: 24rpx;
  214. background: #FFFFFF;
  215. border-radius: 16rpx 16rpx 16rpx 16rpx;
  216. position: relative;
  217. &_statusImg {
  218. width: 148rpx;
  219. height: 68rpx;
  220. position: absolute;
  221. right: 24rpx;
  222. top: 16rpx;
  223. }
  224. &_top {
  225. font-size: 28rpx;
  226. padding: 3rpx 0 24rpx 0;
  227. border-bottom: 2rpx solid #E9E9E9;
  228. }
  229. &_middle {
  230. display: flex;
  231. justify-content: space-between;
  232. align-items: flex-end;
  233. margin-top: 24rpx;
  234. .num {
  235. font-size: 28rpx;
  236. color: #999999;
  237. }
  238. .goodsImg {
  239. width: 175rpx;
  240. height: 142rpx;
  241. }
  242. .middleFlex {
  243. height: 130rpx;
  244. display: flex;
  245. justify-content: flex-start;
  246. flex-direction: column;
  247. &_title {
  248. font-size: 30rpx;
  249. font-weight: bold;
  250. }
  251. &_dan {
  252. margin-top: 24rpx;
  253. font-size: 28rpx;
  254. width: 472rpx;
  255. display: flex;
  256. align-items: center;
  257. justify-content: space-between;
  258. }
  259. }
  260. }
  261. &_bottom {
  262. text-align: right;
  263. margin-top: 34rpx;
  264. font-weight: bold;
  265. font-size: 28rpx;
  266. .text1 {
  267. color: #999;
  268. }
  269. .text2 {
  270. color: #FB231F;
  271. }
  272. .text3 {
  273. font-size: 44rpx;
  274. color: #FB231F;
  275. }
  276. }
  277. }
  278. .fixed {
  279. width: 100%;
  280. position: fixed;
  281. top: 0;
  282. left: 0;
  283. background-color: #f9f9fb;
  284. padding: 24rpx;
  285. z-index: 1000;
  286. }
  287. </style>