order-logistics.vue 10 KB

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