orderConfirm.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <view class="order-confirm-page">
  3. <view class="address-card scale-tap" @click="goPage('/pages/crowdFunding/receivingAddress')">
  4. <view class="address-content">
  5. <view class="row">
  6. <text class="name">{{ address.name }}</text>
  7. <text class="mobile">{{ address.mobile }}</text>
  8. <text class="default" v-if="address.isDefault">默认</text>
  9. </view>
  10. <view class="address">收获地址:{{ address.fullAddress }}</view>
  11. </view>
  12. <image class="arrow" src="@/static/crowdFunding/right.png" />
  13. </view>
  14. <view class="order-section">
  15. <view class="order-row">
  16. <text>回报内容</text>
  17. <text class="right">({{ reward }}) ¥{{ price }}</text>
  18. </view>
  19. <view class="order-row">
  20. <text>众筹数量</text>
  21. <view class="right">
  22. <image
  23. src="@/static/icon/stepping_minus.png"
  24. @click="minus"
  25. class="minus"
  26. />
  27. <text class="num">{{ count }}</text>
  28. <image
  29. src="@/static/icon/stepping_add.png"
  30. @click="plus"
  31. class="plus"
  32. />
  33. </view>
  34. </view>
  35. <view class="order-row">
  36. <text>运费</text>
  37. <text class="right">包邮</text>
  38. </view>
  39. </view>
  40. <view class="remark-section">
  41. <text>填写备注</text>
  42. <input class="remark-input" placeholder="选填" v-model="remark" />
  43. </view>
  44. <view class="pay-section">
  45. <view
  46. class="pay-item"
  47. :class="{ checked: payType === 'wx' }"
  48. @click="payType = 'wx'"
  49. >
  50. <image src="@/static/icon/weixin_logo.png" class="pay-icon" />
  51. <text>微信支付</text>
  52. <image
  53. :src="
  54. payType === 'wx'
  55. ? '/static/icon/wd_icon_gouxuan05.png'
  56. : '/static/icon/wd_icon_gouxuan04.png'
  57. "
  58. class="check"
  59. />
  60. </view>
  61. <view
  62. class="pay-item"
  63. :class="{ checked: payType === 'alipay' }"
  64. @click="payType = 'alipay'"
  65. >
  66. <image src="@/static/icon/zhifubao_logon.png" class="pay-icon" />
  67. <text>支付宝</text>
  68. <image
  69. :src="
  70. payType === 'alipay'
  71. ? '/static/icon/wd_icon_gouxuan05.png'
  72. : '/static/icon/wd_icon_gouxuan04.png'
  73. "
  74. class="check"
  75. />
  76. </view>
  77. </view>
  78. <view class="protocol-section">
  79. <text class="title">免责协议:</text>
  80. <text class="content">
  81. 免责协议:
  82. 1.点击"提交订单",即表明您已阅读并同意《支持者协议》及《隐私政策》,并自愿承担众筹相应风险。
  83. 2.您参与众筹是支持将创意变为现实的过程,而不是直接的商品交易,因此存在一定风险。请您根据自己的判断选择、支持众筹项目自。众筹存在于发起人与支持者之间,摩点网作为第三方平台,只只提供网络空间、技术支持等服务。众筹的回报产品和承诺由发起人是供和作出,发起者和支持者应依法承担使用萌创星球产品产生的法律后来果。
  84. 3.众筹项目的回报发放及其他后续服务事项均由发起人负责。如果发生发起人无法发放回报、延迟发放回报、不提供回报后续服务务等情形,您需要直接和发起人协商解决。
  85. 4.众筹结束前最后1小时及众筹结束后未超过预计发货时间期间无法申请退款,具体退款规则参见《退款说明》。
  86. 5.由于发起人能力和经验不足、市场风险、法律风险等各种因素,众筹可能失败。对于在众筹期限届满前失败的项目,您支持项目的款项会全部原路退还给您;对于众筹成功的项目,支持者不能通过萌创星球平台申请退款,若此时支持者因任何原因希望退款,需直接与发起者者协商,若发起者同意退款,需直接向支持者退回款项,萌创星球不会从可可结算款项中扣除该部分退款金额。您对项目发起人的无偿支持!以及额外打赏,一旦众筹成功将不予退款,但众筹失败的情况除外。
  87. </text>
  88. </view>
  89. <view class="bom-reserveASeat"></view>
  90. <view class="order-bottom">
  91. <view class="total-wrap">
  92. <text class="label">总金额</text>
  93. <text class="price">¥{{ (price * count).toFixed(2) }}</text>
  94. </view>
  95. <view class="submit-btn blick-btn-animation" @click="submit">提交订单</view>
  96. </view>
  97. </view>
  98. </template>
  99. <script>
  100. export default {
  101. data() {
  102. return {
  103. address: {
  104. name: "戴驿宸",
  105. mobile: "17788196551",
  106. isDefault: true,
  107. fullAddress: "浙江省杭州市滨江区西兴街道启悦府",
  108. },
  109. reward: "灯塔MINI版",
  110. price: 29.9,
  111. count: 1,
  112. remark: "",
  113. payType: "wx",
  114. isSubmitting: false,
  115. lastClickTime: 0,
  116. linkid: '',
  117. };
  118. },
  119. methods: {
  120. goBack() {
  121. uni.navigateBack();
  122. },
  123. goPage(url) {
  124. uni.navigateTo({ url });
  125. },
  126. minus() {
  127. if (this.count > 1) this.count--;
  128. },
  129. plus() {
  130. this.count++;
  131. },
  132. async submit() {
  133. const now = Date.now();
  134. if (now - this.lastClickTime < 3000) {
  135. uni.showToast({ title: "请勿频繁点击", icon: "none" });
  136. return;
  137. }
  138. this.lastClickTime = now;
  139. if (this.isSubmitting) return;
  140. this.isSubmitting = true;
  141. uni.showLoading({ title: '创建订单中...' });
  142. // 创建订单
  143. uni.request({
  144. url: this.$apiHost + '/Order/submit',
  145. method: 'POST',
  146. data: {
  147. uuid: getApp().globalData.uuid,
  148. // 这里根据你的业务传递商品、数量、备注、支付方式等
  149. product_id: this.productId, // 你需要在data或props中补充
  150. count: this.count,
  151. remark: this.remark,
  152. payType: this.payType,
  153. type: 'crowdFunding'
  154. },
  155. header: {
  156. 'content-type': 'application/json',
  157. sign: getApp().globalData.headerSign
  158. },
  159. success: (res) => {
  160. if (res.data.success == 'yes') {
  161. this.linkid = res.data.linkid;
  162. // 微信支付
  163. if (this.payType === 'wx') {
  164. uni.requestPayment({
  165. provider: "wxpay",
  166. orderInfo: {
  167. appid: res.data.wepay.appid,
  168. partnerid: res.data.wepay.partnerid,
  169. prepayid: res.data.wepay.prepayid,
  170. package: "Sign=WXPay",
  171. noncestr: res.data.wepay.noncestr,
  172. timestamp: res.data.wepay.timestamp,
  173. sign: res.data.wepay.sign
  174. },
  175. success: (payRes) => {
  176. this.checkPayStatus();
  177. },
  178. fail: (err) => {
  179. uni.hideLoading();
  180. this.isSubmitting = false;
  181. uni.showToast({ title: '支付取消', icon: 'none' });
  182. }
  183. });
  184. }
  185. // 支付宝支付
  186. else if (this.payType === 'alipay') {
  187. uni.requestPayment({
  188. provider: "alipay",
  189. orderInfo: res.data.ali_pay,
  190. success: (payRes) => {
  191. this.checkPayStatus();
  192. },
  193. fail: (err) => {
  194. uni.hideLoading();
  195. this.isSubmitting = false;
  196. uni.showToast({ title: '支付取消', icon: 'none' });
  197. }
  198. });
  199. }
  200. } else {
  201. uni.hideLoading();
  202. this.isSubmitting = false;
  203. uni.showToast({ title: res.data.msg || '创建订单失败', icon: "error" });
  204. }
  205. },
  206. fail: (err) => {
  207. uni.hideLoading();
  208. this.isSubmitting = false;
  209. uni.showToast({ title: '网络错误,请稍后重试', icon: "error" });
  210. }
  211. });
  212. },
  213. // 轮询查支付状态
  214. checkPayStatus() {
  215. uni.request({
  216. url: this.$apiHost + "/Order/getstatus",
  217. data: {
  218. uuid: getApp().globalData.uuid,
  219. linkid: this.linkid,
  220. },
  221. header: {
  222. "content-type": "application/json",
  223. sign: getApp().globalData.headerSign
  224. },
  225. success: (res) => {
  226. if (res.data.success == "yes") {
  227. uni.hideLoading();
  228. uni.showToast({ title: "支付成功", icon: "none" });
  229. // 跳转到订单详情或列表
  230. uni.redirectTo({ url: '/pages/crowdFunding/orderList' });
  231. } else {
  232. setTimeout(() => { this.checkPayStatus(); }, 1000);
  233. }
  234. },
  235. fail: (err) => {
  236. uni.hideLoading();
  237. uni.showToast({ title: "网络错误,请重试", icon: "none" });
  238. }
  239. });
  240. }
  241. },
  242. };
  243. </script>
  244. <style lang="scss">
  245. page {
  246. background: #f6faf6;
  247. }
  248. .order-confirm-page {
  249. min-height: 100vh;
  250. background: #f6faf6;
  251. padding: 0 10rpx;
  252. box-sizing: border-box;
  253. .nav-bar {
  254. display: flex;
  255. align-items: center;
  256. padding: 0 32rpx;
  257. height: 100rpx;
  258. background: #fff;
  259. .back {
  260. font-size: 44rpx;
  261. }
  262. .title {
  263. font-size: 36rpx;
  264. font-weight: bold;
  265. margin-left: 32rpx;
  266. }
  267. }
  268. .address-card {
  269. background: #fff;
  270. border-radius: 18rpx;
  271. margin: 10rpx;
  272. padding: 32rpx;
  273. display: flex;
  274. align-items: center;
  275. justify-content: space-between;
  276. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  277. .address-content {
  278. flex: 1;
  279. min-width: 0;
  280. .row {
  281. display: flex;
  282. align-items: center;
  283. margin-bottom: 12rpx;
  284. .name {
  285. font-size: 32rpx;
  286. font-weight: bold;
  287. margin-right: 18rpx;
  288. color: #222;
  289. }
  290. .mobile {
  291. font-size: 32rpx;
  292. margin-right: 18rpx;
  293. color: #222;
  294. }
  295. .default {
  296. font-size: 22rpx;
  297. color: #fff;
  298. background: #1f1f1f;
  299. border-radius: 8rpx;
  300. padding: 2rpx 12rpx;
  301. margin-right: 12rpx;
  302. margin-left: 4rpx;
  303. vertical-align: middle;
  304. font-weight: 500;
  305. background: #1f1f1f;
  306. color: #acf934;
  307. }
  308. }
  309. .address {
  310. font-size: 26rpx;
  311. color: #666;
  312. white-space: nowrap;
  313. text-overflow: ellipsis;
  314. overflow: hidden;
  315. width: 90vw; // 防止溢出
  316. max-width: 600rpx;
  317. }
  318. }
  319. .arrow {
  320. width: 32rpx;
  321. height: 32rpx;
  322. flex-shrink: 0;
  323. }
  324. }
  325. .order-section {
  326. background: #fff;
  327. border-radius: 18rpx;
  328. margin: 10rpx;
  329. padding: 0 32rpx;
  330. .order-row {
  331. display: flex;
  332. align-items: center;
  333. justify-content: space-between;
  334. height: 88rpx;
  335. font-size: 30rpx;
  336. .right {
  337. display: flex;
  338. align-items: center;
  339. }
  340. .minus,
  341. .plus {
  342. width: 40rpx;
  343. height: 40rpx;
  344. border-radius: 50%;
  345. background: #1f1f1f;
  346. color: #acf934;
  347. text-align: center;
  348. // line-height: 48rpx;
  349. // font-size: 36rpx;
  350. // margin: 0 12rpx;
  351. }
  352. .num {
  353. width: 80rpx;
  354. text-align: center;
  355. }
  356. }
  357. .order-row:last-child {
  358. border-bottom: none;
  359. }
  360. }
  361. .remark-section {
  362. background: #fff;
  363. border-radius: 18rpx;
  364. margin: 10rpx;
  365. padding: 0 32rpx;
  366. display: flex;
  367. align-items: center;
  368. height: 88rpx;
  369. .remark-input {
  370. flex: 1;
  371. border: none;
  372. background: transparent;
  373. font-size: 28rpx;
  374. color: #1f1f1f;
  375. margin-left: 24rpx;
  376. }
  377. }
  378. .pay-section {
  379. background: #fff;
  380. border-radius: 18rpx;
  381. margin: 10rpx;
  382. padding: 0 32rpx;
  383. .pay-item {
  384. display: flex;
  385. align-items: center;
  386. height: 88rpx;
  387. font-size: 30rpx;
  388. position: relative;
  389. .pay-icon {
  390. width: 48rpx;
  391. height: 48rpx;
  392. margin-right: 18rpx;
  393. border-radius: 50%;
  394. }
  395. .check {
  396. position: absolute;
  397. right: 0;
  398. width: 32rpx;
  399. height: 32rpx;
  400. border-radius: 50%;
  401. }
  402. }
  403. .pay-item:last-child {
  404. border-bottom: none;
  405. }
  406. }
  407. .protocol-section {
  408. background: #fff;
  409. border-radius: 18rpx;
  410. margin: 10rpx;
  411. padding: 32rpx;
  412. .title {
  413. font-size: 28rpx;
  414. font-weight: bold;
  415. margin-bottom: 12rpx;
  416. display: block;
  417. }
  418. .content {
  419. font-size: 24rpx;
  420. color: #888;
  421. line-height: 1.7;
  422. }
  423. }
  424. .order-bottom {
  425. position: fixed;
  426. left: 0;
  427. right: 0;
  428. bottom: 0;
  429. background: #fff;
  430. display: flex;
  431. align-items: center;
  432. justify-content: flex-end;
  433. background: #fff;
  434. height: 88rpx;
  435. padding: 0 32rpx;
  436. box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.04);
  437. padding-bottom: var(--window-bottom);
  438. box-sizing: content-box;
  439. .total-wrap {
  440. display: flex;
  441. align-items: baseline;
  442. margin-right: 32rpx;
  443. .label {
  444. color: #b2b2b2;
  445. font-size: 28rpx;
  446. margin-right: 8rpx;
  447. }
  448. .price {
  449. color: #222;
  450. font-size: 32rpx;
  451. font-weight: bold;
  452. }
  453. }
  454. .submit-btn {
  455. background: #1f1f1f;
  456. color: #acf934;
  457. border-radius: 44rpx;
  458. font-size: 32rpx;
  459. font-weight: bold;
  460. width: 240rpx;
  461. height: 72rpx;
  462. text-align: center;
  463. line-height: 72rpx;
  464. margin-left: 12rpx;
  465. box-shadow: none;
  466. display: flex;
  467. align-items: center;
  468. justify-content: center;
  469. }
  470. }
  471. }
  472. .bom-reserveASeat{
  473. width: 100%;
  474. height: calc(var(--window-bottom) + 100rpx);
  475. }
  476. </style>