order-logistics.vue 10 KB

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