IndexView.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <view class="IndexView">
  3. <view class="selectExpress">
  4. <view class="selectInput">
  5. <image src="../image/sousuo.png" mode=""></image>
  6. <input v-model="expressId" type="text" placeholder="请输入订单编号">
  7. <image src="../image/saoma.png" mode=""></image>
  8. </view>
  9. <view class="ExpressOptions">
  10. <view class="optItem" @click="runToExpress('/pages_user/serve/kuai-di/DeliveryExpress')">
  11. <image src="../image/delTask_slt.png" mode=""></image>
  12. <p>寄快递</p>
  13. </view>
  14. <view class="optItem" @click="runToExpress()">
  15. <image src="../image/piliangjijian.png" mode=""></image>
  16. <p>寄大件</p>
  17. </view>
  18. <view class="optItem" @click="runToExpress()">
  19. <image src="../image/qingdanxiang.png" mode=""></image>
  20. <p>批量寄件</p>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="ExpressView">
  25. <view class="viewHeader">
  26. <span>合作快递公司</span> <span></span>
  27. </view>
  28. <view>
  29. <scroll-view class="ExpressSelection" scroll-x="true">
  30. <view v-for="(item, index) in ECList" class="SelectionItem">
  31. <view class="icfonts">
  32. <image :src="item.imgUrl" mode=""></image> <span>{{ item.name }}</span>
  33. </view>
  34. <!-- <view class="NewMoney">
  35. <span>5.5</span>元起
  36. </view>
  37. <view class="OldMoney">
  38. 市场价:<span>10</span> 元
  39. </view>
  40. <button class="goSend">去寄件</button> -->
  41. </view>
  42. </scroll-view>
  43. </view>
  44. <view class="ExpressRecord">
  45. <view class="viewHeader" :class="{ 'sticky-fixed': isFixed }">
  46. <span>我的快递</span> <span></span>
  47. </view>
  48. <scroll-view v-if="myExpressData.records.length > 0" class="RecordList" scroll-y>
  49. <view v-for="(item, index) in myExpressData.records" :key="item.sn" class="RecordItem">
  50. <image :src="item.imgUrl" mode=""></image>
  51. <span>订单编号:{{ item.sn }}</span>
  52. <button v-if="item.status == 4" type="primary" class="ExpressDetails" @click="ViewDetails(item)">查看详情</button>
  53. <button v-else-if="item.status == 3" type="primary" class="ExpressDetails gray">已取消</button>
  54. <button v-else-if="item.status == 2" type="primary" class="ExpressDetails gray">受理失败</button>
  55. <!-- <button type="warn" class="ExpressDetails" @click="CancelOrder(item)" v-else-if="item.status == 1 || item.status == 0">取消订单</button> -->
  56. <button
  57. v-else-if="(item.status == 1 || item.status == 0) && item.resp" type="warn" class="ExpressDetails"
  58. @click="CancelOrder(item)"
  59. >
  60. 取消订单
  61. </button>
  62. <button v-else type="warn" class="ExpressDetails">订单异常</button>
  63. </view>
  64. </scroll-view>
  65. <view v-else class="noRecordData">
  66. <image src="../image/kongkongruye.png" mode=""></image>
  67. <p>没有您最近的查件记录哦</p>
  68. <p>仅保留最近两个星期的历史记录!!</p>
  69. </view>
  70. </view>
  71. </view>
  72. <TuiModal :show="modal" custom @click="handleClick" @cancel="hideModal">
  73. <text
  74. style="font-size: 36rpx; font-weight: 600;width: 100%;display: inline-block; text-align: center;"
  75. >
  76. 取消退款原因
  77. </text>
  78. <TuiInput v-model="cancelMsg" placeholder="请输入退款原因"></TuiInput>
  79. <view class="cacelBtn">
  80. <TuiButton width="200rpx" height="70rpx" type="danger" @click="hideModal">取消</TuiButton>
  81. <TuiButton width="200rpx" height="70rpx" type="primary" @click="handleClick">确认</TuiButton>
  82. </view>
  83. </TuiModal>
  84. </view>
  85. </template>
  86. <script>
  87. import tuiButton from '@/components/thorui/tui-button/tui-button.vue'
  88. import tuiInput from '@/components/thorui/tui-input/tui-input.vue'
  89. import tuiModal from '@/components/thorui/tui-modal/tui-modal.vue'
  90. import {
  91. getBianminRecordKuaidiApi, // 查询我个人寄快递的记录
  92. // getKuaiDiRecordMsg, // 快递状态详情
  93. getKuaidi100ComApi, // 获取可使用快递公司编码
  94. // getKuaidi100PriceApi, // C端寄件下单-价格查询
  95. // addKuaidi100CorderApi, // C端寄件下单
  96. orderCancelApi // C端寄件下单-取消
  97. } from '@/api/convenient-services'
  98. export default {
  99. components: {
  100. TuiModal: tuiModal,
  101. TuiInput: tuiInput,
  102. TuiButton: tuiButton
  103. },
  104. props: {
  105. ECList: {
  106. type: [Object, Array],
  107. default: null
  108. },
  109. isFixed: {
  110. type: Boolean,
  111. default: false
  112. }
  113. },
  114. data() {
  115. return {
  116. modal: false,
  117. cancelMsg: '',
  118. expressId: '',
  119. myExpressData: {
  120. records: []
  121. },
  122. queryList: {
  123. page: 1,
  124. size: 10,
  125. type: 1
  126. },
  127. dataLength: 0,
  128. CancelOrderParams: {}
  129. }
  130. },
  131. created() {
  132. this.getMyExpressList()
  133. // getKuaidi100ComApi().then(res => { // 该方法用来获取可以邮寄的公司,但是由于数据较少,且没有相对应的图片传输过来,因此暂时写死,业务拓展时再做更改
  134. // console.log(res.data)
  135. // const Array = [];
  136. // for(let key in res.data) {
  137. // Array.push({name: res.data[key], key: key})
  138. // }
  139. // })
  140. // console.log(this.ECList)
  141. },
  142. methods: {
  143. runToExpress(path) {
  144. path ? uni.navigateTo({
  145. url: path
  146. }) : uni.showToast({
  147. title: '暂时未开通服务!',
  148. icon: 'none'
  149. })
  150. },
  151. async getMyExpressList() {
  152. const OldDatalength = this.dataLength
  153. // getBianminRecordKuaidiApi getKuaiDiRecordMsg // 用于对比数据是否能对应上
  154. getBianminRecordKuaidiApi(this.queryList).then((res) => {
  155. // 转化JSON字符串的数据格式 方便后面使用
  156. this.myExpressData = JSON.parse(JSON.stringify(res))
  157. this.dataLength = res.records.length
  158. res.records.forEach((item, index) => {
  159. const ResIndex = index
  160. this.myExpressData.records[index] = { ...item, req: JSON.parse(item.req), resp: JSON.parse(item.resp) }
  161. this.ECList.forEach((item, index) => {
  162. // console.log(this.myExpressData.records[ResIndex].req.orderReq.kuaidicom)
  163. if (item.key == this.myExpressData.records[ResIndex].req.orderReq.kuaidicom) {
  164. this.myExpressData.records[ResIndex].imgUrl = item.imgUrl
  165. this.myExpressData.records[ResIndex].name = item.name
  166. }
  167. })
  168. })
  169. if (OldDatalength == this.dataLength && OldDatalength > 0) {
  170. uni.showToast({
  171. title: '没有更多了...😐',
  172. icon: 'none'
  173. })
  174. } else {
  175. this.queryList.size += 6
  176. }
  177. })
  178. },
  179. ViewDetails(item) {
  180. uni.navigateTo({
  181. url: `/pages_user/serve/kuai-di/LogisticsDetails?id=${item.id}`
  182. })
  183. },
  184. CancelOrder(res) {
  185. const params = {
  186. orderId: res.resp.data.orderId,
  187. recordId: res.id,
  188. taskId: res.resp.data.taskId,
  189. userId: res.req.userId
  190. }
  191. this.CancelOrderParams = params
  192. this.modal = true
  193. // console.log(this.CancelOrderParams)
  194. },
  195. // 隐藏组件
  196. hideModal() {
  197. this.modal = false
  198. },
  199. handleClick() {
  200. orderCancelApi({ cancelMsg: this.cancelMsg, ...this.CancelOrderParams }).then((res) => {
  201. // console.log(res)
  202. this.getMyExpressList()
  203. this.hideModal()
  204. })
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="scss">
  210. .cacelBtn {
  211. display: flex;
  212. justify-content: space-around;
  213. }
  214. .gray {
  215. background-color: #979797 !important;
  216. }
  217. .sticky-fixed {
  218. /* #ifdef H5 */
  219. position: fixed;
  220. top: 88rpx !important;
  221. left: 0;
  222. width: 100vw;
  223. font-size: 40rpx !important;
  224. height: 60rpx;
  225. line-height: 60rpx;
  226. background-color: white;
  227. >span {
  228. margin-left: 20rpx;
  229. }
  230. /* #endif */
  231. /* #ifndef H5 */
  232. position: fixed;
  233. top: 80rpx !important;
  234. /* #endif */
  235. z-index: 999 !important;
  236. }
  237. .selectExpress {
  238. position: relative;
  239. width: 100%;
  240. height: 270rpx;
  241. margin-bottom: 80rpx;
  242. background-color: #327ee4;
  243. border-bottom-left-radius: 20%;
  244. border-bottom-right-radius: 20%;
  245. display: flex;
  246. flex-direction: column;
  247. align-items: center;
  248. .selectInput {
  249. margin-top: 38rpx;
  250. width: 711rpx;
  251. height: 92rpx;
  252. background-color: white;
  253. border-radius: 15rpx;
  254. display: flex;
  255. justify-content: space-around;
  256. align-items: center;
  257. >image {
  258. width: 38rpx;
  259. height: 38rpx;
  260. }
  261. >input {
  262. margin-left: -60rpx;
  263. font-size: 38rpx;
  264. }
  265. >image:nth-of-type(2) {
  266. width: 48rpx;
  267. height: 48rpx;
  268. }
  269. }
  270. .ExpressOptions {
  271. position: absolute;
  272. top: 150rpx;
  273. width: 711rpx;
  274. height: 200rpx;
  275. border-radius: 15rpx;
  276. background-color: white;
  277. font-size: 35rpx;
  278. font-weight: 550;
  279. display: flex;
  280. align-items: center;
  281. justify-content: space-around;
  282. .optItem {
  283. display: flex;
  284. flex-direction: column;
  285. align-items: center;
  286. >image {
  287. width: 90rpx;
  288. height: 90rpx;
  289. }
  290. >p {
  291. margin-top: 5rpx;
  292. }
  293. }
  294. }
  295. }
  296. .ExpressView {
  297. box-sizing: border-box;
  298. width: 100vw;
  299. overflow: hidden;
  300. padding: 20rpx 22rpx 70rpx 22rpx;
  301. .viewHeader {
  302. display: flex;
  303. justify-content: space-between;
  304. font-size: 34rpx;
  305. font-weight: 600;
  306. >span:nth-of-type(1) {
  307. color: #000;
  308. }
  309. >span:nth-of-type(2) {
  310. color: #3284e8;
  311. }
  312. }
  313. .ExpressSelection {
  314. display: flex;
  315. display: inline-block;
  316. white-space: nowrap;
  317. margin-top: 22rpx;
  318. .SelectionItem {
  319. display: inline-flex;
  320. flex-direction: column;
  321. align-items: center;
  322. width: 176rpx;
  323. // height: 252rpx;
  324. margin-right: 20px;
  325. border-radius: 15rpx;
  326. background-color: white;
  327. padding: 16rpx 10rpx;
  328. .icfonts {
  329. display: flex;
  330. align-items: center;
  331. >image {
  332. width: 50rpx;
  333. height: 50rpx;
  334. }
  335. >span {
  336. margin-left: 10rpx;
  337. font-size: 24rpx;
  338. }
  339. }
  340. .NewMoney {
  341. margin-top: 16rpx;
  342. font-size: 24rpx;
  343. letter-spacing: 2rpx;
  344. >span {
  345. letter-spacing: 1rpx;
  346. margin-right: 5rpx;
  347. font-size: 50rpx;
  348. color: #ff651a;
  349. }
  350. }
  351. .OldMoney {
  352. margin-top: 12rpx;
  353. font-size: 20rpx;
  354. color: #868e92;
  355. >span {
  356. margin: 0 5rpx;
  357. text-decoration: line-through;
  358. }
  359. }
  360. .goSend {
  361. margin-top: 15rpx;
  362. font-size: 20rpx;
  363. line-height: 37rpx;
  364. color: #fff;
  365. width: 114rpx;
  366. height: 37rpx;
  367. background-color: #0283fb;
  368. }
  369. }
  370. }
  371. .ExpressRecord {
  372. width: 100%;
  373. .RecordList {
  374. // min-height: ;
  375. margin-top: 20rpx;
  376. // max-height: 670rpx;
  377. }
  378. .RecordItem {
  379. margin-bottom: 20rpx;
  380. display: flex;
  381. align-items: center;
  382. justify-content: space-between;
  383. box-sizing: border-box;
  384. padding: 0rpx 20rpx;
  385. width: 100%;
  386. height: 130rpx;
  387. border-radius: 20rpx;
  388. background-color: white;
  389. >image {
  390. width: 76rpx;
  391. height: 76rpx;
  392. }
  393. >span {
  394. max-width: 400rpx;
  395. overflow: hidden;
  396. text-overflow: ellipsis;
  397. text-align: left;
  398. white-space: nowrap;
  399. letter-spacing: 1rpx;
  400. font-size: 30rpx;
  401. }
  402. >button {
  403. margin: 0;
  404. // background-color: #01aaff;
  405. color: #fff;
  406. padding: 0;
  407. font-size: 20rpx;
  408. width: 116rpx;
  409. line-height: 60rpx;
  410. height: 60rpx;
  411. }
  412. }
  413. .noRecordData {
  414. display: flex;
  415. flex-direction: column;
  416. align-items: center;
  417. >image {
  418. width: 450rpx;
  419. height: 500rpx;
  420. }
  421. line-height: 50rpx;
  422. font-size: 32rpx;
  423. color: #868e92;
  424. }
  425. }
  426. }
  427. </style>