order-logistics.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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 logisticsRecord from '@/components/module/orderDetails/logisticsRecord'//物流信息
  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. let self = this;
  102. self.$api.get('/order/logistics', {orderID: self.orderID},
  103. response => {
  104. const code = response.code;
  105. if(code == 1) {
  106. const resData = response.data;
  107. // 添加订单列表信息
  108. let orderListArr = [];
  109. resData.forEach((item,index) => {
  110. let logisticsArr = [],
  111. companyList = [],
  112. shopOrderList = item.shopOrderList,
  113. logisticsInfos = item.logisticsInfos;
  114. // 添加物流信息
  115. if(logisticsInfos.length > 0) {
  116. logisticsInfos.forEach((loItem,loIndex) => {
  117. let newRouters = [];
  118. logisticsArr.push({
  119. expressname: loItem['logisticsCompanyName'],
  120. expressNumber: loItem['nu'],
  121. expressNewtime: loItem['deliveryTime'],
  122. isOpen: false
  123. })
  124. if(loIndex == 0) {
  125. logisticsArr[loIndex]['isOpen'] = true;
  126. }
  127. if(loItem.routers) {
  128. loItem.routers.forEach((rItem,rIndex) => {
  129. newRouters.push({
  130. desc: rItem.desc,
  131. time: self.$api.timestampToTime(rItem.time)
  132. })
  133. })
  134. logisticsArr[loIndex]['expressRecord'] = [...newRouters];
  135. } else {
  136. logisticsArr[loIndex]['expressRecord'] = [];
  137. }
  138. })
  139. }
  140. // 供应商信息
  141. shopOrderList.forEach((shopItem,shopIndex) => {
  142. let prosListArr = [],
  143. cmLogisticsRecords = shopItem.cmLogisticsRecords;
  144. // 商品信息
  145. cmLogisticsRecords.forEach((prosItem,prosIndex) => {
  146. prosListArr.push({
  147. id: prosItem.organizeProductID,
  148. name: prosItem.productName,
  149. mainImage: prosItem.image,
  150. number: prosItem.buyNum,
  151. logNumber: prosItem.num
  152. })
  153. })
  154. companyList.push({
  155. shopLogo: shopItem.shopLogo,
  156. name: shopItem.shopName,
  157. showGoods: cmLogisticsRecords.length > 0,
  158. productsList: [...prosListArr]
  159. })
  160. })
  161. orderListArr.push({
  162. logisticsData: [...logisticsArr],
  163. companyList: [...companyList]
  164. })
  165. })
  166. self.goodsList = [...orderListArr];
  167. } else {
  168. uni.showToast({
  169. icon: 'none',
  170. title: '网络错误,请稍后重试。',
  171. duration: 3000
  172. })
  173. }
  174. }
  175. )
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="scss">
  181. page {
  182. height: auto;
  183. }
  184. .logistics-container{
  185. width: 100%;
  186. height: auto;
  187. float: left;
  188. background:#F7F7F7;
  189. border-top: 1px solid #F8F8F8;
  190. .logistics-batch {
  191. display: flex;
  192. flex-direction: column;
  193. margin-bottom: 24rpx;
  194. }
  195. .order-item{
  196. width: 702rpx;
  197. padding: 24rpx 24rpx 12rpx 24rpx;
  198. height: auto;
  199. float: left;
  200. background: #FFFFFF;
  201. margin-bottom: 24rpx;
  202. .goods-title{
  203. width: 100%;
  204. height: 48rpx;
  205. float: left;
  206. margin-bottom: 12rpx;
  207. .title-logo{
  208. width: 48rpx;
  209. height: 48rpx;
  210. float: left;
  211. image{
  212. width: 48rpx;
  213. height: 48rpx;
  214. }
  215. }
  216. .title-text{
  217. float: left;
  218. margin-left: 16rpx;
  219. font-size: $font-size-28;
  220. color: $text-color;
  221. text-align: left;
  222. line-height: 48rpx;
  223. font-weight: bold;
  224. }
  225. }
  226. .goods-item{
  227. width: 100%;
  228. height: auto;
  229. }
  230. .goods-pros-t{
  231. display: flex;
  232. align-items: center;
  233. width: 100%;
  234. height: 217rpx;
  235. padding:12rpx 0;
  236. .pros-img{
  237. width: 210rpx;
  238. height: 100%;
  239. border-radius: 10rpx;
  240. margin:0 26rpx 0 0;
  241. border:1px solid #f3f3f3;
  242. image{
  243. width: 100%;
  244. height: 100%;
  245. border-radius: 10rpx;
  246. }
  247. }
  248. }
  249. .pros-product{
  250. width: 468rpx;
  251. height: 100%;
  252. line-height: 36rpx;
  253. font-size: $font-size-26;
  254. position: relative;
  255. .producttitle{
  256. width: 100%;
  257. display: inline-block;
  258. height: auto;
  259. text-overflow:ellipsis;
  260. display: -webkit-box;
  261. word-break: break-all;
  262. -webkit-box-orient: vertical;
  263. -webkit-line-clamp: 2;
  264. overflow: hidden;
  265. margin-bottom: 58rpx;
  266. }
  267. .productspec{
  268. height: 36rpx;
  269. color: $text-color;
  270. line-height: 36rpx;
  271. font-size: $font-size-26;
  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. }
  354. .logistics-animation {
  355. /* transition: transform 0.3s ease;*/
  356. transition-property: transform;
  357. transition-duration: 0.3s;
  358. transition-timing-function: ease;
  359. }
  360. .logistics-warp__wrapper{
  361. /* #ifndef APP-NVUE */
  362. display: flex;
  363. /* #endif */
  364. flex-direction: column;
  365. }
  366. .logistics-warp--hide {
  367. // padding: 0 0;
  368. // height: 0px;
  369. // line-height: 0px;
  370. display: none;
  371. }
  372. .clipboard{
  373. width: 84rpx;
  374. height: 36rpx;
  375. background: linear-gradient(34deg,rgba(255,41,41,1) 0%,rgba(255,109,27,1) 100%);
  376. text-align: center;
  377. font-size: $font-size-24;
  378. color: #FFFFFF;
  379. border-radius: 6rpx;
  380. line-height: 36rpx;
  381. display: inline-block;
  382. margin-left: 24rpx;
  383. position: relative;
  384. z-index: 99;
  385. }
  386. }
  387. }
  388. </style>