铝交易,微信公众号
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.

622 lines
14 KiB

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