nonLogisticsGold.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <view class="withdraw">
  3. <view class="content">
  4. <view class="withdraw-body">
  5. <view class="gold-box">
  6. <view class="gold-item">
  7. <view class="header">
  8. <h3 class="title">存金克重</h3>
  9. <view class="live-gold">
  10. 实时金价
  11. <text class="price">{{ viprealGoldprice.toFixed(2) }}</text>
  12. </view>
  13. </view>
  14. <view class="input-box">
  15. <input
  16. type="text"
  17. class="inpu-box-ds"
  18. placeholder="请输入克重"
  19. v-model="extract"
  20. @input="onKeyInput"
  21. placeholder-style="color: #999999; font-size: 28rpx;"
  22. />
  23. </view>
  24. <view class="header">
  25. <span class="title">淘宝订单号</span>
  26. </view>
  27. <view class="input-box">
  28. <input
  29. type="text"
  30. class="inpu-box-ds"
  31. placeholder="请输入淘宝定单号"
  32. v-model="expressNo"
  33. @input="onKeyInput"
  34. placeholder-style="color: #999999; font-size: 28rpx;"
  35. />
  36. </view>
  37. </view>
  38. </view>
  39. <view class="info-money" style="font-size: 16px">
  40. <text class="info-money-num" v-if="extract"
  41. >预存金额= {{ extract }} * {{ viprealGoldprice.toFixed(2) }} =
  42. {{ totalPrice }}元</text
  43. >
  44. <text class="info-money-num" v-else>预存金额0元</text>
  45. </view>
  46. <view class="img-container">
  47. <view class="img-title">
  48. <span class="title">实物图片</span>
  49. </view>
  50. <view class="img-box" style="margin-top: 10px">
  51. <view class="upload-box">
  52. <up-upload
  53. :fileList="imageList"
  54. uploadIcon="plus"
  55. @afterRead="afterRead"
  56. @delete="deletePic"
  57. name="1"
  58. multiple
  59. :maxCount="3"
  60. >
  61. <template #trigger>
  62. <view class="upload-block">
  63. <uni-icons
  64. size="38"
  65. color="#ccc"
  66. type="plusempty"
  67. ></uni-icons>
  68. </view>
  69. </template>
  70. </up-upload>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="submit-box">
  75. <view
  76. style="margin-top: 10px"
  77. class="submit"
  78. @click="handleShowModel"
  79. >
  80. <image class="btn" src="/static/images/sb_btn.png"></image>
  81. <text class="btn-text">点击提交</text>
  82. </view>
  83. <view class="aggregate" @click="aggregate = !aggregate">
  84. <image
  85. class="choose"
  86. :src="
  87. aggregate
  88. ? '/static/recycle/choose.png'
  89. : '/static/recycle/nochoose.png'
  90. "
  91. mode="scaleToFill"
  92. ></image>
  93. <view class="aggre">
  94. 阅读并同意
  95. <span class="aggre-text" @click="showAggre">《存金协议》</span>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <uni-popup
  102. ref="singPopup"
  103. type="bottom"
  104. borderRadius="10px 10px 0 0"
  105. maskBackgroundColor="rgba(0,0,0,0)"
  106. >
  107. <view class="signContent">
  108. <scroll-view scrollY class="scroll">
  109. <up-parse :content="agreement"></up-parse>
  110. </scroll-view>
  111. <view
  112. class="comfireBtn footer"
  113. @click="
  114. aggregate = true;
  115. $refs.singPopup.close();
  116. "
  117. >
  118. 我已详细知悉
  119. </view>
  120. </view>
  121. </uni-popup>
  122. </view>
  123. </template>
  124. <script setup>
  125. import { ref, computed, watch } from "vue";
  126. import { onLoad, onShow } from "@dcloudio/uni-app";
  127. import { noLogisticsCreateAPI } from "@/api/functions";
  128. import { useImageUpload } from "@/hooks/useImageUpload";
  129. import { agreementGetoneApi } from "@/api/user";
  130. const { imageList, afterRead, deletePic, uploadLoading } = useImageUpload({
  131. pid: 9,
  132. model: "gold",
  133. });
  134. const maoding = ref(0);
  135. const props = defineProps(["viprealGoldprice"]);
  136. const singPopup = ref(null);
  137. const agreement = ref("");
  138. const type = ref("store"); // 初始值与原data一致
  139. const is_lock = ref(false);
  140. const needPrice = ref(0);
  141. const extract = ref(null);
  142. const is_post = ref(false);
  143. const totalPrice = ref(0);
  144. const aggregate = ref(false);
  145. const expressNo = ref("");
  146. // 获取协议
  147. function agreementGetoneFn() {
  148. // 资产说明
  149. agreementGetoneApi({ name: "saveGold" }).then((res) => {
  150. agreement.value = res.data?.content;
  151. });
  152. }
  153. // 页面生命周期(对应原onLoad)
  154. onShow(() => {});
  155. const showAggre = () => {
  156. agreementGetoneFn();
  157. singPopup.value?.open();
  158. };
  159. // 提交存金
  160. const handleShowModel = async () => {
  161. if (!extract.value) {
  162. return uni.showToast({
  163. title: "请输入克重",
  164. duration: 2000,
  165. icon: "none",
  166. });
  167. }
  168. if (!expressNo.value) {
  169. return uni.showToast({
  170. title: "请输入快递单号",
  171. duration: 2000,
  172. icon: "none",
  173. });
  174. }
  175. const res = await noLogisticsCreateAPI({
  176. depositWeight: extract.value,
  177. image: imageList.value.map((v) => v.info.url),
  178. taobaoOrderNo: expressNo.value,
  179. });
  180. uni.showToast({ title: "下单成功!" });
  181. setTimeout(() => {
  182. uni.navigateTo({
  183. url: "/pages/users/vault/index",
  184. });
  185. }, 1000);
  186. };
  187. watch(
  188. () => extract.value,
  189. (val) => {
  190. if (val) {
  191. totalPrice.value = (
  192. Number(extract.value) * Number(props.viprealGoldprice)
  193. ).toFixed(2);
  194. is_post.value = true;
  195. } else {
  196. is_post.value = false;
  197. }
  198. },
  199. { immediate: true }
  200. );
  201. </script>
  202. <style lang="scss" scoped>
  203. .upload-box {
  204. .upload-block {
  205. width: 160rpx;
  206. height: 160rpx;
  207. border: 1px solid #ccc;
  208. border-radius: 10rpx;
  209. display: flex;
  210. flex-direction: column;
  211. justify-content: center;
  212. align-items: center;
  213. color: #ccc;
  214. font-weight: 700;
  215. font-size: 26rpx;
  216. }
  217. }
  218. .info-money-num {
  219. color: #999999;
  220. font-size: 26rpx;
  221. }
  222. .submit-box {
  223. margin-top: 300rpx;
  224. }
  225. .submit {
  226. width: 100%;
  227. display: flex;
  228. justify-content: center;
  229. align-items: center;
  230. position: relative;
  231. .btn {
  232. width: 267rpx;
  233. height: 71rpx;
  234. }
  235. .btn-text {
  236. font-size: 30rpx;
  237. color: #000;
  238. position: absolute;
  239. top: 50%;
  240. left: 50%;
  241. transform: translate(-50%, -50%);
  242. }
  243. }
  244. .header {
  245. padding-left: 5px;
  246. position: relative;
  247. display: flex;
  248. align-items: center;
  249. justify-content: space-between;
  250. padding: 10px 10px;
  251. border-radius: 5px;
  252. // background-color: #fff;
  253. // font-weight: bold;
  254. font-size: 18px;
  255. .live-gold {
  256. font-weight: 500;
  257. font-size: 32rpx;
  258. font-family: "黑体";
  259. .price {
  260. // color: #d0a34a;
  261. color: $txt-color;
  262. margin-left: 10rpx;
  263. font-weight: bold;
  264. font-size: 38rpx;
  265. }
  266. }
  267. .item {
  268. display: flex;
  269. align-items: center;
  270. margin-top: 15px;
  271. .targe {
  272. display: flex;
  273. justify-content: center;
  274. align-items: center;
  275. color: #fff;
  276. width: 35px;
  277. height: 35px;
  278. border-radius: 50%;
  279. background-color: #cc9933;
  280. }
  281. .address {
  282. width: 440rpx;
  283. margin: 0 10px;
  284. font-size: 28rpx;
  285. .receive-address {
  286. letter-spacing: 9px;
  287. }
  288. }
  289. .end {
  290. display: flex;
  291. justify-content: center;
  292. align-items: center;
  293. .copy {
  294. color: #888888;
  295. border-radius: 3px;
  296. border: 1px solid #888888;
  297. font-size: 24rpx;
  298. padding: 6rpx 23rpx;
  299. }
  300. }
  301. }
  302. &::before {
  303. position: absolute;
  304. /*绝对定位*/
  305. top: 50%;
  306. /*Y轴方向偏移自身高度的50%*/
  307. transform: translatey(-50%);
  308. /*Y轴方向偏移微调*/
  309. left: 0;
  310. /*紧靠容器左边缘*/
  311. content: "";
  312. /*伪元素需要有内容才能显示*/
  313. width: 2px;
  314. /*伪元素宽度*/
  315. height: 15px;
  316. /*伪元素高度*/
  317. background-color: #f8c007;
  318. /*伪元素颜色*/
  319. }
  320. .title {
  321. font-weight: 500;
  322. font-size: 32rpx;
  323. font-family: "黑体";
  324. }
  325. }
  326. .gold-box {
  327. padding-top: 30rpx;
  328. .gold-item {
  329. .input-box {
  330. display: flex;
  331. background-color: #ededed;
  332. border-radius: 5px;
  333. height: 90rpx;
  334. align-items: center;
  335. justify-content: space-around;
  336. font-size: 28rpx;
  337. margin: 20rpx 0;
  338. // color:#c7c7c7 ;
  339. input {
  340. padding-left: 12rpx;
  341. width: 92%;
  342. }
  343. }
  344. }
  345. }
  346. .img-container {
  347. padding: 30rpx 0;
  348. .img-title {
  349. padding-left: 5px;
  350. position: relative;
  351. display: flex;
  352. align-items: center;
  353. justify-content: space-between;
  354. padding: 10px 10px;
  355. border-radius: 5px;
  356. font-weight: 500;
  357. font-size: 32rpx;
  358. font-family: "黑体";
  359. &::before {
  360. position: absolute;
  361. top: 50%;
  362. transform: translatey(-50%);
  363. left: 0;
  364. content: "";
  365. width: 2px;
  366. height: 15px;
  367. background-color: #daa520;
  368. }
  369. }
  370. }
  371. .withdraw {
  372. height: 100%;
  373. background-color: #f7f7f7;
  374. min-height: 100%;
  375. border-radius: 10px 10px 0 0;
  376. position: relative;
  377. // top: -20rpx;
  378. padding: 0 25rpx;
  379. top: -67rpx;
  380. &-body {
  381. // background-color: #fff;
  382. padding: 0 28rpx;
  383. font-size: 14px;
  384. .input-money {
  385. display: flex;
  386. align-items: center;
  387. justify-content: center;
  388. font-weight: 600;
  389. border-bottom: 1px solid #eaeef1;
  390. .rmb {
  391. font-size: 16px;
  392. }
  393. .t-input {
  394. height: 1.9em;
  395. font-size: 2.5em;
  396. border: none;
  397. position: relative;
  398. left: 3.5%;
  399. outline: none;
  400. }
  401. }
  402. .info-money {
  403. font-size: 26rpx;
  404. margin-left: 34rpx;
  405. &-num {
  406. color: #c9c9c9;
  407. }
  408. }
  409. .aggregate {
  410. display: flex;
  411. align-items: center;
  412. justify-content: center;
  413. padding: 10px;
  414. .aggre {
  415. font-size: 28rpx;
  416. margin-left: 10px;
  417. color: #929292;
  418. .aggre-text {
  419. color: #cc9933;
  420. }
  421. }
  422. }
  423. .choose {
  424. width: 16px;
  425. height: 16px;
  426. }
  427. }
  428. }
  429. .tx-active {
  430. button {
  431. color: #fff;
  432. background: #c4bba6;
  433. }
  434. }
  435. .signContent {
  436. background-color: #f8f8f8;
  437. padding: 20px;
  438. box-sizing: border-box;
  439. display: flex;
  440. justify-content: center;
  441. align-items: center;
  442. flex-direction: column;
  443. border-radius: 20px 20px 0 0;
  444. .scroll {
  445. // background-color: #fff;
  446. padding: 4px;
  447. height: 300px;
  448. overflow-y: hidden;
  449. border: 1px solid #dfdfdf;
  450. }
  451. .footer {
  452. margin-top: 10px;
  453. color: #fff;
  454. padding: 4px 20px;
  455. border-radius: 20px;
  456. background: linear-gradient(to right, #8ed187, #5dd665);
  457. }
  458. }
  459. </style>