submitOrder.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <view class="">
  3. <view class="top">
  4. <view class="image">
  5. <image src="https://t38.9026.com/uploads/golf/images/2022-05-31/20220531601652.png"></image>
  6. </view>
  7. <view class="">
  8. <view class="" style="font-size: 32rpx;font-weight: 600;">
  9. {{suborder.name}}
  10. </view>
  11. <view class="" style="font-size: 28rpx;margin-top: 20rpx;">
  12. 日期:{{suborder.day}}
  13. </view>
  14. </view>
  15. </view>
  16. <view class="" style="padding: 0 30rpx;color: #666666;">
  17. <!-- 夕阳红康养团是为中老年特别定制的康养方案这个团 非常好 -->
  18. {{suborder.subtitle?suborder.subtitle:''}}
  19. </view>
  20. <view class="suborder">
  21. <view class="name">
  22. 出行人姓名:<text v-for="(item,index) in peoplelist" :key="index" style="margin: 0 10rpx;">{{item}}</text>
  23. </view>
  24. <view class="contract">
  25. <u-cell-group>
  26. <u-cell title="合同预览" isLink url="./contract" :titleStyle="{'font-weight': 'bold'}" size="large">
  27. </u-cell>
  28. </u-cell-group>
  29. </view>
  30. <view class="checkbox">
  31. <u-checkbox-group v-model="agree" size="32" iconPlacement="right" placement="row"
  32. >
  33. <u-checkbox activeColor="#31866F" inactiveColor="#0A243F" :name="item.name" :checked="checked" @change="checked=!checked"></u-checkbox>
  34. </u-checkbox-group>
  35. <view class="text">
  36. 我已阅读并同意报名须知 <text style="text-decoration: underline;padding: 6rpx;" @click="notification">安全告知
  37. </text> 和
  38. <text style="text-decoration: underline;padding: 6rpx;" @click="Policy">隐私政策</text>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="navbar">
  43. <u-count-down :time="2* 60 * 60 * 1000" format="HH:mm:ss" @change="onChange">
  44. <view class="time">
  45. <text>订单支付倒计时:</text>
  46. <text class="time__item">{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}&nbsp;时</text>
  47. <text class="time__item">{{ timeData.minutes }}&nbsp;分</text>
  48. <text class="time__item">{{ timeData.seconds }}&nbsp;秒</text>
  49. </view>
  50. </u-count-down>
  51. <view class="navbar-item">
  52. 总金额 ¥{{suborder.total}}
  53. </view>
  54. <view class="navbar-item want" @click="Submit">
  55. 去支付
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. let that
  62. export default {
  63. data() {
  64. return {
  65. suborder: {},
  66. peoplelist: [],
  67. checked:false,
  68. timeData:2
  69. }
  70. },
  71. onLoad(options) {
  72. that=this
  73. // JSON.parse(val.content);
  74. // console.log(options.suborder)
  75. console.log(options)
  76. let sub = decodeURIComponent(options.suborder)
  77. let suborder=JSON.parse(sub)
  78. // this.init(suborder)
  79. this.suborder = suborder
  80. console.log(suborder)
  81. this.suborder.people.forEach((item, index) => {
  82. this.peoplelist.push(item)
  83. })
  84. },
  85. // onShow() {
  86. // const pages= getCurrentPages();//获取应用页面栈
  87. // let aaa= pages[pages.length - 1].options//获取页面传递的信息
  88. // console.log(aaa)
  89. // },
  90. methods: {
  91. // init(val){
  92. // this.suborder=val
  93. // let list=[]
  94. // this.suborder.forEach((item,index)=>{
  95. // list.push(item.name)
  96. // })
  97. // this.peoplelist=list
  98. // },
  99. onChange(e) {
  100. this.timeData = e
  101. },
  102. checkboxChange(n) {
  103. console.log('change', n);
  104. },
  105. gocontract() {
  106. uni.navigateTo({
  107. url: "./contract"
  108. })
  109. },
  110. // 支付
  111. Submit(){
  112. if(!this.checked){
  113. this.$toast("请阅读安全告知和隐私政策")
  114. return
  115. }
  116. uni.$u.http.post('/api/order/config',{
  117. order_id:this.suborder.order_id,
  118. }).then(res=>{
  119. console.log(res)
  120. uni.requestPayment({
  121. provider: 'wxpay', //支付类型-固定值
  122. timeStamp: res.timeStamp, // 时间戳(单位:秒)
  123. nonceStr: res.nonceStr, // 随机字符串
  124. package: res.package, // 固定值
  125. signType: res.signType, //固定值
  126. paySign: res.paySign, //签名
  127. success: function (res) {
  128. // console.log('success:' + JSON.stringify(res));
  129. console.log("支付成功");
  130. uni.redirectTo({
  131. url:"/pages/order/successpay?id="+that.suborder.order_id
  132. })
  133. },
  134. fail: function (err) {
  135. uni.redirectTo({
  136. url:"/pages/order/orderDetail?id="+that.suborder.order_id
  137. })
  138. }
  139. });
  140. }).catch(err=>{
  141. console.log(err)
  142. uni.showToast({
  143. icon:"error",
  144. title:err.message,
  145. })
  146. })
  147. },
  148. notification() {
  149. uni.navigateTo({
  150. url: "/pages/userCenter/notification"
  151. })
  152. },
  153. Policy() {
  154. uni.navigateTo({
  155. url: "/pages/userCenter/Policy"
  156. })
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="less">
  162. .u-cell__body--large.data-v-913eaa32 {
  163. padding: 48rpx 0 !important;
  164. box-sizing: border-box;
  165. }
  166. page {
  167. background-color: #F4F4F4;
  168. font-size: 30rpx;
  169. }
  170. .checkbox {
  171. display: flex;
  172. padding: 30rpx;
  173. .text {
  174. margin-left: 10rpx;
  175. font-size: 26rpx;
  176. }
  177. }
  178. .top {
  179. margin-top: 32rpx;
  180. padding: 10rpx 30rpx;
  181. display: flex;
  182. align-items: center;
  183. align-items: center;
  184. margin-bottom: 20rpx;
  185. .image {
  186. margin-right: 20rpx;
  187. image {
  188. width: 180rpx;
  189. height: 110rpx;
  190. }
  191. }
  192. }
  193. .suborder {
  194. position: relative;
  195. margin-top: 30rpx;
  196. padding: 48rpx 30rpx;
  197. background-color: #fff;
  198. border-radius: 0px 56rpx 0px 0px;
  199. height: calc(100vh - 323rpx);
  200. box-sizing: border-box;
  201. .name {
  202. // padding: 30rpx;
  203. margin-bottom: 48rpx;
  204. }
  205. .contract {
  206. margin-top: 50rpx;
  207. }
  208. }
  209. .navbar {
  210. margin-top: 104rpx;
  211. display: flex;
  212. justify-content: space-between;
  213. align-items: center;
  214. bottom: 0;
  215. left: 0;
  216. position: fixed;
  217. width: 100%;
  218. height: 104rpx;
  219. background: #1E9F6A;
  220. border-radius: 16rpx 16rpx 0px 0px;
  221. color: #ffffff;
  222. z-index: 999;
  223. .navbar-item {
  224. width: 50%;
  225. text-align: center;
  226. }
  227. .want {
  228. border-left: 1rpx solid #FFFFFF;
  229. }
  230. .time {
  231. color:red;
  232. position: absolute;
  233. left: 0;
  234. bottom: 105rpx;
  235. width: 100%;
  236. background-color: #F4F4F4;
  237. border-radius: 16rpx 16rpx 0px 0px;
  238. display: flex;
  239. padding: 24rpx 0rpx 24rpx 30rpx;
  240. box-sizing: border-box;
  241. }
  242. }
  243. </style>