order-logistics.vue 10 KB

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