order-logistics.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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. shopOrderId: '',
  97. goodsList: []
  98. }
  99. },
  100. onLoad(option) {
  101. //商品数据
  102. this.shopOrderId = option.shopOrderId
  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({ shopOrderId: this.shopOrderId })
  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. width: 580rpx;
  233. float: left;
  234. margin-left: 16rpx;
  235. font-size: $font-size-28;
  236. color: $text-color;
  237. text-align: left;
  238. line-height: 48rpx;
  239. font-weight: bold;
  240. overflow: hidden;
  241. text-overflow: ellipsis;
  242. white-space: nowrap;
  243. }
  244. }
  245. .goods-item {
  246. width: 100%;
  247. height: auto;
  248. }
  249. .goods-pros-t {
  250. display: flex;
  251. align-items: center;
  252. width: 100%;
  253. height: 217rpx;
  254. padding: 12rpx 0;
  255. .pros-img {
  256. width: 210rpx;
  257. height: 100%;
  258. border-radius: 10rpx;
  259. margin: 0 26rpx 0 0;
  260. border: 1px solid #f3f3f3;
  261. image {
  262. width: 100%;
  263. height: 100%;
  264. border-radius: 10rpx;
  265. }
  266. }
  267. }
  268. .pros-product {
  269. width: 468rpx;
  270. height: 100%;
  271. line-height: 36rpx;
  272. font-size: $font-size-26;
  273. position: relative;
  274. .producttitle {
  275. width: 100%;
  276. display: inline-block;
  277. height: auto;
  278. text-overflow: ellipsis;
  279. display: -webkit-box;
  280. word-break: break-all;
  281. -webkit-box-orient: vertical;
  282. -webkit-line-clamp: 2;
  283. overflow: hidden;
  284. margin-bottom: 58rpx;
  285. }
  286. .productspec {
  287. height: 36rpx;
  288. color: $text-color;
  289. line-height: 36rpx;
  290. font-size: $font-size-26;
  291. }
  292. }
  293. }
  294. }
  295. .logistics-template {
  296. width: 702rpx;
  297. height: 100%;
  298. background: #ffffff;
  299. float: left;
  300. padding: 24rpx 24rpx 12rpx 24rpx;
  301. .logistics-content {
  302. width: 100%;
  303. padding: 20rpx 0;
  304. height: auto;
  305. .arrow-showMore {
  306. position: absolute;
  307. right: 24rpx;
  308. z-index: 99;
  309. }
  310. .logistics-top {
  311. width: 100%;
  312. height: 40rpx;
  313. line-height: 40rpx;
  314. font-size: $font-size-28;
  315. color: $text-color;
  316. text-align: left;
  317. padding-bottom: 24rpx;
  318. border-bottom: 1px solid #f8f8f8;
  319. .name {
  320. float: left;
  321. font-weight: bold;
  322. }
  323. .icon-web_xiangxiazhankai {
  324. transform: rotate(0deg);
  325. transform-origin: center center;
  326. float: right;
  327. font-size: $font-size-32;
  328. color: #000000;
  329. /* transition: transform 0.3s ease;*/
  330. transition-property: transform;
  331. transition-duration: 0.3s;
  332. transition-timing-function: ease;
  333. }
  334. .icon-web_xiangxiazhankai-active {
  335. transform: rotate(180deg);
  336. }
  337. }
  338. .logistics-warp {
  339. width: 100%;
  340. overflow: hidden;
  341. .table {
  342. height: 76rpx;
  343. line-height: 76rpx;
  344. font-size: $font-size-26;
  345. color: $text-color;
  346. text-align: left;
  347. }
  348. .expressNumber {
  349. width: 250rpx;
  350. display: inline-block;
  351. }
  352. }
  353. .logistics-main-top {
  354. width: 100%;
  355. height: auto;
  356. float: left;
  357. padding-top: 24rpx;
  358. .main-top,
  359. .main-bot {
  360. font-size: $font-size-28;
  361. color: $text-color;
  362. line-height: 40rpx;
  363. margin: 4rpx 0;
  364. }
  365. }
  366. .logistics-main-bot {
  367. width: 100%;
  368. height: auto;
  369. font-size: $font-size-24;
  370. color: $text-color;
  371. line-height: 56rpx;
  372. text-align: justify;
  373. }
  374. .logistics-animation {
  375. /* transition: transform 0.3s ease;*/
  376. transition-property: transform;
  377. transition-duration: 0.3s;
  378. transition-timing-function: ease;
  379. }
  380. .logistics-warp__wrapper {
  381. /* #ifndef APP-NVUE */
  382. display: flex;
  383. /* #endif */
  384. flex-direction: column;
  385. }
  386. .logistics-warp--hide {
  387. // padding: 0 0;
  388. // height: 0px;
  389. // line-height: 0px;
  390. display: none;
  391. }
  392. .clipboard {
  393. width: 84rpx;
  394. height: 36rpx;
  395. background: linear-gradient(34deg, rgba(255, 41, 41, 1) 0%, rgba(255, 109, 27, 1) 100%);
  396. text-align: center;
  397. font-size: $font-size-24;
  398. color: #ffffff;
  399. border-radius: 6rpx;
  400. line-height: 36rpx;
  401. display: inline-block;
  402. margin-left: 24rpx;
  403. position: relative;
  404. z-index: 99;
  405. }
  406. }
  407. }
  408. </style>