jforder.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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-popup ref="popup" type="center">
  35. <view class="express">
  36. <view class="">
  37. 快递公司:<text style="font-weight: bold;">{{express.express_name}}</text>
  38. </view>
  39. <view class="">
  40. 快递单号:<text style="font-weight: bold;">{{express.express_no}}</text>
  41. </view>
  42. </view>
  43. </uni-popup>
  44. </view>
  45. </template>
  46. <script>
  47. import { getJfOrder, getWl } from '@/api/order.js'
  48. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  49. export default {
  50. data() {
  51. return {
  52. list: [],
  53. loadingType: 'more',
  54. page: 1,
  55. limit: 10,
  56. express:{express_name:'暂无',express_no:'暂无'},
  57. }
  58. },
  59. onLoad() {
  60. this.getDate()
  61. },
  62. filters: {
  63. showTime(val) {
  64. let date = new Date(val * 1000);
  65. let Y = date.getFullYear();
  66. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  67. let D = date.getDate() < 10 ? '0' + date.getDay() : date.getDate();
  68. return Y + '年' + M + '月' + D + '日';
  69. },
  70. },
  71. methods: {
  72. // 转换金额为数字
  73. moneyNum(value){
  74. return +value;
  75. },
  76. getDate() {
  77. let obj = this
  78. getJfOrder({
  79. page: obj.page,
  80. limit: obj.limit
  81. }).then(({data}) => {
  82. // console.log(res)
  83. obj.list = data.data
  84. })
  85. },
  86. //查看物流
  87. lookWl(item) {
  88. console.log(item)
  89. let obj = this
  90. uni.showLoading({
  91. title:'查询中...'
  92. })
  93. getWl({
  94. sn:item
  95. }).then(({data}) => {
  96. uni.hideLoading()
  97. console.log(data)
  98. if(data.status_code == 404) {
  99. this.$api.msg('暂无该商品的物流信息')
  100. }
  101. obj.express = data.express_list[0]
  102. obj.$refs.popup.open()
  103. }).catch(err => {
  104. uni.hideLoading()
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. .order-item {
  112. display: flex;
  113. flex-direction: column;
  114. padding-left: 30rpx;
  115. background: #fff;
  116. margin-top: 16rpx;
  117. .i-top {
  118. display: flex;
  119. align-items: center;
  120. height: 80rpx;
  121. padding-right: 30rpx;
  122. font-size: $font-base;
  123. color: $font-color-dark;
  124. position: relative;
  125. .time {
  126. flex: 1;
  127. }
  128. .state {
  129. color: $base-color;
  130. }
  131. .del-btn {
  132. padding: 10rpx 0 10rpx 36rpx;
  133. font-size: $font-lg;
  134. color: $font-color-light;
  135. position: relative;
  136. &:after {
  137. content: '';
  138. width: 0;
  139. height: 30rpx;
  140. border-left: 1px solid $border-color-dark;
  141. position: absolute;
  142. left: 20rpx;
  143. top: 50%;
  144. transform: translateY(-50%);
  145. }
  146. }
  147. }
  148. /* 多条商品 */
  149. .goods-box {
  150. height: 160rpx;
  151. padding: 20rpx 0;
  152. white-space: nowrap;
  153. .goods-item {
  154. width: 120rpx;
  155. height: 120rpx;
  156. display: inline-block;
  157. margin-right: 24rpx;
  158. }
  159. .goods-img {
  160. display: block;
  161. width: 100%;
  162. height: 100%;
  163. }
  164. }
  165. /* 单条商品 */
  166. .goods-box-single {
  167. display: flex;
  168. padding: 20rpx 0;
  169. .goods-img {
  170. display: block;
  171. width: 120rpx;
  172. height: 120rpx;
  173. }
  174. .right {
  175. flex: 1;
  176. display: flex;
  177. flex-direction: column;
  178. padding: 0 30rpx 0 24rpx;
  179. overflow: hidden;
  180. .row{
  181. margin-top: 10rpx;
  182. }
  183. .row_title{
  184. padding:5rpx 10rpx;
  185. background-color: #dddddd;
  186. border-radius: 10rpx;
  187. font-size: 22rpx;
  188. color: #ffffff;
  189. }
  190. .title {
  191. font-size: $font-base + 2rpx;
  192. color: $font-color-dark;
  193. line-height: 1;
  194. width: 80%;
  195. }
  196. .attr-box {
  197. display: flex;
  198. justify-content: flex-end;
  199. font-size: $font-sm + 2rpx;
  200. color: $font-color-light;
  201. }
  202. .price {
  203. display: inline;
  204. font-size: $font-base + 2rpx;
  205. color: $font-color-dark;
  206. &:before {
  207. content: '积分';
  208. font-size: $font-sm;
  209. }
  210. }
  211. }
  212. }
  213. .price-box {
  214. display: flex;
  215. justify-content: flex-end;
  216. align-items: baseline;
  217. padding: 20rpx 30rpx;
  218. font-size: $font-sm + 2rpx;
  219. color: $font-color-light;
  220. .num {
  221. margin: 0 8rpx;
  222. color: $font-color-dark;
  223. }
  224. .price {
  225. font-size: $font-lg;
  226. color: $font-color-dark;
  227. &::after {
  228. content: '积分';
  229. font-size: $font-sm;
  230. margin: 0 2rpx 0 8rpx;
  231. }
  232. &::before {
  233. content: ' ';
  234. font-size: $font-sm;
  235. margin: 0 2rpx 0 8rpx;
  236. }
  237. }
  238. }
  239. .action-box {
  240. display: flex;
  241. justify-content: flex-end;
  242. align-items: center;
  243. height: 100rpx;
  244. position: relative;
  245. padding-right: 30rpx;
  246. }
  247. .action-btn {
  248. width: 160rpx;
  249. height: 60rpx;
  250. margin: 0;
  251. margin-left: 24rpx;
  252. padding: 0;
  253. text-align: center;
  254. line-height: 60rpx;
  255. font-size: $font-sm + 2rpx;
  256. color: $font-color-dark;
  257. background: #fff;
  258. border-radius: 100px;
  259. &:after {
  260. border-radius: 100px;
  261. }
  262. &.recom {
  263. color: $base-color;
  264. &:after {
  265. border-color: $base-color;
  266. }
  267. }
  268. &.evaluate {
  269. color: $color-yellow;
  270. &:after {
  271. border-color: $color-yellow;
  272. }
  273. }
  274. }
  275. }
  276. .express {
  277. width: 600rpx;
  278. height: 200rpx;
  279. border-radius: 20rpx;
  280. background-color: #fff;
  281. text-align: center;
  282. line-height: 100rpx;
  283. font-size: 32rpx;
  284. }
  285. </style>