IndexView.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <view class="IndexView">
  3. <view class="selectExpress">
  4. <view class="selectInput">
  5. <image class="selectIcon" src="../image/sousuo.png" mode=""></image>
  6. <input class="seltInput" v-model="expressId" type="text" placeholder="请输入订单编号">
  7. <image class="seltImgIcon" src="../image/saoma.png" mode=""></image>
  8. </view>
  9. <view class="ExpressOptions">
  10. <view class="optItem" @click="runToExpress('/pages/user/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/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. position: relative;
  250. margin-top: 38rpx;
  251. width: 711rpx;
  252. height: 92rpx;
  253. background-color: white;
  254. border-radius: 15rpx;
  255. display: flex;
  256. // justify-content: space-around;
  257. align-items: center;
  258. .selectIcon {
  259. width: 38rpx;
  260. height: 38rpx;
  261. margin-left: 20rpx;
  262. }
  263. .seltInput {
  264. margin-left: 15rpx;
  265. font-size: 38rpx;
  266. }
  267. .seltImgIcon {
  268. position: absolute;
  269. right: 30rpx;
  270. width: 48rpx;
  271. height: 48rpx;
  272. }
  273. }
  274. .ExpressOptions {
  275. position: absolute;
  276. top: 150rpx;
  277. width: 711rpx;
  278. height: 200rpx;
  279. border-radius: 15rpx;
  280. background-color: white;
  281. font-size: 35rpx;
  282. font-weight: 550;
  283. display: flex;
  284. align-items: center;
  285. justify-content: space-around;
  286. .optItem {
  287. display: flex;
  288. flex-direction: column;
  289. align-items: center;
  290. >image {
  291. width: 90rpx;
  292. height: 90rpx;
  293. }
  294. >p {
  295. margin-top: 5rpx;
  296. }
  297. }
  298. }
  299. }
  300. .ExpressView {
  301. box-sizing: border-box;
  302. width: 100vw;
  303. overflow: hidden;
  304. padding: 20rpx 22rpx 70rpx 22rpx;
  305. .viewHeader {
  306. display: flex;
  307. justify-content: space-between;
  308. font-size: 34rpx;
  309. font-weight: 600;
  310. >span:nth-of-type(1) {
  311. color: #000;
  312. }
  313. >span:nth-of-type(2) {
  314. color: #3284e8;
  315. }
  316. }
  317. .ExpressSelection {
  318. display: flex;
  319. display: inline-block;
  320. white-space: nowrap;
  321. margin-top: 22rpx;
  322. .SelectionItem {
  323. display: inline-flex;
  324. flex-direction: column;
  325. align-items: center;
  326. width: 176rpx;
  327. // height: 252rpx;
  328. margin-right: 20px;
  329. border-radius: 15rpx;
  330. background-color: white;
  331. padding: 16rpx 10rpx;
  332. .icfonts {
  333. display: flex;
  334. align-items: center;
  335. >image {
  336. width: 50rpx;
  337. height: 50rpx;
  338. }
  339. >span {
  340. margin-left: 10rpx;
  341. font-size: 24rpx;
  342. }
  343. }
  344. .NewMoney {
  345. margin-top: 16rpx;
  346. font-size: 24rpx;
  347. letter-spacing: 2rpx;
  348. >span {
  349. letter-spacing: 1rpx;
  350. margin-right: 5rpx;
  351. font-size: 50rpx;
  352. color: #ff651a;
  353. }
  354. }
  355. .OldMoney {
  356. margin-top: 12rpx;
  357. font-size: 20rpx;
  358. color: #868e92;
  359. >span {
  360. margin: 0 5rpx;
  361. text-decoration: line-through;
  362. }
  363. }
  364. .goSend {
  365. margin-top: 15rpx;
  366. font-size: 20rpx;
  367. line-height: 37rpx;
  368. color: #fff;
  369. width: 114rpx;
  370. height: 37rpx;
  371. background-color: #0283fb;
  372. }
  373. }
  374. }
  375. .ExpressRecord {
  376. width: 100%;
  377. .RecordList {
  378. // min-height: ;
  379. margin-top: 20rpx;
  380. // max-height: 670rpx;
  381. }
  382. .RecordItem {
  383. margin-bottom: 20rpx;
  384. display: flex;
  385. align-items: center;
  386. justify-content: space-between;
  387. box-sizing: border-box;
  388. padding: 0rpx 20rpx;
  389. width: 100%;
  390. height: 130rpx;
  391. border-radius: 20rpx;
  392. background-color: white;
  393. >image {
  394. width: 76rpx;
  395. height: 76rpx;
  396. }
  397. >span {
  398. max-width: 400rpx;
  399. overflow: hidden;
  400. text-overflow: ellipsis;
  401. text-align: left;
  402. white-space: nowrap;
  403. letter-spacing: 1rpx;
  404. font-size: 30rpx;
  405. }
  406. >button {
  407. margin: 0;
  408. // background-color: #01aaff;
  409. color: #fff;
  410. padding: 0;
  411. font-size: 20rpx;
  412. width: 116rpx;
  413. line-height: 60rpx;
  414. height: 60rpx;
  415. }
  416. }
  417. .noRecordData {
  418. display: flex;
  419. flex-direction: column;
  420. align-items: center;
  421. >image {
  422. width: 450rpx;
  423. height: 500rpx;
  424. }
  425. line-height: 50rpx;
  426. font-size: 32rpx;
  427. color: #868e92;
  428. }
  429. }
  430. }
  431. </style>