logisticsNew.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <view class="container">
  3. <!-- 包裹选项卡 -->
  4. <view class="packAge" v-if="packAgeList.length">
  5. <scroll-view scroll-X="true" class="packAge-scoll">
  6. <view
  7. class="every"
  8. :class="[
  9. currentIndex == index ? 'activeTab' : '',
  10. packAgeList.length == 1 ? 'one' : '',
  11. ]"
  12. v-for="(item, index) in packAgeList"
  13. :key="index"
  14. @click="changeTab(item, index)"
  15. >
  16. 包裹{{ index + 1 }}
  17. </view>
  18. </scroll-view>
  19. </view>
  20. <!-- 商品信息 -->
  21. <view class="goods">
  22. <view class="title"> 商品信息 </view>
  23. <view
  24. class="goods-box"
  25. v-for="(item, index) in detail.packageItems || []"
  26. :key="index"
  27. >
  28. <view class="goods-img">
  29. <image :src="item.productCover" mode="aspectFill"></image>
  30. </view>
  31. <view class="goods-info">
  32. <view class="label">{{ item.productTitle }}</view>
  33. <view class="box sku-box">
  34. <view class="sku">
  35. {{ item.skuSetName }}
  36. </view>
  37. <!-- <view class="sku num"> x {{ item.number }} </view> -->
  38. </view>
  39. <view class="box">
  40. <view class="u-FFF u-font36 priceColor">
  41. <!-- <rich-text
  42. :nodes="$mUtil.priceBigSmall(item.sale_price)"
  43. ></rich-text> -->
  44. </view>
  45. <view class="number"> 发货数量 x {{ item.number }} </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 物流信息 -->
  51. <view class="logistics" v-if="detail.packageExpressVo">
  52. <view class="title"> 物流信息 </view>
  53. <view class="box">
  54. <text>物流公司:</text>
  55. <text>{{ detail.packageExpressVo.expressName }}</text>
  56. </view>
  57. <view class="box">
  58. <text>物流单号:</text>
  59. <text>{{ detail.packageExpressVo.logisticCode }}</text>
  60. </view>
  61. </view>
  62. <!-- 物流记录 -->
  63. <view class="">
  64. <view class="record"> 物流记录 </view>
  65. <view class="shipping u-bg-fff">
  66. <view class="ul u-plr30" v-for="(item, index) in shiplist" :key="index">
  67. <view class="li">
  68. <view class="mmmm">
  69. <view
  70. class="yuan"
  71. :class="[
  72. index == 0 ? 'act' : '',
  73. index == shiplist.length - 1 ? 'end' : '',
  74. ]"
  75. >
  76. </view>
  77. </view>
  78. <view class="desc">
  79. <view class="u-font26 u-1A1A1A">{{ item.acceptStation }}</view>
  80. <view class="u-999 u-font24 u-mt10">{{ item.acceptTime }}</view>
  81. </view>
  82. </view>
  83. </view>
  84. <noData
  85. v-if="shiplist.length == 0"
  86. :config="{ top: 20, content: '暂无物流数据~' }"
  87. ></noData>
  88. </view>
  89. </view>
  90. <view class="floatBottom" v-if="detail.packageStatus == 0">
  91. <button class="u-btn-two u-br-f00 u-FF0000" @click="sureGetOrder">
  92. 确认收货
  93. </button>
  94. </view>
  95. </view>
  96. </template>
  97. <script setup>
  98. import { ref } from "vue";
  99. import { onLoad } from "@dcloudio/uni-app";
  100. import {
  101. shopOrderList_Api,
  102. selectExpress_Api,
  103. receiptPackage_Api,
  104. } from "@/api/order";
  105. const shiplist = ref([]);
  106. const packAgeList = ref([]);
  107. const currentIndex = ref(0);
  108. const detail = ref({});
  109. // 包裹列表
  110. const getPackAge = (orderId, index = 0) => {
  111. shopOrderList_Api(orderId).then((res) => {
  112. if (res.code === 200) {
  113. packAgeList.value = res.data;
  114. if (index != null) detail.value = packAgeList.value[index];
  115. getLogistiscs(detail.value.packageId);
  116. }
  117. });
  118. };
  119. // 包裹切换
  120. const changeTab = (item, index) => {
  121. if (currentIndex.value == index) {
  122. return false;
  123. }
  124. currentIndex.value = index;
  125. detail.value = packAgeList.value[index];
  126. getLogistiscs(detail.value.packageId);
  127. };
  128. // 物流信息
  129. const getLogistiscs = (packageId) => {
  130. selectExpress_Api(packageId).then((res) => {
  131. if (res && res.code == 200 && res.data.traces) {
  132. shiplist.value = res.data.traces.reverse();
  133. }
  134. });
  135. };
  136. const sureGetOrder = () => {
  137. uni.showModal({
  138. title: "是否确认收货?",
  139. content: "该包裹确认收货后,将无法撤销",
  140. success: (res) => {
  141. if (res.confirm) {
  142. console.log("用户点击确定");
  143. uni.showLoading({
  144. title: "加载中",
  145. mask: true,
  146. });
  147. receiptPackage_Api({
  148. orderId: detail.value.orderId,
  149. packageId: detail.value.packageId,
  150. })
  151. .then((res) => {
  152. uni.hideLoading();
  153. if (res && res.code == 200) {
  154. uni.showToast({
  155. title: "确认收货成功",
  156. icon: "success",
  157. });
  158. setTimeout(() => {
  159. getPackAge(detail.value.orderId, currentIndex.value);
  160. }, 500);
  161. }
  162. })
  163. .catch((err) => {
  164. // uni.hideLoading();
  165. });
  166. } else if (res.cancel) {
  167. console.log("用户点击取消");
  168. }
  169. },
  170. });
  171. };
  172. onLoad((options) => {
  173. if (options.id) {
  174. currentIndex.value = options.index;
  175. getPackAge(options.id, options.index);
  176. }
  177. });
  178. </script>
  179. <style lang="scss">
  180. .container {
  181. padding-bottom: 170rpx;
  182. }
  183. // 包裹选项卡
  184. .packAge {
  185. width: 100%;
  186. height: 100rpx;
  187. // margin-bottom: 20rpx;
  188. padding-left: 30rpx;
  189. line-height: 100rpx;
  190. background-color: #fff;
  191. .packAge-scoll {
  192. width: 100%;
  193. height: 100%;
  194. white-space: nowrap;
  195. }
  196. .every {
  197. display: inline-block;
  198. width: 180rpx;
  199. height: 60rpx;
  200. line-height: 60rpx;
  201. text-align: center;
  202. border: 1rpx solid #fa6138;
  203. border-right: none;
  204. // border-radius: 10rpx;
  205. &:first-child {
  206. border-right: none;
  207. border-radius: 10rpx 0 0 10rpx;
  208. }
  209. &:last-child {
  210. border-right: 1rpx solid #fa6138;
  211. border-radius: 0 10rpx 10rpx 0;
  212. }
  213. image {
  214. width: 30rpx;
  215. height: 30rpx;
  216. margin-right: 20rpx;
  217. vertical-align: middle;
  218. }
  219. }
  220. .activeTab {
  221. background-color: #fa6138;
  222. color: #fff;
  223. }
  224. .one {
  225. &:first-child {
  226. border-radius: 10rpx;
  227. }
  228. }
  229. }
  230. .goods {
  231. padding: 30rpx;
  232. padding-bottom: 10rpx;
  233. background-color: #fff;
  234. .goods-box {
  235. display: flex;
  236. padding: 30rpx 0;
  237. border-bottom: 1rpx solid #f2f2f2;
  238. .goods-img {
  239. width: 150rpx;
  240. height: 150rpx;
  241. margin-right: 20rpx;
  242. border-radius: 20rpx;
  243. flex-shrink: 0;
  244. overflow: hidden;
  245. image {
  246. width: 100%;
  247. height: 100%;
  248. }
  249. }
  250. .goods-info {
  251. flex: 1;
  252. width: 0;
  253. .label {
  254. overflow: hidden;
  255. text-overflow: ellipsis;
  256. white-space: nowrap;
  257. color: #1a1a1a;
  258. margin-bottom: 10rpx;
  259. }
  260. .box {
  261. display: flex;
  262. align-items: center;
  263. justify-content: space-between;
  264. .sku {
  265. font-size: 22rpx;
  266. color: #999;
  267. margin-right: 10rpx;
  268. overflow: hidden;
  269. text-overflow: ellipsis;
  270. white-space: nowrap;
  271. }
  272. .priceColor {
  273. color: #fa6138;
  274. font-weight: bold;
  275. }
  276. .num {
  277. flex-shrink: 0;
  278. }
  279. .number {
  280. font-size: 22rpx;
  281. flex-shrink: 0;
  282. }
  283. }
  284. .sku-box {
  285. margin-bottom: 20rpx;
  286. }
  287. }
  288. }
  289. }
  290. .title {
  291. font-size: 30rpx;
  292. font-weight: bold;
  293. margin-bottom: 20rpx;
  294. }
  295. .logistics {
  296. padding: 30rpx;
  297. padding-bottom: 10rpx;
  298. background-color: #fff;
  299. .box {
  300. padding-left: 30rpx;
  301. margin-bottom: 20rpx;
  302. &:last-child {
  303. margin-bottom: 0;
  304. }
  305. }
  306. }
  307. .record {
  308. padding: 30rpx;
  309. padding-bottom: 10rpx;
  310. font-size: 30rpx;
  311. font-weight: bold;
  312. background-color: #fff;
  313. }
  314. .shipping {
  315. width: 100%;
  316. margin: 0 auto;
  317. background-color: #ffffff;
  318. .linehh {
  319. position: absolute;
  320. width: 2rpx;
  321. margin-left: 16rpx;
  322. border-left: 2rpx dotted #bec2cb;
  323. }
  324. .ul {
  325. .li {
  326. width: 100%;
  327. display: flex;
  328. height: auto;
  329. margin-top: 2rpx;
  330. .state {
  331. padding: 20rpx 0rpx;
  332. &.act {
  333. color: #fa6138;
  334. }
  335. .timeday {
  336. font-size: 28upx;
  337. }
  338. .timeh {
  339. font-size: 24upx;
  340. }
  341. }
  342. .mmmm {
  343. position: relative;
  344. display: flex;
  345. padding: 0rpx 32rpx 0rpx 36rpx;
  346. margin-top: 22rpx;
  347. .yuan {
  348. position: absolute;
  349. left: 26rpx;
  350. width: 25rpx;
  351. height: 25rpx;
  352. background: #dedede;
  353. border-radius: 50%;
  354. border: 3rpx solid #f2f2f2;
  355. &.act {
  356. background-color: #fa6138;
  357. width: 44rpx;
  358. height: 44rpx;
  359. margin-left: -10rpx;
  360. }
  361. }
  362. }
  363. .desc {
  364. width: 74%;
  365. padding: 20rpx 0rpx;
  366. margin-left: 22rpx;
  367. }
  368. }
  369. }
  370. &:deep(.no-data-view) {
  371. margin-top: 0 !important;
  372. }
  373. }
  374. .floatBottom {
  375. width: 750rpx;
  376. background: #ffffff;
  377. padding: 30rpx;
  378. position: fixed;
  379. bottom: 0;
  380. left: 0;
  381. box-sizing: border-box;
  382. }
  383. </style>