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