ExpressDelivery.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <view class="ExpressDeliveryView">
  3. <NavHeader></NavHeader>
  4. <!-- 用于填充因定位而失去的高度 -->
  5. <view class="NavHeader"></view>
  6. <view class="ExpressDeliveryContainer">
  7. <view class="informationFrom">
  8. <view class="fromItem">
  9. <view class="sender">
  10. </view>
  11. <view class="senderInformation" @click="getAddres('Send')">
  12. <p>
  13. <span>
  14. {{ SenderData.area }} <span class="DetailedAddress">{{ SenderData.detailedArea }}</span>
  15. </span>
  16. </p>
  17. <p :class="{ isNone: !SenderData.name }">
  18. <span>{{ SenderData.name ? SenderData.name : '完善寄件人信息' }}</span><span
  19. v-if="SenderData.name"
  20. style="margin-left: 10rpx;"
  21. >
  22. {{ SenderData.mobile }}
  23. </span>
  24. </p>
  25. </view>
  26. </view>
  27. <view class="fromItem">
  28. <view class="sender consignee">
  29. </view>
  30. <view class="senderInformation" style="border: none;" @click="getAddres('Collect')">
  31. <!-- <p><span>广州省广州市</span><span>地址簿</span></p> -->
  32. <p>
  33. <span>{{ collecterData.area }}<span class="DetailedAddress">{{ collecterData.detailedArea }}</span></span>
  34. </p>
  35. <p>
  36. <span>{{ collecterData.name ? collecterData.name : '完善寄件人信息' }}</span><span
  37. v-if="collecterData.name"
  38. style="margin-left: 10rpx;"
  39. >
  40. {{ collecterData.mobile }}
  41. </span>
  42. </p>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="goodsType" @click="getGoodsType">
  47. <TuiInput
  48. v-model="goodsType" label-color="grey" label="货物类型" background-color="none"
  49. placeholder="请选择货物类型"
  50. disabled
  51. >
  52. <template #right>
  53. <image style="width: 30rpx;height: 30rpx" src="./image/youjiantou.png" mode=""></image>
  54. </template>
  55. </TuiInput>
  56. </view>
  57. <view class="moreSlect">
  58. <TuiForm ref="expSubmitForm">
  59. <view class="moreSlectItem" @click="showSelect">
  60. <TuiInput
  61. v-model="kuaidicom.text" label-color="grey" size="38" label="快递公司"
  62. background-color="none"
  63. placeholder="选择快递公司" disabled
  64. >
  65. <template #right>
  66. <image style="width: 30rpx;height: 30rpx" src="./image/youjiantou.png" mode=""></image>
  67. </template>
  68. </TuiInput>
  69. </view>
  70. <view class="moreSlectItem" @click="getGoodsType">
  71. <TuiInput
  72. v-model="timer" label-color="grey" label="期望上门时间" background-color="none"
  73. placeholder="选择期望上门时间"
  74. disabled
  75. >
  76. <template #right>
  77. <image style="width: 30rpx;height: 30rpx" src="./image/youjiantou.png" mode=""></image>
  78. </template>
  79. </TuiInput>
  80. </view>
  81. <TuiInput
  82. v-model="FormData.weight" label-color="grey" size="38" label="货物重量"
  83. background-color="none" require
  84. placeholder="单位/kg" clearable
  85. >
  86. </TuiInput>
  87. <TuiInput
  88. v-model="FormData.cargo" label-color="grey" size="38" label="物品信息"
  89. background-color="none" require
  90. placeholder="描述物品信息" clearable
  91. >
  92. </TuiInput>
  93. </TuiForm>
  94. </view>
  95. </view>
  96. <view class="SettleAccountfooter">
  97. <span>预计: <span class="money">xxx元</span></span>
  98. <button type="primary" style="margin: 0" @click="placeOrder">立即下单</button>
  99. </view>
  100. <TuiSelect :multiple="true" mask-closable="true" :list="list" :show="show" @confirm="confirm" @close="onClose"></TuiSelect>
  101. </view>
  102. </template>
  103. <script>
  104. const rules = [ {
  105. name: 'weight',
  106. rule: [ 'required' ],
  107. msg: ['请输入预期的货物重量', '请输入正常数值的重量']
  108. } ]
  109. import { ANOTHER_TF_INTERFACE } from '../../../config/index'
  110. import { getUserId, KuaiDiRequest } from '@/utils'
  111. import tuiForm from '@/components/thorui/tui-form/tui-form.vue'
  112. import NavHeader from './components/header.vue'
  113. import { ECList } from './ExpressData.js' // 引入快递公司的数据
  114. import tuiInput from '@/components/thorui/tui-input/tui-input.vue'
  115. import tuiSelect from '@/components/thorui/tui-select/tui-select.vue'
  116. import {
  117. // getBianminRecordKuaidiApi, // 查询我个人寄快递的记录
  118. // getKuaidi100ComApi, // 获取可使用快递公司编码
  119. getKuaidi100PriceApi, // C端寄件下单-价格查询
  120. addKuaidi100CorderApi, // C端寄件下单
  121. orderCancelApi // C端寄件下单-取消
  122. } from '@/api/convenient-services'
  123. export default {
  124. components: {
  125. NavHeader,
  126. TuiForm: tuiForm,
  127. TuiInput: tuiInput,
  128. TuiSelect: tuiSelect
  129. },
  130. data() {
  131. return {
  132. goodsType: '',
  133. options: {},
  134. SenderData: {
  135. area: '请完善地区信息',
  136. detailedArea: '',
  137. name: '请完善个人信息',
  138. mobile: ''
  139. },
  140. collecterData: {
  141. area: '请完善地区信息',
  142. detailedArea: '',
  143. name: '请完善收件人信息',
  144. mobile: ''
  145. },
  146. FormData: {
  147. callBackUrl: `${ANOTHER_TF_INTERFACE}/api/wx/kuaidi100/cloud/corderCb`,
  148. pollCallBackUrl: `${ANOTHER_TF_INTERFACE}/api/wx/kuaidi100/cloud/corderTrackCb`,
  149. kuaidicom: '', // 选择快递公司的key
  150. cargo: '', // 留言
  151. weight: '' // 重量
  152. },
  153. rules,
  154. kuaidicom: {}, // 选择的快递公司
  155. timer: '',
  156. show: false,
  157. list: []
  158. }
  159. },
  160. methods: {
  161. transformExPData() {
  162. ECList.forEach((item, index) => {
  163. this.list.push({
  164. text: item.name,
  165. src: item.imgUrl,
  166. value: item.key
  167. })
  168. })
  169. // console.log(this.list)
  170. },
  171. getAddres(standing) {
  172. uni.navigateTo({
  173. url: `/pages/user/kuai-di/kuaiDiForm?standing=${standing}`
  174. })
  175. },
  176. getGoodsType() {
  177. uni.showToast({
  178. title: '暂时未开通服务',
  179. icon: 'none'
  180. })
  181. },
  182. // 开启快递商家选择栏
  183. showSelect() {
  184. this.show = true
  185. },
  186. confirm(e) {
  187. // console.log(e)
  188. this.FormData.kuaidicom = e.options.value
  189. this.kuaidicom = e.options
  190. this.onClose()
  191. },
  192. onClose() {
  193. this.show = false
  194. },
  195. // 下单接口
  196. placeOrder() {
  197. console.log(this.FormData.kuaidicom)
  198. this.$refs.expSubmitForm.validate(this.FormData, this.rules).then((res) => {
  199. // 校验通过
  200. const query = {
  201. 'orderReq': {
  202. kuaidicom: this.kuaidicom.value,
  203. sendManName: this.SenderData.name,
  204. sendManMobile: this.SenderData.mobile,
  205. recManName: this.collecterData.name,
  206. recManMobile: this.collecterData.mobile,
  207. sendManPrintAddr: this.SenderData.area + this.SenderData.detailedArea,
  208. recManPrintAddr: this.collecterData.area + this.collecterData.detailedArea,
  209. ...this.FormData
  210. },
  211. 'userId': getUserId()
  212. }
  213. addKuaidi100CorderApi(query).then((res) => {
  214. console.log(res)
  215. console.log(query)
  216. uni.navigateBack()
  217. })
  218. // this.tui.toast('校验通过!')
  219. })
  220. }
  221. },
  222. onLoad(options) {
  223. this.FormData.kuaidicom = JSON.parse(options.excomp).key
  224. this.kuaidicom = {
  225. text: JSON.parse(options.excomp).name,
  226. value: JSON.parse(options.excomp).key
  227. }
  228. this.transformExPData()
  229. // getKuaidi100PriceApi({ // 价格查询
  230. // "kuaidicom": "shunfeng",
  231. // "recManPrintAddr": "广东省深圳市",
  232. // "sendManPrintAddr": "广东省深圳市",
  233. // "serviceType": "顺丰标快",
  234. // "weight": "1"
  235. // }).then(res => {
  236. // console.log(res)
  237. // })
  238. },
  239. // 每次页面重新出现时加载用户地址数据
  240. onShow() {
  241. const that = this
  242. uni.getStorage({
  243. key: 'UserExpressInfoSend',
  244. success(res) {
  245. that.SenderData = res.data
  246. // console.log(this.SenderData);
  247. }
  248. })
  249. uni.getStorage({
  250. key: 'UserExpressInfoCollect',
  251. success(res) {
  252. that.collecterData = res.data
  253. // console.log(res.data);
  254. }
  255. })
  256. }
  257. }
  258. </script>
  259. <style lang="scss" scoped>
  260. .SettleAccountfooter {
  261. box-sizing: border-box;
  262. position: fixed;
  263. bottom: 0rpx;
  264. left: 0rpx;
  265. width: 100vw;
  266. height: 156rpx;
  267. background-color: #fff;
  268. font-size: 38rpx;
  269. display: flex;
  270. justify-content: space-between;
  271. align-items: center;
  272. padding: 10rpx 25rpx;
  273. .money {
  274. color: #ff8812;
  275. }
  276. }
  277. .moreSlectItem:active {
  278. background: linear-gradient(180deg, #ffffff 0%, #f6f6f6 10%);
  279. }
  280. .moreSlect {
  281. border-radius: 15rpx;
  282. margin-top: 20rpx;
  283. background-color: #fff;
  284. }
  285. .goodsType {
  286. border-radius: 15rpx;
  287. margin-top: 20rpx;
  288. background-color: #fff;
  289. }
  290. .goodsType:active {
  291. background: none;
  292. }
  293. .ExpressDeliveryView {
  294. box-sizing: border-box;
  295. width: 100vw;
  296. min-height: 100vh;
  297. padding-bottom: 156rpx;
  298. background: linear-gradient(180deg, #ffffff 0%, #f6f6f6 10%);
  299. .ExpressDeliveryContainer {
  300. box-sizing: border-box;
  301. padding: 30rpx;
  302. width: 100%;
  303. .informationFrom {
  304. margin-top: 10rpx;
  305. width: 100%;
  306. box-sizing: border-box;
  307. padding: 0rpx 18rpx 0rpx 18rpx;
  308. background-color: #fff;
  309. border-radius: 15rpx;
  310. .fromItem {
  311. // width: 712rpx;
  312. // height: 145rpx;
  313. display: flex;
  314. align-items: center;
  315. .sender {
  316. margin-top: -30rpx;
  317. background-color: #afbbc2;
  318. color: #fff;
  319. width: 60rpx;
  320. height: 60rpx;
  321. border-radius: 50%;
  322. text-align: center;
  323. line-height: 60rpx;
  324. }
  325. .consignee {
  326. background-color: #0083ff;
  327. }
  328. .senderInformation {
  329. flex: 1;
  330. padding: 30rpx 0rpx;
  331. border-bottom: 1px dashed #afbbc2;
  332. margin-left: 20rpx;
  333. .DetailedAddress {
  334. margin-left: 10rpx;
  335. font-size: 26rpx;
  336. }
  337. >p:nth-of-type(1) {
  338. width: 100%;
  339. display: flex;
  340. justify-content: space-between;
  341. font-weight: 600;
  342. >span:nth-of-type(1) {
  343. max-width: 500rpx;
  344. max-height: 85rpx;
  345. overflow: hidden;
  346. text-overflow: ellipsis;
  347. font-size: 34rpx;
  348. }
  349. >span:nth-of-type(2) {
  350. margin-top: 5rpx;
  351. font-weight: normal;
  352. font-size: 26rpx;
  353. }
  354. }
  355. >p:nth-of-type(2) {
  356. margin-top: 12rpx;
  357. font-size: 26rpx;
  358. color: #b3b5ba;
  359. }
  360. .isNone {
  361. color: #d75b62 !important;
  362. }
  363. }
  364. }
  365. }
  366. }
  367. }
  368. .NavHeader {
  369. height: 88rpx;
  370. }
  371. </style>