submitOrder.vue 6.1 KB

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