order-logistics.vue 10 KB

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