order-logistics.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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. console.log(option)
  76. //商品数据
  77. this.orderID = option.orderID;
  78. this.getData();
  79. },
  80. methods: {
  81. navToListPage(id){
  82. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  83. },
  84. showlogistics(index,loIndex){
  85. let getGoodsList = this.goodsList[index],
  86. isOpen = getGoodsList.logisticsData[loIndex]['isOpen'];
  87. this.goodsList[index].logisticsData[loIndex]['isOpen'] = !isOpen;
  88. },
  89. clipboard(data) {
  90. thorui.getClipboardData(data, (res) => {
  91. // #ifdef H5
  92. if (res) {
  93. this.$util.msg("复制成功",3000);
  94. } else {
  95. this.$util.msg("复制失败",3000);
  96. }
  97. // #endif
  98. })
  99. },
  100. getData() {
  101. 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: loItem['updateDate'],
  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(response =>{
  164. this.$util.msg(response.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: 24rpx;
  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. image{
  202. width: 48rpx;
  203. height: 48rpx;
  204. }
  205. }
  206. .title-text{
  207. float: left;
  208. margin-left: 16rpx;
  209. font-size: $font-size-28;
  210. color: $text-color;
  211. text-align: left;
  212. line-height: 48rpx;
  213. font-weight: bold;
  214. }
  215. }
  216. .goods-item{
  217. width: 100%;
  218. height: auto;
  219. }
  220. .goods-pros-t{
  221. display: flex;
  222. align-items: center;
  223. width: 100%;
  224. height: 217rpx;
  225. padding:12rpx 0;
  226. .pros-img{
  227. width: 210rpx;
  228. height: 100%;
  229. border-radius: 10rpx;
  230. margin:0 26rpx 0 0;
  231. border:1px solid #f3f3f3;
  232. image{
  233. width: 100%;
  234. height: 100%;
  235. border-radius: 10rpx;
  236. }
  237. }
  238. }
  239. .pros-product{
  240. width: 468rpx;
  241. height: 100%;
  242. line-height: 36rpx;
  243. font-size: $font-size-26;
  244. position: relative;
  245. .producttitle{
  246. width: 100%;
  247. display: inline-block;
  248. height: auto;
  249. text-overflow:ellipsis;
  250. display: -webkit-box;
  251. word-break: break-all;
  252. -webkit-box-orient: vertical;
  253. -webkit-line-clamp: 2;
  254. overflow: hidden;
  255. margin-bottom: 58rpx;
  256. }
  257. .productspec{
  258. height: 36rpx;
  259. color: $text-color;
  260. line-height: 36rpx;
  261. font-size: $font-size-26;
  262. }
  263. }
  264. }
  265. }
  266. .logistics-template{
  267. width: 702rpx;
  268. height: 100%;
  269. background: #FFFFFF;
  270. float: left;
  271. padding: 24rpx 24rpx 12rpx 24rpx;
  272. .logistics-content{
  273. width: 100%;
  274. padding: 20rpx 0;
  275. height: auto;
  276. .arrow-showMore {
  277. position: absolute;
  278. right: 24rpx;
  279. z-index: 99;
  280. }
  281. .logistics-top{
  282. width: 100%;
  283. height: 40rpx;
  284. line-height: 40rpx;
  285. font-size: $font-size-28;
  286. color: $text-color;
  287. text-align: left;
  288. padding-bottom: 24rpx;
  289. border-bottom: 1px solid #F8F8F8;
  290. .name{
  291. float: left;
  292. font-weight: bold;
  293. }
  294. .icon-web_xiangxiazhankai{
  295. transform: rotate(0deg);
  296. transform-origin: center center;
  297. float: right;
  298. font-size: $font-size-32;
  299. color: #000000;
  300. /* transition: transform 0.3s ease;*/
  301. transition-property: transform;
  302. transition-duration: 0.3s;
  303. transition-timing-function: ease;
  304. }
  305. .icon-web_xiangxiazhankai-active{
  306. transform: rotate(180deg);
  307. }
  308. }
  309. .logistics-warp{
  310. width: 100%;
  311. overflow: hidden;
  312. .table{
  313. height: 76rpx;
  314. line-height: 76rpx;
  315. font-size: $font-size-26;
  316. color: $text-color;
  317. text-align: left;
  318. }
  319. .expressNumber {
  320. width: 250rpx;
  321. display: inline-block;
  322. }
  323. }
  324. .logistics-main-top{
  325. width: 100%;
  326. height: auto;
  327. float: left;
  328. padding-top: 24rpx;
  329. .main-top,.main-bot{
  330. font-size: $font-size-28;
  331. color: $text-color;
  332. line-height: 40rpx;
  333. margin: 4rpx 0;
  334. }
  335. }
  336. .logistics-main-bot{
  337. width: 100%;
  338. height: auto;
  339. font-size: $font-size-24;
  340. color: $text-color;
  341. line-height: 56rpx;
  342. text-align: justify;
  343. }
  344. .logistics-animation {
  345. /* transition: transform 0.3s ease;*/
  346. transition-property: transform;
  347. transition-duration: 0.3s;
  348. transition-timing-function: ease;
  349. }
  350. .logistics-warp__wrapper{
  351. /* #ifndef APP-NVUE */
  352. display: flex;
  353. /* #endif */
  354. flex-direction: column;
  355. }
  356. .logistics-warp--hide {
  357. // padding: 0 0;
  358. // height: 0px;
  359. // line-height: 0px;
  360. display: none;
  361. }
  362. .clipboard{
  363. width: 84rpx;
  364. height: 36rpx;
  365. background: linear-gradient(34deg,rgba(255,41,41,1) 0%,rgba(255,109,27,1) 100%);
  366. text-align: center;
  367. font-size: $font-size-24;
  368. color: #FFFFFF;
  369. border-radius: 6rpx;
  370. line-height: 36rpx;
  371. display: inline-block;
  372. margin-left: 24rpx;
  373. position: relative;
  374. z-index: 99;
  375. }
  376. }
  377. }
  378. </style>