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

549 lines
12 KiB

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