logisticsProgress.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <view class="page">
  3. <view class="top-detail" v-if="packageList.length > 0">
  4. <view
  5. class="title"
  6. :style="currentSchedule == '发往仓库' ? 'color:#222222' : ''"
  7. >
  8. 发往仓库
  9. </view>
  10. <image
  11. class="arrow"
  12. src="../../static/mine/339.png"
  13. v-if="currentSchedule == '发往仓库'"
  14. mode=""
  15. ></image>
  16. <image
  17. class="arrow"
  18. src="../../static/mine/340.png"
  19. v-else
  20. mode=""
  21. ></image>
  22. <view
  23. class="title"
  24. :style="currentSchedule == '仓库打包' ? 'color:#222222' : ''"
  25. >
  26. 仓库打包
  27. </view>
  28. <image
  29. class="arrow"
  30. src="../../static/mine/339.png"
  31. v-if="currentSchedule == '发往国际'"
  32. mode=""
  33. ></image>
  34. <image
  35. class="arrow"
  36. src="../../static/mine/340.png"
  37. v-else
  38. mode=""
  39. ></image>
  40. <view
  41. class="title"
  42. :style="currentSchedule == '发往国际' ? 'color:#222222' : ''"
  43. >
  44. 洛杉矶
  45. </view>
  46. </view>
  47. <view class="logistics" v-if="packageList.length > 0">
  48. <view class="package">
  49. <view class="package-title">您的订单已被分成以下包裹发出:</view>
  50. <view class="package-list">
  51. <view
  52. class="package-content"
  53. v-for="(item, index) in packageList"
  54. :key="item.id"
  55. @click="checkPackageDetail(item)"
  56. :class="{ 'select-package': item.id == packageId }"
  57. ><image
  58. class="package-img"
  59. src="../../static/mine/356.png"
  60. mode="scaleToFill"
  61. v-if="packageId == item.id"
  62. />
  63. <image
  64. src="../../static/mine/357.png"
  65. mode="scaleToFill"
  66. class="package-img"
  67. v-if="packageId != item.id"
  68. />
  69. <view>
  70. <view class="title-first"
  71. >包裹{{ numToUpperCase(index + 1) }}</view
  72. ><view class="title-last">{{ item.status }}</view>
  73. </view></view
  74. >
  75. </view>
  76. </view>
  77. <!--
  78. <view class="warehouse-packaging" v-if="warehouse.length > 0">
  79. <Progress :logisticsList="warehouse" />
  80. </view>
  81. <view class="_detail-1">
  82. <text>已于11月24日送至平台仓库</text>
  83. <u-icon
  84. @click="putItAway"
  85. name="arrow-up"
  86. color="#666666"
  87. size="18"
  88. v-if="isShow"
  89. ></u-icon>
  90. <u-icon
  91. @click="putItAway"
  92. name="arrow-down"
  93. color="#666666"
  94. size="18"
  95. v-else
  96. ></u-icon>
  97. </view> -->
  98. <view class="logistics-detail" v-if="isShow">
  99. <view class="">
  100. {{ logisticsName + "&nbsp;" + "|" + "&nbsp" + "订单号:" }}
  101. <text>{{ orderNumber }}</text>
  102. </view>
  103. <view class="phone">
  104. <text @click="cope(orderNumber)">复制</text>
  105. {{ "&nbsp;" + "|" + "&nbsp" }}
  106. <text @click="makeCall">打电话</text>
  107. </view>
  108. </view>
  109. <view class="logistics-information" v-if="isShow">
  110. <Progress :logisticsList="logisticsList" />
  111. </view>
  112. </view>
  113. <view v-else class="no-content"> 暂未查询到物流包裹 </view>
  114. </view>
  115. </template>
  116. <script>
  117. import Progress from "./component/progress.vue";
  118. export default {
  119. components: {
  120. Progress,
  121. },
  122. data() {
  123. return {
  124. packageList: [], //包裹列表
  125. logisticsList: [],
  126. warehouse: [
  127. {
  128. title: "打包称重",
  129. time: "10:11",
  130. status: true,
  131. imageUrl: true,
  132. does: "商品已打包称重,待用户付款",
  133. },
  134. {
  135. title: "商品入库",
  136. time: "10:11",
  137. status: false,
  138. imageUrl: false,
  139. does: "商品已进入转入仓库,正在排队等待打包",
  140. },
  141. ],
  142. isShow: true,
  143. packageNum: 0, //包裹个数
  144. packageId: "", //包裹id
  145. logisticsName: "", //物流公司名称
  146. orderNumber: "", //订单编号
  147. currentSchedule: "", //物流当前进度
  148. };
  149. },
  150. onLoad(options) {
  151. this.packageNum = options.package;
  152. this.getPackageList(options.source_type, options.source_id);
  153. this.orderNumber = options.orderNumber;
  154. this.orderCurrentSchedule(options.orderStatus);
  155. },
  156. methods: {
  157. cope(str) {
  158. uni.setClipboardData({
  159. data: str,
  160. success() {
  161. uni.showToast({
  162. title: "复制成功",
  163. icon: "none",
  164. });
  165. },
  166. });
  167. },
  168. //拨打电话
  169. makeCall() {
  170. uni.makePhoneCall({
  171. phoneNumber: "15550996275",
  172. success: () => {
  173. console.log("拨打电话成功!");
  174. },
  175. fail: () => {
  176. console.error("授权失败,请允许拨打电话权限!");
  177. },
  178. });
  179. },
  180. //订单当前进度
  181. orderCurrentSchedule(type) {
  182. if (
  183. type == "group_unpaid" ||
  184. type == "packaging" ||
  185. type == "imperfect" ||
  186. type == "domestic_undelivered" ||
  187. type == "domestic_delivered"
  188. ) {
  189. this.currentSchedule = "发往仓库";
  190. } else if (
  191. type == "domestic_received" ||
  192. type == "unpaid" ||
  193. type == "overseas_undelivered"
  194. ) {
  195. this.currentSchedule = "仓库打包";
  196. } else {
  197. this.currentSchedule = "发往国际";
  198. }
  199. },
  200. putItAway() {
  201. this.isShow = !this.isShow;
  202. },
  203. getPackageList(type, id) {
  204. uni.$u.http
  205. .get(`/api/express-order/logistic?source_type=${type}&source_id=${id}`)
  206. .then((res) => {
  207. if (res.length > 0) {
  208. this.packageId = res[0].id;
  209. this.getLogisticsStep(res[0]);
  210. this.logisticsName = res[0].logistics_company_name;
  211. } else {
  212. uni.showToast({
  213. title: "暂未查询到物流包裹",
  214. icon: "none",
  215. });
  216. }
  217. this.packageList = res;
  218. });
  219. },
  220. //数字转化大写
  221. numToUpperCase(num) {
  222. const digits = [
  223. "零",
  224. "一",
  225. "二",
  226. "三",
  227. "四",
  228. "五",
  229. "六",
  230. "七",
  231. "八",
  232. "九",
  233. ];
  234. return digits[num];
  235. },
  236. //查看物流
  237. checkPackageDetail(item) {
  238. this.packageId = item.id;
  239. this.getLogisticsStep(item);
  240. this.logisticsName = item.logistics_company_name;
  241. },
  242. //查询物流步骤
  243. getLogisticsStep(item) {
  244. uni.$u.http
  245. .get(
  246. `/api/express-order/logistic-trace?order_logistic_id=${item.id}&is_page=0`
  247. )
  248. .then((res) => {
  249. this.logisticsList = res;
  250. });
  251. },
  252. },
  253. created() {
  254. uni.setNavigationBarTitle({
  255. title: "物流进度",
  256. });
  257. },
  258. };
  259. </script>
  260. <style scoped lang="scss">
  261. .page {
  262. padding: 20rpx 24rpx;
  263. .top-detail {
  264. display: flex;
  265. justify-content: space-around;
  266. align-items: center;
  267. height: 144rpx;
  268. background: linear-gradient(180deg, #f6e1de 0%, #efefef 100%);
  269. border-radius: 16rpx 16rpx 0 0;
  270. .title {
  271. color: rgba(34, 34, 34, 0.6);
  272. font-size: 32rpx;
  273. }
  274. .arrow {
  275. width: 98rpx;
  276. height: 8rpx;
  277. }
  278. }
  279. .no-content {
  280. text-align: center;
  281. line-height: 100rpx;
  282. font-size: 26rpx;
  283. color: #c1c1c1;
  284. }
  285. .logistics {
  286. background-color: #fff;
  287. border-radius: 16rpx;
  288. padding: 20rpx 20rpx;
  289. position: relative;
  290. top: -20rpx;
  291. .package {
  292. .package-title {
  293. font-size: 24rpx;
  294. color: #222222;
  295. }
  296. .package-list {
  297. display: flex;
  298. margin-top: 20rpx;
  299. .select-package {
  300. border-color: #ff1515 !important;
  301. color: #ff1515 !important;
  302. }
  303. .package-content {
  304. width: 172rpx;
  305. height: 88rpx;
  306. border-radius: 12rpx;
  307. border: 2rpx solid #c1c1c1;
  308. display: flex;
  309. align-items: center;
  310. justify-content: space-around;
  311. margin-right: 20rpx;
  312. .package-img {
  313. width: 36rpx;
  314. height: 36rpx;
  315. }
  316. .title-first {
  317. font-size: 26rpx;
  318. font-weight: 600;
  319. // color: #ff1515;
  320. }
  321. .title-last {
  322. font-size: 20rpx;
  323. // color: #ff1515;
  324. }
  325. }
  326. }
  327. }
  328. ._detail-1 {
  329. display: flex;
  330. justify-content: space-between;
  331. font-size: 28rpx;
  332. color: #666;
  333. align-items: center;
  334. border-top: 2rpx solid rgba(151, 151, 151, 0.1);
  335. padding-top: 28rpx;
  336. }
  337. .logistics-detail {
  338. display: flex;
  339. justify-content: space-between;
  340. font-size: 26rpx;
  341. color: #333;
  342. height: 104rpx;
  343. align-items: center;
  344. border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
  345. }
  346. .logistics-information {
  347. padding: 20rpx 0;
  348. .information {
  349. position: relative;
  350. }
  351. }
  352. }
  353. }
  354. </style>