order-logistics.vue 10 KB

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