logisticsNew.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <view class="container">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <!-- 包裹选项卡 -->
  5. <view class="packAge" v-if="packAgeList.length">
  6. <scroll-view scroll-X="true" class="packAge-scoll">
  7. <view class="every" :class="{'activeTab': currentIndex == index, 'one': packAgeList.length == 1}"
  8. v-for="(item, index) in packAgeList" :key="index" @click="changeTab(item, index)">
  9. 包裹{{index + 1}}
  10. </view>
  11. </scroll-view>
  12. </view>
  13. <!-- 商品信息 -->
  14. <view class="goods">
  15. <view class="title">
  16. 商品信息
  17. </view>
  18. <view class="goods-box" v-for="(item, index) in detail.order_package_items" :key="index">
  19. <view class="goods-img">
  20. <image :src="item.goods_img" mode="aspectFill"></image>
  21. </view>
  22. <view class="goods-info">
  23. <view class="label">{{item.goods_title}}</view>
  24. <view class="box sku-box">
  25. <view class="sku">
  26. {{item.sku_set_name}}
  27. </view>
  28. <view class="sku num">
  29. x {{item.buy_number}}
  30. </view>
  31. </view>
  32. <view class="box">
  33. <view class="u-FFF u-font36 priceColor">
  34. <rich-text :nodes="$mUtil.priceBigSmall(item.sale_price)"></rich-text>
  35. </view>
  36. <view class="number">
  37. 发货数量 x {{item.number}}
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 物流信息 -->
  44. <view class="logistics" v-if="detail.express">
  45. <view class="title">
  46. 物流信息
  47. </view>
  48. <view class="box">
  49. <text>物流公司:</text>
  50. <text>{{detail.express.express_name}}</text>
  51. </view>
  52. <view class="box">
  53. <text>物流单号:</text>
  54. <text>{{detail.express.logistic_code}}</text>
  55. </view>
  56. </view>
  57. <!-- 物流记录 -->
  58. <view class="">
  59. <view class="record">
  60. 物流记录
  61. </view>
  62. <view class="shipping u-bg-fff">
  63. <view class="linehh" :style="'height:'+xiantiaoHeight+'px;top:'+xiantiaoTop+'px;left:'+xiantiaoLeft+'px'">
  64. </view>
  65. <view class="ul u-plr30" v-for="(item,index) in shiplist" :key="index">
  66. <view class="li">
  67. <!-- <view class="state u-font26 u-flex" :class="{act:index==0}">
  68. {{item.state}}
  69. </view> -->
  70. <view class="mmmm">
  71. <view class="yuan " :class="{act:index==0,first:index==0,end:index==shiplist.length-1}">
  72. </view>
  73. </view>
  74. <view class="desc">
  75. <view class="u-font26 u-1A1A1A">{{item.acceptStation}}</view>
  76. <view class="u-999 u-font24 u-mt10">{{item.acceptTime}}</view>
  77. </view>
  78. </view>
  79. </view>
  80. <nodata v-if="noData" :config="{top:20,content:'暂无物流数据~'}"></nodata>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. data() {
  89. return {
  90. config: {
  91. back: true, //false是tolbar页面 是则不写
  92. title: '物流信息',
  93. color: '#1A1A1A',
  94. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  95. backgroundColor: [1, "#FFFFFF"],
  96. statusBarFontColor: '#1A1A1A'
  97. },
  98. xiantiaoHeight: 0,
  99. xiantiaoLeft: 0,
  100. xiantiaoTop: 0,
  101. goodsimg: '',
  102. num: 0,
  103. code: '',
  104. shiplist: [],
  105. noData: false,
  106. packAgeList: [],
  107. currentIndex: 0,
  108. detail: {}
  109. }
  110. },
  111. onLoad(options) {
  112. if (options.id) {
  113. this.currentIndex = options.index
  114. this.getPackAge(options.id, options.index)
  115. }
  116. },
  117. methods: {
  118. // 包裹信息
  119. getPackAge(orderId, index=0) {
  120. this.$http.get(`/order/package/allpackage/${orderId}`).then(res => {
  121. if (res.code === 200) {
  122. this.packAgeList = res.list
  123. this.detail = this.packAgeList[index]
  124. this.getLogistiscs(this.detail.order_id, this.detail.id)
  125. }
  126. })
  127. },
  128. changeTab(item, index) {
  129. if (this.currentIndex == index) {
  130. return false
  131. }
  132. this.currentIndex = index
  133. this.detail = this.packAgeList[index]
  134. this.getLogistiscs(this.detail.order_id, this.detail.id)
  135. },
  136. getLogistiscs(orderId, id) {
  137. this.$http.get(`/order/express/select/${orderId}/${id}`)
  138. .then(res => {
  139. if (res && res.code == 200) {
  140. if (!res.data || res.data.traces.length == 0) {
  141. this.noData = true
  142. return
  143. }
  144. this.shiplist = res.data.traces.reverse()
  145. this.code = res.data.logisticCode
  146. }
  147. })
  148. },
  149. getLogistiscsBlack(id) {
  150. this.$http.get('/rights/express/select/' + id)
  151. .then(res => {
  152. if (res && res.code == 200) {
  153. this.shiplist = res.data.traces.reverse()
  154. this.code = res.data.logisticCode
  155. if (res.data.traces.length == 0) {
  156. this.noData = true
  157. }
  158. }
  159. })
  160. },
  161. getHeight() {
  162. const query = uni.createSelectorQuery();
  163. query.select('.first').boundingClientRect()
  164. query.select('.end').boundingClientRect()
  165. var that = this;
  166. query.exec(function(res) {
  167. console.log(res);
  168. var xiantiaoHeight = 0;
  169. if (res[1] !== null) {
  170. xiantiaoHeight = (res[1].top - res[0].top);
  171. }
  172. that.xiantiaoHeight = xiantiaoHeight;
  173. that.xiantiaoLeft = res[0].left + 4;
  174. that.xiantiaoTop = res[0].top;
  175. })
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="scss">
  181. .borderBottom {
  182. border-bottom: 20rpx solid #eee;
  183. }
  184. // 包裹选项卡
  185. .packAge {
  186. width: 100%;
  187. height: 100rpx;
  188. // margin-bottom: 20rpx;
  189. padding-left: 30rpx;
  190. line-height: 100rpx;
  191. background-color: #fff;
  192. .packAge-scoll {
  193. width: 100%;
  194. height: 100%;
  195. white-space: nowrap;
  196. }
  197. .every {
  198. display: inline-block;
  199. width: 180rpx;
  200. height: 60rpx;
  201. line-height: 60rpx;
  202. text-align: center;
  203. border: 1rpx solid #3775F6;
  204. border-right: none;
  205. // border-radius: 10rpx;
  206. &:first-child {
  207. border-right: none;
  208. border-radius: 10rpx 0 0 10rpx;
  209. }
  210. &:last-child {
  211. border-right: 1rpx solid #3775F6;
  212. border-radius: 0 10rpx 10rpx 0;
  213. }
  214. image {
  215. width: 30rpx;
  216. height: 30rpx;
  217. margin-right: 20rpx;
  218. vertical-align: middle;
  219. }
  220. }
  221. .activeTab {
  222. background-color: #FA6138;
  223. color: #fff;
  224. }
  225. .one {
  226. &:first-child {
  227. border-radius: 10rpx;
  228. }
  229. }
  230. }
  231. .goods {
  232. padding: 30rpx;
  233. padding-bottom: 10rpx;
  234. background-color: #fff;
  235. .goods-box {
  236. display: flex;
  237. padding: 30rpx 0;
  238. border-bottom: 1rpx solid #f2f2f2;
  239. .goods-img {
  240. width: 150rpx;
  241. height: 150rpx;
  242. margin-right: 20rpx;
  243. border-radius: 20rpx;
  244. flex-shrink: 0;
  245. overflow: hidden;
  246. image {
  247. width: 100%;
  248. height: 100%;
  249. }
  250. }
  251. .goods-info {
  252. flex: 1;
  253. width: 0;
  254. .label {
  255. overflow: hidden;
  256. text-overflow: ellipsis;
  257. white-space: nowrap;
  258. color: #1A1A1A;
  259. margin-bottom: 10rpx;
  260. }
  261. .box {
  262. display: flex;
  263. align-items: center;
  264. justify-content: space-between;
  265. .sku {
  266. font-size: 22rpx;
  267. color: #999;
  268. margin-right: 10rpx;
  269. overflow: hidden;
  270. text-overflow: ellipsis;
  271. white-space: nowrap;
  272. }
  273. .priceColor {
  274. color: #FA6138;
  275. font-weight: bold;
  276. }
  277. .num {
  278. flex-shrink: 0;
  279. }
  280. .number {
  281. font-size: 22rpx;
  282. flex-shrink: 0;
  283. }
  284. }
  285. .sku-box {
  286. margin-bottom: 20rpx;
  287. }
  288. }
  289. }
  290. }
  291. .title {
  292. font-size: 30rpx;
  293. font-weight: bold;
  294. margin-bottom: 20rpx;
  295. }
  296. .logistics {
  297. padding: 30rpx;
  298. padding-bottom: 10rpx;
  299. background-color: #fff;
  300. .box {
  301. padding-left: 30rpx;
  302. margin-bottom: 20rpx;
  303. &:last-child {
  304. margin-bottom: 0;
  305. }
  306. }
  307. }
  308. .record {
  309. padding: 30rpx;
  310. padding-bottom: 10rpx;
  311. font-size: 30rpx;
  312. font-weight: bold;
  313. background-color: #fff;
  314. }
  315. .shipping {
  316. width: 100%;
  317. margin: 0 auto;
  318. background-color: #ffffff;
  319. .linehh {
  320. position: absolute;
  321. width: 2rpx;
  322. margin-left: 16rpx;
  323. border-left: 2rpx dotted #BEC2CB;
  324. }
  325. .ul {
  326. .li {
  327. width: 100%;
  328. display: flex;
  329. height: auto;
  330. margin-top: 2rpx;
  331. .state {
  332. padding: 20rpx 0rpx;
  333. &.act {
  334. color: #FA6138;
  335. }
  336. .timeday {
  337. font-size: 28upx;
  338. }
  339. .timeh {
  340. font-size: 24upx;
  341. }
  342. }
  343. .mmmm {
  344. position: relative;
  345. display: flex;
  346. padding: 0rpx 32rpx 0rpx 36rpx;
  347. margin-top: 22rpx;
  348. .yuan {
  349. position: absolute;
  350. left: 26rpx;
  351. width: 25rpx;
  352. height: 25rpx;
  353. background: #dedede;
  354. border-radius: 50%;
  355. border: 3rpx solid #f2f2f2;
  356. &.act {
  357. background-color: #FA6138;
  358. width: 44rpx;
  359. height: 44rpx;
  360. margin-left: -10rpx;
  361. }
  362. }
  363. }
  364. .desc {
  365. width: 74%;
  366. padding: 20rpx 0rpx;
  367. margin-left: 22rpx;
  368. }
  369. }
  370. }
  371. }
  372. </style>