order-logistics.vue 10 KB

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