order-logistics.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <view class="container logistics clearfix">
  3. <!-- 商品 -->
  4. <view class="logistics-container">
  5. <view class="logistics-batch" v-for="(item, index) in goodsList" :key="index">
  6. <view class="order-item" v-for="(comItem, comIndex) in item.companyList" :key="comIndex">
  7. <view class="goods-title">
  8. <view class="title-logo"><image :src="comItem.shopLogo" mode=""></image></view>
  9. <view class="title-text">{{ comItem.name }}</view>
  10. </view>
  11. <view class="goods-item" v-for="(pros, prosIndex) in comItem.productsList" :key="prosIndex">
  12. <view class="goods-pros-t">
  13. <view class="pros-img"><image :src="pros.image" alt=""/></view>
  14. <view class="pros-product">
  15. <view class="producttitle">{{ pros.productName }}</view>
  16. <view class="productspec">
  17. 购买数量:<text class="color">{{ pros.number }}</text>
  18. </view>
  19. <view class="productspec">
  20. 已发货数量:<text class="color">{{ pros.logNumber }}</text>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="logistics-template">
  27. <!-- 物流信息 -->
  28. <view
  29. class="logistics-content"
  30. v-if="item.logisticsData.length > 0"
  31. v-for="(loItem, loIndex) in item.logisticsData"
  32. :key="loIndex"
  33. >
  34. <view class="logistics-top"> <text class="name">物流信息</text> </view>
  35. <view class="logistics-warp">
  36. <view class="logistics-warp__wrapper">
  37. <view class="logistics-main">
  38. <view class="logistics-main-top">
  39. <view class="main-top" @click="showlogistics(index, loIndex)">
  40. {{ loItem.expressname }}:<text class="expressNumber">{{
  41. loItem.expressNumber
  42. }}</text>
  43. <text class="clipboard" @click.stop="clipboard(loItem.expressNumber)"
  44. >复制</text
  45. >
  46. <text
  47. class="arrow-showMore iconfont icon-web_xiangxiazhankai"
  48. :style="{
  49. transform: loItem.isOpen ? 'rotate(180deg)' : 'rotate(0)',
  50. transition: 'transform 0.3s ease'
  51. }"
  52. ></text>
  53. </view>
  54. <view class="main-bot"> 发货时间:{{ loItem.expressNewtime }} </view>
  55. </view>
  56. <view
  57. v-if="loItem.expressRecord.length > 0"
  58. v-for="(infoItem, infoIndex) in loItem.expressRecord"
  59. :key="infoIndex"
  60. :class="{ 'logistics-warp--hide': !loItem.isOpen }"
  61. class="logistics-main-bot logistics-animation"
  62. :style="{
  63. transform: loItem.isOpen ? 'translateY(0)' : 'translateY(-50%)',
  64. '-webkit-transform': loItem.isOpen ? 'translateY(0)' : 'translateY(-50%)'
  65. }"
  66. >
  67. {{ infoItem.time }} {{ infoItem.desc }}
  68. </view>
  69. <view
  70. v-if="loItem.expressRecord.length < 1"
  71. :class="{ 'logistics-warp--hide': !loItem.isOpen }"
  72. class="logistics-main-bot logistics-animation"
  73. :style="{
  74. transform: loItem.isOpen ? 'translateY(0)' : 'translateY(-50%)',
  75. '-webkit-transform': loItem.isOpen ? 'translateY(0)' : 'translateY(-50%)'
  76. }"
  77. >
  78. 暂无物流信息
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="logistics-content" v-else> 暂无物流信息 </view>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 物流信息 -->
  89. <!-- <logistics-record ref="logistics"></logistics-record> -->
  90. </view>
  91. </template>
  92. <script>
  93. import thorui from '@/components/clipboard/clipboard.thorui.js'
  94. export default {
  95. components: {
  96. // logisticsRecord,
  97. },
  98. data() {
  99. return {
  100. orderId: '',
  101. goodsList: []
  102. }
  103. },
  104. onLoad(option) {
  105. //商品数据
  106. this.orderId = option.orderId
  107. this.getData()
  108. },
  109. methods: {
  110. navToListPage(id) {
  111. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  112. },
  113. showlogistics(index, loIndex) {
  114. let getGoodsList = this.goodsList[index],
  115. isOpen = getGoodsList.logisticsData[loIndex]['isOpen']
  116. this.goodsList[index].logisticsData[loIndex]['isOpen'] = !isOpen
  117. },
  118. clipboard(data) {
  119. console.log(data)
  120. thorui.getClipboardData(data, res => {
  121. if (res) {
  122. this.$util.msg('复制成功', 2000, true, 'success')
  123. } else {
  124. this.$util.msg('复制失败', 2000, true, 'none')
  125. }
  126. })
  127. },
  128. getData() {
  129. this.OrderService.QueryLogistics({
  130. orderId: this.orderId
  131. })
  132. .then(response => {
  133. const resData = response.data
  134. // 添加订单列表信息
  135. let orderListArr = []
  136. resData.forEach((item, index) => {
  137. let logisticsArr = [],
  138. companyList = [],
  139. shopOrderList = item.shopOrderList,
  140. logisticsInfos = item.logisticsInformationList
  141. // 添加物流信息
  142. if (logisticsInfos.length > 0) {
  143. logisticsInfos.forEach((loItem, loIndex) => {
  144. let newRouters = []
  145. logisticsArr.push({
  146. expressname: loItem['logisticsCompanyName'],
  147. expressNumber: loItem['nu'],
  148. expressNewtime: item.deliveryTime,
  149. isOpen: false
  150. })
  151. if (loIndex == 0) {
  152. logisticsArr[loIndex]['isOpen'] = true
  153. }
  154. if (loItem.routers) {
  155. loItem.routers.forEach((rItem, rIndex) => {
  156. newRouters.push({
  157. desc: rItem.desc,
  158. time: this.$api.timestampToTime(rItem.time)
  159. })
  160. })
  161. logisticsArr[loIndex]['expressRecord'] = [...newRouters]
  162. } else {
  163. logisticsArr[loIndex]['expressRecord'] = []
  164. }
  165. })
  166. }
  167. // 供应商信息
  168. shopOrderList.forEach((shopItem, shopIndex) => {
  169. let prosListArr = [],
  170. cmLogisticsRecords = shopItem.logisticsRecordList
  171. // 商品信息
  172. cmLogisticsRecords.forEach((prosItem, prosIndex) => {
  173. prosListArr.push({
  174. id: prosItem.organizeProductID,
  175. productName: prosItem.productName,
  176. image: prosItem.image,
  177. number: prosItem.buyNum,
  178. logNumber: prosItem.num
  179. })
  180. })
  181. companyList.push({
  182. shopLogo: shopItem.shopLogo,
  183. name: shopItem.shopName,
  184. showGoods: cmLogisticsRecords.length > 0,
  185. productsList: [...prosListArr]
  186. })
  187. })
  188. orderListArr.push({
  189. logisticsData: [...logisticsArr],
  190. companyList: [...companyList]
  191. })
  192. })
  193. this.goodsList = [...orderListArr]
  194. })
  195. .catch(error => {
  196. this.$util.msg(error.msg, 2000)
  197. })
  198. }
  199. }
  200. }
  201. </script>
  202. <style lang="scss">
  203. page {
  204. height: auto;
  205. }
  206. .logistics-container {
  207. width: 100%;
  208. height: auto;
  209. float: left;
  210. background: #f7f7f7;
  211. border-top: 1px solid #f8f8f8;
  212. .logistics-batch {
  213. display: flex;
  214. flex-direction: column;
  215. margin-bottom: 24rpx;
  216. }
  217. .order-item {
  218. width: 702rpx;
  219. padding: 24rpx 24rpx 12rpx 24rpx;
  220. height: auto;
  221. float: left;
  222. background: #ffffff;
  223. margin-bottom: 20rpx;
  224. .goods-title {
  225. width: 100%;
  226. height: 48rpx;
  227. float: left;
  228. margin-bottom: 12rpx;
  229. .title-logo {
  230. width: 48rpx;
  231. height: 48rpx;
  232. float: left;
  233. border-radius: 8rpx;
  234. border: 1px solid #e1e1e1;
  235. image {
  236. border-radius: 8rpx;
  237. width: 48rpx;
  238. height: 48rpx;
  239. }
  240. }
  241. .title-text {
  242. float: left;
  243. margin-left: 16rpx;
  244. font-size: $font-size-28;
  245. color: $text-color;
  246. text-align: left;
  247. line-height: 48rpx;
  248. font-weight: bold;
  249. }
  250. }
  251. .goods-item {
  252. width: 100%;
  253. height: auto;
  254. border-bottom: 1px solid #e1e1e1;
  255. &:last-child {
  256. border-bottom: none;
  257. }
  258. }
  259. .goods-pros-t {
  260. display: flex;
  261. align-items: center;
  262. width: 100%;
  263. height: 180rpx;
  264. padding: 20rpx 0;
  265. .pros-img {
  266. width: 180rpx;
  267. height: 180rpx;
  268. border-radius: 10rpx;
  269. margin: 0 26rpx 0 0;
  270. border: 1px solid #f3f3f3;
  271. image {
  272. width: 100%;
  273. height: 100%;
  274. border-radius: 10rpx;
  275. }
  276. }
  277. }
  278. .pros-product {
  279. width: 468rpx;
  280. height: 100%;
  281. line-height: 36rpx;
  282. font-size: $font-size-26;
  283. position: relative;
  284. .producttitle {
  285. width: 100%;
  286. display: inline-block;
  287. height: auto;
  288. text-overflow: ellipsis;
  289. display: -webkit-box;
  290. word-break: break-all;
  291. -webkit-box-orient: vertical;
  292. -webkit-line-clamp: 2;
  293. overflow: hidden;
  294. margin-bottom: 28rpx;
  295. }
  296. .productspec {
  297. height: 36rpx;
  298. color: #999999;
  299. line-height: 36rpx;
  300. font-size: $font-size-26;
  301. .color {
  302. color: $text-color;
  303. }
  304. }
  305. }
  306. }
  307. }
  308. .logistics-template {
  309. width: 702rpx;
  310. height: 100%;
  311. background: #ffffff;
  312. float: left;
  313. padding: 24rpx 24rpx 12rpx 24rpx;
  314. .logistics-content {
  315. width: 100%;
  316. padding: 20rpx 0;
  317. height: auto;
  318. .arrow-showMore {
  319. position: absolute;
  320. right: 24rpx;
  321. z-index: 99;
  322. }
  323. .logistics-top {
  324. width: 100%;
  325. height: 40rpx;
  326. line-height: 40rpx;
  327. font-size: $font-size-28;
  328. color: $text-color;
  329. text-align: left;
  330. padding-bottom: 24rpx;
  331. border-bottom: 1px solid #f8f8f8;
  332. .name {
  333. float: left;
  334. font-weight: bold;
  335. }
  336. .icon-web_xiangxiazhankai {
  337. transform: rotate(0deg);
  338. transform-origin: center center;
  339. float: right;
  340. font-size: $font-size-32;
  341. color: #000000;
  342. /* transition: transform 0.3s ease;*/
  343. transition-property: transform;
  344. transition-duration: 0.3s;
  345. transition-timing-function: ease;
  346. }
  347. .icon-web_xiangxiazhankai-active {
  348. transform: rotate(180deg);
  349. }
  350. }
  351. .logistics-warp {
  352. width: 100%;
  353. overflow: hidden;
  354. .table {
  355. height: 76rpx;
  356. line-height: 76rpx;
  357. font-size: $font-size-26;
  358. color: $text-color;
  359. text-align: left;
  360. }
  361. .expressNumber {
  362. width: 250rpx;
  363. display: inline-block;
  364. }
  365. }
  366. .logistics-main-top {
  367. width: 100%;
  368. height: auto;
  369. float: left;
  370. padding-top: 24rpx;
  371. .main-top,
  372. .main-bot {
  373. font-size: $font-size-28;
  374. color: $text-color;
  375. line-height: 40rpx;
  376. margin: 4rpx 0;
  377. }
  378. }
  379. .logistics-main-bot {
  380. width: 100%;
  381. height: auto;
  382. font-size: $font-size-24;
  383. color: $text-color;
  384. line-height: 56rpx;
  385. text-align: justify;
  386. float: left;
  387. }
  388. .logistics-animation {
  389. /* transition: transform 0.3s ease;*/
  390. transition-property: transform;
  391. transition-duration: 0.3s;
  392. transition-timing-function: ease;
  393. }
  394. .logistics-warp__wrapper {
  395. /* #ifndef APP-NVUE */
  396. display: flex;
  397. /* #endif */
  398. flex-direction: column;
  399. }
  400. .logistics-warp--hide {
  401. // padding: 0 0;
  402. // height: 0px;
  403. // line-height: 0px;
  404. display: none;
  405. }
  406. .clipboard {
  407. width: 80rpx;
  408. height: 40rpx;
  409. background: #fff8fd;
  410. text-align: center;
  411. font-size: $font-size-22;
  412. color: #ff457b;
  413. border-radius: 7rpx;
  414. line-height: 40rpx;
  415. display: inline-block;
  416. }
  417. }
  418. }
  419. </style>