order-logistics.vue 10 KB

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