jforder.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <view class="">
  3. <view v-for="(item, index) in list" :key="index" class="order-item">
  4. <view class="i-top b-b">
  5. <text class="time">{{ item.pay_time |showTime }}</text>
  6. <!-- <text class="state" :style="{ color: item.stateTipColor }">{{ item._status._title }}</text> -->
  7. <!-- <text v-if="item.status === 4" class="del-btn iconfont icondelete" @click="deleteOrder(index)"></text> -->
  8. </view>
  9. <view class="goods-box-single">
  10. <image class="goods-img" :src="item.goods_image" mode="scaleToFill"></image>
  11. <view class="right">
  12. <view class="flex-start">
  13. <text class="title clamp">{{ item.goods_name }}</text>
  14. <!-- <text class="price">{{ item.pay_price|moneyNum }}</text> -->
  15. </view>
  16. <view class="row flex">
  17. <!-- <text class="row_title">{{ goodsItem.productInfo.attrInfo ? goodsItem.productInfo.attrInfo.suk : '' }}</text> -->
  18. <text class="attr-box"> x {{ item.goods_num }}</text>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="price-box">
  23. <!-- 共
  24. <text class="num">{{ item.cartInfo.length }}</text>
  25. 件商品 邮费
  26. <text class="price">{{ moneyNum(item.pay_postage)}}</text> -->
  27. 实付款
  28. <text class="price">{{ moneyNum(item.pay_price)}}</text>
  29. </view>
  30. <view class="action-box b-t" v-if="item.sn">
  31. <button class="action-btn" @click.stop="lookWl(item.sn)">查看物流</button>
  32. </view>
  33. </view>
  34. <uni-load-more :status="loadingType"></uni-load-more>
  35. <uni-popup ref="popup" type="center">
  36. <view class="express">
  37. <view class="">
  38. 快递公司:<text style="font-weight: bold;">{{express.express_name}}</text>
  39. </view>
  40. <view class="">
  41. 快递单号:<text style="font-weight: bold;">{{express.express_no}}</text>
  42. </view>
  43. </view>
  44. </uni-popup>
  45. </view>
  46. </template>
  47. <script>
  48. import { getJfOrder, getWl } from '@/api/order.js'
  49. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  50. export default {
  51. data() {
  52. return {
  53. list: [],
  54. loadingType: 'more',
  55. page: 1,
  56. limit: 10,
  57. express:{express_name:'暂无',express_no:'暂无'},
  58. }
  59. },
  60. onLoad() {
  61. this.getDate()
  62. },
  63. filters: {
  64. showTime(val) {
  65. let date = new Date(val * 1000);
  66. let Y = date.getFullYear();
  67. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  68. let D = date.getDate() < 10 ? '0' + date.getDay() : date.getDate();
  69. return Y + '年' + M + '月' + D + '日';
  70. },
  71. },
  72. onReachBottom() {
  73. this.getDate()
  74. },
  75. methods: {
  76. // 转换金额为数字
  77. moneyNum(value){
  78. return +value;
  79. },
  80. getDate() {
  81. let obj = this
  82. if (obj.loadingType === 'loading') {
  83. //防止重复加载
  84. return;
  85. }
  86. if (obj.loadingType === 'noMore') {
  87. //防止重复加载
  88. return;
  89. }
  90. // 修改当前对象状态为加载中
  91. obj.loadingType = 'loading';
  92. getJfOrder({
  93. page: obj.page,
  94. limit: obj.limit
  95. }).then(({data}) => {
  96. // console.log(res)
  97. obj.list = obj.list.concat(data.data)
  98. obj.page++
  99. if (obj.limit == data.data.length) {
  100. //判断是否还有数据, 有改为 more, 没有改为noMore
  101. obj.loadingType = 'more';
  102. } else {
  103. //判断是否还有数据, 有改为 more, 没有改为noMore
  104. obj.loadingType = 'noMore';
  105. }
  106. })
  107. },
  108. //查看物流
  109. lookWl(item) {
  110. console.log(item)
  111. let obj = this
  112. uni.showLoading({
  113. title:'查询中...'
  114. })
  115. getWl({
  116. sn:item
  117. }).then(({data}) => {
  118. uni.hideLoading()
  119. console.log(data)
  120. if(data.status_code == 404) {
  121. this.$api.msg('暂无该商品的物流信息')
  122. }
  123. obj.express = data.express_list[0]
  124. obj.$refs.popup.open()
  125. }).catch(err => {
  126. uni.hideLoading()
  127. })
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss">
  133. .order-item {
  134. display: flex;
  135. flex-direction: column;
  136. padding-left: 30rpx;
  137. background: #fff;
  138. margin-top: 16rpx;
  139. .i-top {
  140. display: flex;
  141. align-items: center;
  142. height: 80rpx;
  143. padding-right: 30rpx;
  144. font-size: $font-base;
  145. color: $font-color-dark;
  146. position: relative;
  147. .time {
  148. flex: 1;
  149. }
  150. .state {
  151. color: $base-color;
  152. }
  153. .del-btn {
  154. padding: 10rpx 0 10rpx 36rpx;
  155. font-size: $font-lg;
  156. color: $font-color-light;
  157. position: relative;
  158. &:after {
  159. content: '';
  160. width: 0;
  161. height: 30rpx;
  162. border-left: 1px solid $border-color-dark;
  163. position: absolute;
  164. left: 20rpx;
  165. top: 50%;
  166. transform: translateY(-50%);
  167. }
  168. }
  169. }
  170. /* 多条商品 */
  171. .goods-box {
  172. height: 160rpx;
  173. padding: 20rpx 0;
  174. white-space: nowrap;
  175. .goods-item {
  176. width: 120rpx;
  177. height: 120rpx;
  178. display: inline-block;
  179. margin-right: 24rpx;
  180. }
  181. .goods-img {
  182. display: block;
  183. width: 100%;
  184. height: 100%;
  185. }
  186. }
  187. /* 单条商品 */
  188. .goods-box-single {
  189. display: flex;
  190. padding: 20rpx 0;
  191. .goods-img {
  192. display: block;
  193. width: 120rpx;
  194. height: 120rpx;
  195. }
  196. .right {
  197. flex: 1;
  198. display: flex;
  199. flex-direction: column;
  200. padding: 0 30rpx 0 24rpx;
  201. overflow: hidden;
  202. .row{
  203. margin-top: 10rpx;
  204. }
  205. .row_title{
  206. padding:5rpx 10rpx;
  207. background-color: #dddddd;
  208. border-radius: 10rpx;
  209. font-size: 22rpx;
  210. color: #ffffff;
  211. }
  212. .title {
  213. font-size: $font-base + 2rpx;
  214. color: $font-color-dark;
  215. line-height: 1;
  216. width: 80%;
  217. }
  218. .attr-box {
  219. display: flex;
  220. justify-content: flex-end;
  221. font-size: $font-sm + 2rpx;
  222. color: $font-color-light;
  223. }
  224. .price {
  225. display: inline;
  226. font-size: $font-base + 2rpx;
  227. color: $font-color-dark;
  228. &:before {
  229. content: '积分';
  230. font-size: $font-sm;
  231. }
  232. }
  233. }
  234. }
  235. .price-box {
  236. display: flex;
  237. justify-content: flex-end;
  238. align-items: baseline;
  239. padding: 20rpx 30rpx;
  240. font-size: $font-sm + 2rpx;
  241. color: $font-color-light;
  242. .num {
  243. margin: 0 8rpx;
  244. color: $font-color-dark;
  245. }
  246. .price {
  247. font-size: $font-lg;
  248. color: $font-color-dark;
  249. &::after {
  250. content: '积分';
  251. font-size: $font-sm;
  252. margin: 0 2rpx 0 8rpx;
  253. }
  254. &::before {
  255. content: ' ';
  256. font-size: $font-sm;
  257. margin: 0 2rpx 0 8rpx;
  258. }
  259. }
  260. }
  261. .action-box {
  262. display: flex;
  263. justify-content: flex-end;
  264. align-items: center;
  265. height: 100rpx;
  266. position: relative;
  267. padding-right: 30rpx;
  268. }
  269. .action-btn {
  270. width: 160rpx;
  271. height: 60rpx;
  272. margin: 0;
  273. margin-left: 24rpx;
  274. padding: 0;
  275. text-align: center;
  276. line-height: 60rpx;
  277. font-size: $font-sm + 2rpx;
  278. color: $font-color-dark;
  279. background: #fff;
  280. border-radius: 100px;
  281. &:after {
  282. border-radius: 100px;
  283. }
  284. &.recom {
  285. color: $base-color;
  286. &:after {
  287. border-color: $base-color;
  288. }
  289. }
  290. &.evaluate {
  291. color: $color-yellow;
  292. &:after {
  293. border-color: $color-yellow;
  294. }
  295. }
  296. }
  297. }
  298. .express {
  299. width: 600rpx;
  300. height: 200rpx;
  301. border-radius: 20rpx;
  302. background-color: #fff;
  303. text-align: center;
  304. line-height: 100rpx;
  305. font-size: 32rpx;
  306. }
  307. </style>