ExpressDelivery.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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 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 tuiForm from '@/components/thorui/tui-form/tui-form.vue'
  110. import NavHeader from './components/header.vue'
  111. import { ECList } from './ExpressData.js' // 引入快递公司的数据
  112. import tuiInput from '@/components/thorui/tui-input/tui-input.vue'
  113. import tuiSelect from '@/components/thorui/tui-select/tui-select.vue'
  114. import {
  115. // getBianminRecordKuaidiApi, // 查询我个人寄快递的记录
  116. // getKuaidi100ComApi, // 获取可使用快递公司编码
  117. getKuaidi100PriceApi, // C端寄件下单-价格查询
  118. addKuaidi100CorderApi, // C端寄件下单
  119. orderCancelApi // C端寄件下单-取消
  120. } from '@/api/convenient-services'
  121. export default {
  122. components: {
  123. NavHeader,
  124. TuiForm: tuiForm,
  125. TuiInput: tuiInput,
  126. TuiSelect: tuiSelect
  127. },
  128. data() {
  129. return {
  130. goodsType: '',
  131. options: {},
  132. SenderData: {
  133. area: '请完善地区信息',
  134. detailedArea: '',
  135. name: '请完善个人信息',
  136. mobile: ''
  137. },
  138. collecterData: {
  139. area: '请完善地区信息',
  140. detailedArea: '',
  141. name: '请完善收件人信息',
  142. mobile: ''
  143. },
  144. FormData: {
  145. callBackUrl: 'https://nsappapi.tuanfengkeji.cn/api/wx/kuaidi100/cloud/corderCb',
  146. pollCallBackUrl: 'https://nsappapi.tuanfengkeji.cn/api/wx/kuaidi100/cloud/corderTrackCb',
  147. kuaidicom: '', // 选择快递公司的key
  148. cargo: '', // 留言
  149. weight: '' // 重量
  150. },
  151. rules,
  152. kuaidicom: {}, // 选择的快递公司
  153. timer: '',
  154. show: false,
  155. list: []
  156. }
  157. },
  158. methods: {
  159. transformExPData() {
  160. ECList.forEach((item, index) => {
  161. this.list.push({
  162. text: item.name,
  163. src: item.imgUrl,
  164. value: item.key
  165. })
  166. })
  167. // console.log(this.list)
  168. },
  169. getAddres(standing) {
  170. uni.navigateTo({
  171. url: `/pages_user/serve/kuai-di/kuaiDiForm?standing=${standing}`
  172. })
  173. },
  174. getGoodsType() {
  175. uni.showToast({
  176. title: '暂时未开通服务',
  177. icon: 'none'
  178. })
  179. },
  180. // 开启快递商家选择栏
  181. showSelect() {
  182. this.show = true
  183. },
  184. confirm(e) {
  185. // console.log(e)
  186. this.FormData.kuaidicom = e.options.value
  187. this.kuaidicom = e.options
  188. this.onClose()
  189. },
  190. onClose() {
  191. this.show = false
  192. },
  193. // 下单接口
  194. placeOrder() {
  195. // console.log(this.FormData.kuaidicom)
  196. this.$refs.expSubmitForm.validate(this.FormData, this.rules).then((res) => {
  197. // 校验通过
  198. const query = {
  199. 'orderReq': {
  200. kuaidicom: this.kuaidicom.value,
  201. sendManName: this.SenderData.name,
  202. sendManMobile: this.SenderData.mobile,
  203. recManName: this.collecterData.name,
  204. recManMobile: this.collecterData.mobile,
  205. sendManPrintAddr: this.SenderData.area + this.SenderData.detailedArea,
  206. recManPrintAddr: this.collecterData.area + this.collecterData.detailedArea,
  207. ...this.FormData
  208. }
  209. }
  210. // console.log(query)
  211. addKuaidi100CorderApi(query).then((res) => {
  212. // console.log(res)
  213. // console.log(query)
  214. uni.navigateBack()
  215. })
  216. // this.tui.toast('校验通过!')
  217. })
  218. }
  219. },
  220. onLoad(options) {
  221. this.FormData.kuaidicom = JSON.parse(options.excomp).key
  222. this.kuaidicom = {
  223. text: JSON.parse(options.excomp).name,
  224. value: JSON.parse(options.excomp).key
  225. }
  226. this.transformExPData()
  227. // getKuaidi100PriceApi({ // 价格查询
  228. // "kuaidicom": "shunfeng",
  229. // "recManPrintAddr": "广东省深圳市",
  230. // "sendManPrintAddr": "广东省深圳市",
  231. // "serviceType": "顺丰标快",
  232. // "weight": "1"
  233. // }).then(res => {
  234. // console.log(res)
  235. // })
  236. },
  237. // 每次页面重新出现时加载用户地址数据
  238. onShow() {
  239. const that = this
  240. uni.getStorage({
  241. key: 'UserExpressInfoSend',
  242. success(res) {
  243. that.SenderData = res.data
  244. // console.log(this.SenderData);
  245. }
  246. })
  247. uni.getStorage({
  248. key: 'UserExpressInfoCollect',
  249. success(res) {
  250. that.collecterData = res.data
  251. // console.log(res.data);
  252. }
  253. })
  254. }
  255. }
  256. </script>
  257. <style lang="scss" scoped>
  258. .SettleAccountfooter {
  259. box-sizing: border-box;
  260. position: fixed;
  261. bottom: 0rpx;
  262. left: 0rpx;
  263. width: 100vw;
  264. height: 156rpx;
  265. background-color: #fff;
  266. font-size: 38rpx;
  267. display: flex;
  268. justify-content: space-between;
  269. align-items: center;
  270. padding: 10rpx 25rpx;
  271. .money {
  272. color: #ff8812;
  273. }
  274. }
  275. .moreSlectItem:active {
  276. background: linear-gradient(180deg, #ffffff 0%, #f6f6f6 2%);
  277. }
  278. .moreSlect {
  279. border-radius: 15rpx;
  280. margin-top: 20rpx;
  281. background-color: #fff;
  282. }
  283. .goodsType {
  284. border-radius: 15rpx;
  285. margin-top: 20rpx;
  286. background-color: #fff;
  287. }
  288. .goodsType:active {
  289. background: none;
  290. }
  291. .ExpressDeliveryView {
  292. box-sizing: border-box;
  293. width: 100vw;
  294. min-height: 100vh;
  295. padding-bottom: 156rpx;
  296. background: linear-gradient(180deg, #ffffff 0%, #f6f6f6 10%);
  297. .ExpressDeliveryContainer {
  298. box-sizing: border-box;
  299. padding: 30rpx;
  300. width: 100%;
  301. .informationFrom {
  302. margin-top: 10rpx;
  303. width: 100%;
  304. box-sizing: border-box;
  305. padding: 0rpx 18rpx 0rpx 18rpx;
  306. background-color: #fff;
  307. border-radius: 15rpx;
  308. .fromItem {
  309. // width: 712rpx;
  310. // height: 145rpx;
  311. display: flex;
  312. align-items: center;
  313. .sender {
  314. margin-top: -30rpx;
  315. background-color: #afbbc2;
  316. color: #fff;
  317. width: 60rpx;
  318. height: 60rpx;
  319. border-radius: 50%;
  320. text-align: center;
  321. line-height: 60rpx;
  322. }
  323. .consignee {
  324. background-color: #0083ff;
  325. }
  326. .senderInformation {
  327. flex: 1;
  328. padding: 30rpx 0rpx;
  329. border-bottom: 1px dashed #afbbc2;
  330. margin-left: 20rpx;
  331. .DetailedAddress {
  332. margin-left: 10rpx;
  333. font-size: 26rpx;
  334. }
  335. >p:nth-of-type(1) {
  336. width: 100%;
  337. display: flex;
  338. justify-content: space-between;
  339. font-weight: 600;
  340. >span:nth-of-type(1) {
  341. max-width: 500rpx;
  342. max-height: 85rpx;
  343. overflow: hidden;
  344. text-overflow: ellipsis;
  345. font-size: 34rpx;
  346. }
  347. >span:nth-of-type(2) {
  348. margin-top: 5rpx;
  349. font-weight: normal;
  350. font-size: 26rpx;
  351. }
  352. }
  353. >p:nth-of-type(2) {
  354. margin-top: 12rpx;
  355. font-size: 26rpx;
  356. color: #b3b5ba;
  357. }
  358. .isNone {
  359. color: #d75b62 !important;
  360. }
  361. }
  362. }
  363. }
  364. }
  365. }
  366. .NavHeader {
  367. height: 88rpx;
  368. }
  369. </style>