铝交易,微信公众号
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

625 lines
14 KiB

6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
5 months ago
6 months ago
  1. <template>
  2. <view class="now-order">
  3. <navbar :title="$t('pageTitle.immediateOrder')" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="frame">
  5. <view class="title">
  6. <span
  7. style="width: 10rpx;height: 40rpx;background-color: #1f1c39;border-radius: 10rpx;overflow: hidden;"></span>
  8. <span>{{ $t('other.aluminumProducts') }}</span>
  9. </view>
  10. <view class="basic-info">
  11. <!--商品规格-->
  12. <view class="item">
  13. <view>{{ $t('components.productSpe') }}</view>
  14. <view>
  15. {{$t('other.aluminumProducts') }}
  16. </view>
  17. </view>
  18. <!--<uv-divider text="" :hairline="true"></uv-divider>-->
  19. <!--提货地点-->
  20. <!-- <view class="currentRegion">
  21. <view>{{ $t('components.pickupLocation') }}</view>
  22. &lt;!&ndash; <view @click.stop="selectAddr">
  23. <input class="input" disabled v-model="form.currentRegion" placeholder="请选择所在地区"></input>
  24. <view class="orientation">
  25. <img src="../../static/image/address/selectIcon.png"
  26. style="width:30rpx;height: 30rpx;margin:5rpx 5rpx 5rpx 5rpx;">
  27. </view>
  28. </view> &ndash;&gt;
  29. <view class="">
  30. {{ fatherData.address }}
  31. </view>
  32. </view> -->
  33. <!-- <view class="addressA" @click="openAddress">
  34. <view class="title">提货地点</view>
  35. <view class="address" style="width: 70%">
  36. <image mode="" src="/static/image/address/selectIcon.png"></image>
  37. <view class="">
  38. {{ address.name }}
  39. </view>
  40. <view class="icon">
  41. <uv-icon name="arrow-right" size="30rpx"></uv-icon>
  42. </view>
  43. </view>
  44. </view>
  45. 详细地址
  46. <view v-if="address.addressDetail" class="item">
  47. <view>{{ $t('components.detailedAddress') }}</view>
  48. <view>
  49. <view class="">
  50. {{ address.address + ' ' + address.addressDetail }}
  51. </view>
  52. </view>
  53. </view> -->
  54. <view class="addressA">
  55. <view class="title">提货地点</view>
  56. <view class="address" style="width: 70%">
  57. {{ fatherData.address }}
  58. </view>
  59. </view>
  60. <!--&lt;!&ndash;详细地址&ndash;&gt;-->
  61. <!--<view class="item">-->
  62. <!-- <view>{{ $t('components.detailedAddress') }}</view>-->
  63. <!-- <view>-->
  64. <!-- &lt;!&ndash; <input v-model="form.address" placeholder="请输入详细地址" clearable></input> &ndash;&gt;-->
  65. <!-- </view>-->
  66. <!--</view>-->
  67. <!--交货日期-->
  68. <view class="delivery-date">
  69. <view>{{ $t('components.deliveryDate') }}</view>
  70. <view class="value">
  71. <view class="dateTimeCls" @click="startDateOpen">
  72. <view class="date">
  73. {{ form.takeTime }}
  74. <uv-datetime-picker ref="startDateRef" v-model="form.takeTime" mode="date"
  75. :minDate="$dayjs(fatherData.transactionTime).valueOf()"
  76. @confirm="startDateChange"></uv-datetime-picker>
  77. </view>
  78. <view class="img">
  79. >
  80. <!--<img src="../static/address/1.svg" style="width: 40rpx;-->
  81. <!--height: 40rpx;">-->
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <!--暂定数量-->
  87. <view class="tentativeQuantity">
  88. <view class="key">{{ $t('other.tentativeQuantity') }}</view>
  89. <view class="value">
  90. <uv-number-box inputWidth="200rpx" v-model="form.num" :max="fatherData.num"></uv-number-box>
  91. </view>
  92. </view>
  93. <!--单价-->
  94. <view class="item">
  95. <view>{{ $t('components.unitPrice') }}</view>
  96. <view>
  97. <input v-model="fatherData.price" disabled clearable></input>
  98. </view>
  99. </view>
  100. <!--履约保证金-->
  101. <view class="performanceBond">
  102. <view class="key">{{ $t('other.performanceDeposit') }}</view>
  103. <view class="value">
  104. <!-- <input v-model="form.deposit" clearable></input> -->
  105. {{ deposit }}
  106. </view>
  107. </view>
  108. <view class="Tip">
  109. <span class="span">{{ $t('other.priceQuantityPercentage', [10]) }}</span>
  110. </view>
  111. <!--立即下单和联系我们-->
  112. <view class="btns">
  113. <span @click="ljxd" class="ljxd">
  114. {{ $t('components.immediateOrder') }}
  115. </span>
  116. <span @click="contactUs" class="lxwm">
  117. {{ $t('components.contactUs') }}
  118. </span>
  119. <span class="tip">{{ $t('components.contactUsIfAnyProblems') }}</span>
  120. </view>
  121. </view>
  122. </view>
  123. <!-- 联系客服弹框 -->
  124. <customerServicePopup ref="customerServicePopup" />
  125. <!-- 地址选择弹框 -->
  126. <uv-popup ref="addressPopup" :round="30">
  127. <addressList ref="addressList" height="60vh" @select="selectAddress" />
  128. </uv-popup>
  129. </view>
  130. </template>
  131. <script>
  132. import topbar from "@/components/base/topbar.vue";
  133. import {
  134. mapGetters
  135. } from 'vuex'
  136. import Position from '@/utils/position.js'
  137. import dayjs from "dayjs";
  138. import customerServicePopup from '@/components/config/customerServicePopup.vue'
  139. import AddressList from "@/pages_order/components/address/addressList.vue";
  140. export default {
  141. name: "nowOrder",
  142. components: {
  143. AddressList,
  144. topbar,
  145. customerServicePopup,
  146. },
  147. computed: {
  148. ...mapGetters(['userShop']),
  149. deposit() {
  150. return (this.fatherData.price * this.form.num * (0.1)).toFixed(2)
  151. },
  152. },
  153. onLoad(options) {
  154. // if (options.params) {
  155. // const fatherData = JSON.parse(decodeURIComponent(options.params));
  156. // 从vuex里面拿
  157. const fatherData = this.$store.state.productDetail
  158. console.log(fatherData, "fatherData==========")
  159. this.fatherData = fatherData;
  160. // 计算保证金 这个改成计算属性
  161. // this.form.deposit = (fatherData.price * this.form.num * (0.02)).toFixed(2);
  162. // }
  163. },
  164. data() {
  165. return {
  166. fatherData: {},
  167. form: {
  168. "address": "",
  169. "addressId": "",
  170. "deposit": 0,
  171. "id": "",
  172. "num": 1,
  173. "price": 0,
  174. "productId": "",
  175. "takeTime": dayjs(new Date()).format("YYYY-MM-DD"),
  176. },
  177. id: 0,
  178. address: {
  179. name: '请选择地址',
  180. addressDetail: '',
  181. },
  182. }
  183. },
  184. methods: {
  185. // 立即下单
  186. ljxd() {
  187. // var itemStr = encodeURIComponent(JSON.stringify(this.form));
  188. // uni.navigateTo({
  189. // url: `/pages_order/tradingPlatform/confirmOrder`,
  190. // });
  191. this.form.deposit = this.deposit
  192. this.form.productId = this.fatherData.id
  193. if (this.$utils.verificationAll(this.form, {
  194. "takeTime": '请选择交货时间',
  195. })) {
  196. return
  197. }
  198. this.$api('addProductOrder', this.form, res => {
  199. if (res.code == 200) {
  200. // 从vuex里面拿
  201. this.$store.state.cartInfo = res.result
  202. uni.navigateTo({
  203. url: `/pages_order/tradingPlatform/confirmOrder`,
  204. });
  205. }
  206. })
  207. },
  208. // 联系我们
  209. contactUs() {
  210. this.$refs.customerServicePopup.open()
  211. },
  212. // 选择地址
  213. selectAddress(e) {
  214. this.address = e
  215. this.$refs.addressPopup.close()
  216. },
  217. startDateChange(val) {
  218. this.$nextTick(() => {
  219. this.form.takeTime = dayjs(val.value).format("YYYY-MM-DD")
  220. });
  221. },
  222. startDateOpen() {
  223. console.log(1);
  224. this.$refs.startDateRef.open();
  225. },
  226. //地图上选择地址
  227. selectAddr() {
  228. Position.getLocation(res => {
  229. Position.selectAddress(res.longitude, res.latitude, success => {
  230. this.setAddress(success)
  231. })
  232. })
  233. Position.getLocationDetail(res => {
  234. console.log(res);
  235. this.form.address = res
  236. })
  237. },
  238. openAddress() {
  239. this.$refs.addressPopup.open('bottom')
  240. // this.getAddressList()
  241. this.$nextTick(() => {
  242. this.getAddressListA()
  243. })
  244. },
  245. //获取地址列表
  246. getAddressListA() {
  247. this.$refs.addressList
  248. .getAddressList()
  249. .then(res => {
  250. if (res == 0) {
  251. this.$refs.popup.close()
  252. return uni.navigateTo({
  253. url: '/pages_order/mine/address?type=back'
  254. })
  255. }
  256. })
  257. },
  258. //提取用户选择的地址信息复制给表单数据
  259. setAddress(res) {
  260. //经纬度信息
  261. this.form.latitude = res.latitude
  262. this.form.longitude = res.longitude
  263. if (!res.address && res.name) { //用户直接选择城市的逻辑
  264. return this.form.currentRegion = res.name
  265. }
  266. if (res.address || res.name) {
  267. return this.form.currentRegion = res.address + res.name
  268. }
  269. this.form.currentRegion = '' //用户啥都没选就点击勾选
  270. },
  271. }
  272. }
  273. </script>
  274. <style scoped lang="scss">
  275. .now-order {
  276. background-color: #FFF;
  277. height: 100vh;
  278. .frame {
  279. .title {
  280. display: flex;
  281. font-size: 30rpx;
  282. font-weight: 700;
  283. padding: 0rpx 0 0rpx 20rpx;
  284. margin: 20rpx 0 0 0;
  285. >span:nth-of-type(1) {
  286. margin: 4rpx 0 0 8rpx;
  287. background-color: #FFF;
  288. }
  289. >span:nth-of-type(2) {
  290. margin: 0 0 0 8rpx;
  291. background-color: #FFF;
  292. }
  293. }
  294. .basic-info {
  295. display: flex;
  296. flex-direction: column;
  297. gap: 5rpx;
  298. background-color: #FFF;
  299. //margin-top: 20rpx;
  300. padding: 20rpx 20rpx 20rpx 20rpx;
  301. .delivery-date {
  302. display: flex;
  303. align-items: center;
  304. background-color: #FFF;
  305. height: 80rpx;
  306. // margin: 10rpx 0 0 0;
  307. padding: 10rpx 0 0 20rpx;
  308. >view:nth-of-type(1) {
  309. width: 30%;
  310. // font-weight: 700;
  311. }
  312. .value {
  313. width: 70%;
  314. border-radius: 10rpx;
  315. overflow: hidden;
  316. .dateTimeCls {
  317. display: flex;
  318. align-items: center;
  319. justify-content: space-between;
  320. width: 100%;
  321. height: 80%;
  322. //border: 1px solid #b0b2b3;
  323. padding: 5rpx;
  324. border-radius: 20rpx;
  325. .date {
  326. font-size: 30rpx;
  327. display: flex;
  328. align-items: center;
  329. width: 80%;
  330. height: 100%;
  331. color: #000;
  332. }
  333. .img {
  334. display: flex;
  335. justify-content: center;
  336. align-items: center;
  337. //margin-left: 50rpx;
  338. width: 20%;
  339. //height: 100%;
  340. }
  341. }
  342. }
  343. }
  344. .tentativeQuantity {
  345. display: flex;
  346. align-items: center;
  347. background-color: #FFF;
  348. height: 80rpx;
  349. // margin: 10rpx 0 0 0;
  350. padding: 10rpx 0 0 20rpx;
  351. .key {
  352. width: 30%;
  353. }
  354. .value {
  355. width: 70%;
  356. border-radius: 10rpx;
  357. overflow: hidden;
  358. }
  359. }
  360. .Tip {
  361. display: flex;
  362. align-items: center;
  363. justify-content: center;
  364. .span {
  365. color: #999;
  366. font-size: 24rpx;
  367. }
  368. }
  369. .btns {
  370. width: 100%;
  371. display: flex;
  372. flex-direction: column;
  373. align-items: center;
  374. justify-content: center;
  375. gap: 20rpx;
  376. .ljxd {
  377. display: flex;
  378. align-items: center;
  379. justify-content: center;
  380. width: 500rpx;
  381. height: 70rpx;
  382. border-radius: 40rpx;
  383. color: #FFF;
  384. font-size: 28rpx;
  385. margin: 20rpx 10rpx 0 0;
  386. background: $uni-color;
  387. //margin-top: 20rpx;
  388. border-radius: 40rpx;
  389. }
  390. .lxwm {
  391. display: flex;
  392. align-items: center;
  393. justify-content: center;
  394. width: 500rpx;
  395. height: 70rpx;
  396. border-radius: 40rpx;
  397. color: #000000;
  398. font-size: 28rpx;
  399. margin: 20rpx 10rpx 0 0;
  400. background: #f1f1f1;
  401. //margin-top: 20rpx;
  402. border-radius: 40rpx;
  403. }
  404. .tip {
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. font-size: 24rpx;
  409. color: #999;
  410. //width: 500rpx;
  411. }
  412. }
  413. .item {
  414. display: flex;
  415. align-items: center;
  416. background-color: #FFF;
  417. height: 80rpx;
  418. // margin: 10rpx 0 0 0;
  419. padding: 10rpx 0 0 20rpx;
  420. >view:nth-of-type(1) {
  421. width: 30%;
  422. // font-weight: 700;
  423. }
  424. >view:nth-of-type(2) {
  425. width: 70%;
  426. border-radius: 10rpx;
  427. overflow: hidden;
  428. input {
  429. background-color: #FFF;
  430. font-size: 28rpx;
  431. padding: 16rpx 8rpx 16rpx 15rpx;
  432. }
  433. }
  434. }
  435. .performanceBond {
  436. display: flex;
  437. align-items: center;
  438. background-color: #FFF;
  439. height: 80rpx;
  440. // margin: 10rpx 0 0 0;
  441. padding: 10rpx 0 0 20rpx;
  442. .key {
  443. width: 30%;
  444. // font-weight: 700;
  445. }
  446. .value {
  447. width: 70%;
  448. border-radius: 10rpx;
  449. overflow: hidden;
  450. input {
  451. background-color: #FFF;
  452. font-size: 28rpx;
  453. padding: 16rpx 8rpx 16rpx 15rpx;
  454. }
  455. }
  456. }
  457. .addressA {
  458. display: flex;
  459. align-items: center;
  460. background-color: #FFF;
  461. // height: 80rpx;
  462. // margin: 10rpx 0 0 0;
  463. //padding: 10rpx 0 0 20rpx;
  464. .title {
  465. display: flex;
  466. align-items: center;
  467. justify-content: flex-start;
  468. font-weight: 400;
  469. width: 30%;
  470. }
  471. .address {
  472. width: 70%;
  473. display: flex;
  474. padding: 20rpx;
  475. background-color: #fff;
  476. image {
  477. width: 30rpx;
  478. height: 30rpx;
  479. margin: 10rpx;
  480. }
  481. view {
  482. //margin: 20rpx;
  483. overflow: hidden; //超出的文本隐藏
  484. text-overflow: ellipsis; //溢出用省略号显示
  485. white-space: nowrap; //溢出不换行
  486. }
  487. .icon {
  488. display: flex;
  489. justify-content: center;
  490. align-items: center;
  491. margin-left: auto;
  492. }
  493. }
  494. }
  495. .currentRegion {
  496. display: flex;
  497. align-items: center;
  498. background-color: #FFF;
  499. height: 80rpx;
  500. // margin: 10rpx 0 0 0;
  501. padding: 10rpx 0 0 20rpx;
  502. >view:nth-of-type(1) {
  503. width: 30%;
  504. // font-weight: 700;
  505. }
  506. >view:nth-of-type(2) {
  507. width: 70%;
  508. padding: 0 20rpx 0 0;
  509. display: flex;
  510. .input {
  511. background-color: #f5f5f5;
  512. // color: #a4a4a4;
  513. font-size: 28rpx;
  514. padding: 8rpx 8rpx 8rpx 15rpx;
  515. width: 350rpx;
  516. }
  517. .orientation {
  518. display: flex;
  519. padding: 10rpx 10rpx 10rpx 20rpx;
  520. font-size: 30rpx;
  521. color: #FBAB32;
  522. flex-direction: column;
  523. justify-content: center;
  524. align-items: center;
  525. }
  526. }
  527. }
  528. }
  529. }
  530. }
  531. </style>