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

511 lines
11 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 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. <!-- <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> -->
  29. <view class="">
  30. {{ fatherData.address }}
  31. </view>
  32. </view>
  33. <!--详细地址-->
  34. <view class="item">
  35. <view>{{ $t('components.detailedAddress') }}</view>
  36. <view>
  37. <!-- <input v-model="form.address" placeholder="请输入详细地址" clearable></input> -->
  38. </view>
  39. </view>
  40. <!--交货日期-->
  41. <view class="delivery-date">
  42. <view>{{ $t('components.deliveryDate') }}</view>
  43. <view class="value">
  44. <view class="dateTimeCls"
  45. @click="startDateOpen">
  46. <view class="date">
  47. {{ form.takeTime }}
  48. <uv-datetime-picker ref="startDateRef"
  49. v-model="form.takeTime"
  50. mode="date"
  51. :minDate="$dayjs(fatherData.transactionTime).valueOf()"
  52. @confirm="startDateChange"></uv-datetime-picker>
  53. </view>
  54. <view class="img">
  55. >
  56. <!--<img src="../static/address/1.svg" style="width: 40rpx;-->
  57. <!--height: 40rpx;">-->
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <!--暂定数量-->
  63. <view class="tentativeQuantity">
  64. <view class="key">{{ $t('other.tentativeQuantity') }}</view>
  65. <view class="value">
  66. <uv-number-box
  67. inputWidth="200rpx" v-model="form.num" :max="fatherData.num"></uv-number-box>
  68. </view>
  69. </view>
  70. <!--单价-->
  71. <view class="item">
  72. <view>{{ $t('components.unitPrice') }}</view>
  73. <view>
  74. <input v-model="fatherData.price" disabled clearable></input>
  75. </view>
  76. </view>
  77. <!--履约保证金-->
  78. <view class="performanceBond">
  79. <view class="key">{{ $t('other.performanceDeposit') }}</view>
  80. <view class="value">
  81. <!-- <input v-model="form.deposit" clearable></input> -->
  82. {{ deposit }}
  83. </view>
  84. </view>
  85. <view class="Tip">
  86. <span class="span">{{ $t('other.priceQuantityPercentage', [10]) }}</span>
  87. </view>
  88. <!--立即下单和联系我们-->
  89. <view class="btns">
  90. <span @click="ljxd" class="ljxd">
  91. {{ $t('components.immediateOrder') }}
  92. </span>
  93. <span @click="contactUs" class="lxwm">
  94. {{ $t('components.contactUs') }}
  95. </span>
  96. <span class="tip">{{ $t('components.contactUsIfAnyProblems') }}</span>
  97. </view>
  98. </view>
  99. </view>
  100. <!-- 联系客服弹框 -->
  101. <customerServicePopup ref="customerServicePopup" />
  102. </view>
  103. </template>
  104. <script>
  105. import topbar from "@/components/base/topbar.vue";
  106. import {
  107. mapGetters
  108. } from 'vuex'
  109. import Position from '@/utils/position.js'
  110. import dayjs from "dayjs";
  111. import customerServicePopup from '@/components/config/customerServicePopup.vue'
  112. export default {
  113. name: "nowOrder",
  114. components: {
  115. topbar,
  116. customerServicePopup,
  117. },
  118. computed: {
  119. ...mapGetters(['userShop']),
  120. deposit(){
  121. return (this.fatherData.price * this.form.num * (0.1)).toFixed(2)
  122. },
  123. },
  124. onLoad(options) {
  125. // if (options.params) {
  126. // const fatherData = JSON.parse(decodeURIComponent(options.params));
  127. // 从vuex里面拿
  128. const fatherData = this.$store.state.productDetail
  129. console.log(fatherData, "fatherData==========")
  130. this.fatherData = fatherData;
  131. // 计算保证金 这个改成计算属性
  132. // this.form.deposit = (fatherData.price * this.form.num * (0.02)).toFixed(2);
  133. // }
  134. },
  135. data() {
  136. return {
  137. fatherData: {},
  138. form: {
  139. "address": "",
  140. "addressId": "",
  141. "deposit": 0,
  142. "id": "",
  143. "num": 1,
  144. "price": 0,
  145. "productId": "",
  146. "takeTime": ""
  147. },
  148. id : 0,
  149. }
  150. },
  151. methods: {
  152. // 立即下单
  153. ljxd() {
  154. // var itemStr = encodeURIComponent(JSON.stringify(this.form));
  155. // uni.navigateTo({
  156. // url: `/pages_order/tradingPlatform/confirmOrder`,
  157. // });
  158. this.form.deposit = this.deposit
  159. this.form.productId = this.fatherData.id
  160. if(this.$utils.verificationAll(this.form, {
  161. "takeTime": '请选择交货时间',
  162. })){
  163. return
  164. }
  165. this.$api('addProductOrder', this.form, res => {
  166. if(res.code == 200){
  167. // 从vuex里面拿
  168. this.$store.state.cartInfo = res.result
  169. uni.navigateTo({
  170. url: `/pages_order/tradingPlatform/confirmOrder`,
  171. });
  172. }
  173. })
  174. },
  175. // 联系我们
  176. contactUs() {
  177. this.$refs.customerServicePopup.open()
  178. },
  179. startDateChange(val) {
  180. this.$nextTick(() => {
  181. this.form.takeTime = dayjs(val.value).format("YYYY-MM-DD")
  182. });
  183. },
  184. startDateOpen() {
  185. console.log(1);
  186. this.$refs.startDateRef.open();
  187. },
  188. //地图上选择地址
  189. selectAddr() {
  190. Position.getLocation(res => {
  191. Position.selectAddress(res.longitude, res.latitude, success => {
  192. this.setAddress(success)
  193. })
  194. })
  195. Position.getLocationDetail(res => {
  196. console.log(res);
  197. this.form.address = res
  198. })
  199. },
  200. //提取用户选择的地址信息复制给表单数据
  201. setAddress(res) {
  202. //经纬度信息
  203. this.form.latitude = res.latitude
  204. this.form.longitude = res.longitude
  205. if (!res.address && res.name) { //用户直接选择城市的逻辑
  206. return this.form.currentRegion = res.name
  207. }
  208. if (res.address || res.name) {
  209. return this.form.currentRegion = res.address + res.name
  210. }
  211. this.form.currentRegion = '' //用户啥都没选就点击勾选
  212. },
  213. }
  214. }
  215. </script>
  216. <style scoped lang="scss">
  217. .now-order {
  218. background-color: #FFF;
  219. height: 100vh;
  220. .frame {
  221. .title {
  222. display: flex;
  223. font-size: 30rpx;
  224. font-weight: 700;
  225. padding: 0rpx 0 0rpx 20rpx;
  226. margin: 20rpx 0 0 0;
  227. >span:nth-of-type(1) {
  228. margin: 4rpx 0 0 8rpx;
  229. background-color: #FFF;
  230. }
  231. >span:nth-of-type(2) {
  232. margin: 0 0 0 8rpx;
  233. background-color: #FFF;
  234. }
  235. }
  236. .basic-info {
  237. display: flex;
  238. flex-direction: column;
  239. gap: 5rpx;
  240. background-color: #FFF;
  241. //margin-top: 20rpx;
  242. padding: 20rpx 20rpx 20rpx 20rpx;
  243. .delivery-date {
  244. display: flex;
  245. align-items: center;
  246. background-color: #FFF;
  247. height: 80rpx;
  248. // margin: 10rpx 0 0 0;
  249. padding: 10rpx 0 0 20rpx;
  250. >view:nth-of-type(1) {
  251. width: 30%;
  252. // font-weight: 700;
  253. }
  254. .value {
  255. width: 70%;
  256. border-radius: 10rpx;
  257. overflow: hidden;
  258. .dateTimeCls {
  259. display: flex;
  260. align-items: center;
  261. justify-content: space-between;
  262. width: 100%;
  263. height: 80%;
  264. //border: 1px solid #b0b2b3;
  265. padding: 5rpx;
  266. border-radius: 20rpx;
  267. .date {
  268. font-size: 30rpx;
  269. display: flex;
  270. align-items: center;
  271. width: 80%;
  272. height: 100%;
  273. color: #000;
  274. }
  275. .img {
  276. display: flex;
  277. justify-content: center;
  278. align-items: center;
  279. //margin-left: 50rpx;
  280. width: 20%;
  281. //height: 100%;
  282. }
  283. }
  284. }
  285. }
  286. .tentativeQuantity {
  287. display: flex;
  288. align-items: center;
  289. background-color: #FFF;
  290. height: 80rpx;
  291. // margin: 10rpx 0 0 0;
  292. padding: 10rpx 0 0 20rpx;
  293. .key {
  294. width: 30%;
  295. }
  296. .value {
  297. width: 70%;
  298. border-radius: 10rpx;
  299. overflow: hidden;
  300. }
  301. }
  302. .Tip {
  303. display: flex;
  304. align-items: center;
  305. justify-content: center;
  306. .span {
  307. color: #999;
  308. font-size: 24rpx;
  309. }
  310. }
  311. .btns {
  312. width: 100%;
  313. display: flex;
  314. flex-direction: column;
  315. align-items: center;
  316. justify-content: center;
  317. gap: 20rpx;
  318. .ljxd {
  319. display: flex;
  320. align-items: center;
  321. justify-content: center;
  322. width: 500rpx;
  323. height: 70rpx;
  324. border-radius: 40rpx;
  325. color: #FFF;
  326. font-size: 28rpx;
  327. margin: 20rpx 10rpx 0 0;
  328. background: $uni-color;
  329. //margin-top: 20rpx;
  330. border-radius: 40rpx;
  331. }
  332. .lxwm {
  333. display: flex;
  334. align-items: center;
  335. justify-content: center;
  336. width: 500rpx;
  337. height: 70rpx;
  338. border-radius: 40rpx;
  339. color: #000000;
  340. font-size: 28rpx;
  341. margin: 20rpx 10rpx 0 0;
  342. background: #f1f1f1;
  343. //margin-top: 20rpx;
  344. border-radius: 40rpx;
  345. }
  346. .tip {
  347. display: flex;
  348. align-items: center;
  349. justify-content: center;
  350. font-size: 24rpx;
  351. color: #999;
  352. //width: 500rpx;
  353. }
  354. }
  355. .item {
  356. display: flex;
  357. align-items: center;
  358. background-color: #FFF;
  359. height: 80rpx;
  360. // margin: 10rpx 0 0 0;
  361. padding: 10rpx 0 0 20rpx;
  362. >view:nth-of-type(1) {
  363. width: 30%;
  364. // font-weight: 700;
  365. }
  366. >view:nth-of-type(2) {
  367. width: 70%;
  368. border-radius: 10rpx;
  369. overflow: hidden;
  370. input {
  371. background-color: #FFF;
  372. font-size: 28rpx;
  373. padding: 16rpx 8rpx 16rpx 15rpx;
  374. }
  375. }
  376. }
  377. .performanceBond {
  378. display: flex;
  379. align-items: center;
  380. background-color: #FFF;
  381. height: 80rpx;
  382. // margin: 10rpx 0 0 0;
  383. padding: 10rpx 0 0 20rpx;
  384. .key {
  385. width: 30%;
  386. // font-weight: 700;
  387. }
  388. .value {
  389. width: 70%;
  390. border-radius: 10rpx;
  391. overflow: hidden;
  392. input {
  393. background-color: #FFF;
  394. font-size: 28rpx;
  395. padding: 16rpx 8rpx 16rpx 15rpx;
  396. }
  397. }
  398. }
  399. .currentRegion {
  400. display: flex;
  401. align-items: center;
  402. background-color: #FFF;
  403. height: 80rpx;
  404. // margin: 10rpx 0 0 0;
  405. padding: 10rpx 0 0 20rpx;
  406. >view:nth-of-type(1) {
  407. width: 30%;
  408. // font-weight: 700;
  409. }
  410. >view:nth-of-type(2) {
  411. width: 70%;
  412. padding: 0 20rpx 0 0;
  413. display: flex;
  414. .input {
  415. background-color: #f5f5f5;
  416. // color: #a4a4a4;
  417. font-size: 28rpx;
  418. padding: 8rpx 8rpx 8rpx 15rpx;
  419. width: 350rpx;
  420. }
  421. .orientation {
  422. display: flex;
  423. padding: 10rpx 10rpx 10rpx 20rpx;
  424. font-size: 30rpx;
  425. color: #FBAB32;
  426. flex-direction: column;
  427. justify-content: center;
  428. align-items: center;
  429. }
  430. }
  431. }
  432. }
  433. }
  434. }
  435. </style>