wdhd-xq.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <view class="ayuu" v-if="info">
  3. <view class="hduuyr">
  4. <!-- 图片预留 -->
  5. <image :src="info.imglist[0]" mode="aspectFill" class="w-1 h-1"></image>
  6. </view>
  7. <view class="hdxqmmfr" style="position: relative;">
  8. <view class="flztoa hdlixmr">
  9. <text>{{info.title}}</text>
  10. </view>
  11. <view class="hdxiahuax"></view>
  12. <!-- @click="show = true" -->
  13. <view class="flztoa hdlixmr" @click="openLoaction">
  14. <text>{{info.city+info.address}}</text>
  15. <image src="/static/user/hda1.png" style="width: 48rpx;min-width: 48rpx;height: 48rpx;" mode=""></image>
  16. </view>
  17. <view class="hdxiahuax"></view>
  18. <view class="flztoa hdlixmr">
  19. <text>{{$u.timeFormat(info.date, 'yyyy-mm-dd hh:MM')}}</text>
  20. </view>
  21. <view class="hdxiahuax"></view>
  22. <view class="flztoa hdlixmr">
  23. <view class="fzctob">
  24. <text class="wdjga">¥</text>
  25. <!-- <text class="wdjgb">00</text>
  26. <text class="wdjgc">.00</text> -->
  27. <text class="wdjgb">{{info.price.split('.')[0]}}</text>
  28. <text class="wdjgc">.{{info.price.split('.')[1]}}</text>
  29. </view>
  30. </view>
  31. <view class="hdxiahuax"></view>
  32. <view class="" style="padding: 20rpx 24rpx;">
  33. <view class="indhuyr">
  34. <view class="indjbrr"></view>
  35. <text>活动详情</text>
  36. </view>
  37. <view class="hdxqtxtye">
  38. <rich-text :nodes="info.content"></rich-text>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="fzddrew fknbee">
  43. <view class="fzddrew fkdibr" @click="showa = true">
  44. <text>立刻报名</text>
  45. </view>
  46. </view>
  47. <u-popup v-model="show" mode="bottom" border-radius="20" :safe-area-inset-bottom="true">
  48. <view class="dituopa1 fzddrew">
  49. <view class="dituopa2">
  50. <text>腾讯地图</text>
  51. </view>
  52. <view style="background: #F4F4F4;width: 100%;height: 2rpx;"></view>
  53. <view class="dituopa2">
  54. <text>百度地图</text>
  55. </view>
  56. </view>
  57. </u-popup>
  58. <u-popup v-model="showa" mode="bottom" border-radius="20" :safe-area-inset-bottom="true">
  59. <view class="baominga1">
  60. <view class="fzjtod baominga2">
  61. <text>立刻报名</text>
  62. </view>
  63. <view style="background: #F4F4F4;width: 100%;height: 2rpx;"></view>
  64. <scroll-view style="max-height: 400rpx;" scroll-y>
  65. <view v-for="(item,index) in plist" :key="index">
  66. <view class="flztoa baominga3">
  67. <view class="">
  68. <text>姓名</text>
  69. </view>
  70. <view class="fyctoc" style="text-align: right;color: #999999;">
  71. <input type="text" v-model="item.name" placeholder-style="color: #999999;font-size: 28rpx; text-align: right;"
  72. placeholder="请输入姓名" />
  73. </view>
  74. </view>
  75. <view style="background: #F4F4F4;width: 100%;height: 2rpx;"></view>
  76. <view class="flztoa baominga3">
  77. <view class="">
  78. <text>电话</text>
  79. </view>
  80. <view class="fyctoc" style="text-align: right;color: #999999;">
  81. <input type="number" v-model="item.phone" placeholder-style="color: #999999; font-size: 28rpx; text-align: right;"
  82. placeholder="请输入电话" />
  83. </view>
  84. </view>
  85. <view style="background: #F4F4F4;width: 100%;height: 2rpx;"></view>
  86. </view>
  87. </scroll-view>
  88. <view class="flztoa baominga3">
  89. <view class="">
  90. <text>数量</text>
  91. </view>
  92. <view class="fyctoc" style="text-align: right;color: #999999;">
  93. <view class="fyctoc">
  94. <image @click="lessItem" src="/static/user/bma1.png" style="width: 32rpx;height: 32rpx;" mode=""></image>
  95. <view style="margin: 0 20rpx;">{{plist.length}}</view>
  96. <image @click="addItem" src="/static/user/bma2.png" style="width: 32rpx;height: 32rpx;" mode=""></image>
  97. </view>
  98. </view>
  99. </view>
  100. <view style="background: #F4F4F4;width: 100%;height: 2rpx;"></view>
  101. <view class="flztoa baominga3">
  102. <view class="">
  103. <text>金额</text>
  104. </view>
  105. <view class="fzctob">
  106. <text class="wdjga">¥</text>
  107. <text class="wdjgb">{{account.split('.')[0]}}</text>
  108. <text class="wdjgc">.{{account.split('.')[1]}}</text>
  109. </view>
  110. </view>
  111. <view class="fzjtod" style="margin-top: 420rpx;">
  112. <!-- <navigator class="fzddrew fkdibr" url="../lecturer/my" hover-class="none">
  113. <text>提交订单</text>
  114. </navigator> -->
  115. <view class="fzddrew fkdibr" @click="subInfo">
  116. <text>提交订单</text>
  117. </view>
  118. </view>
  119. </view>
  120. </u-popup>
  121. </view>
  122. </template>
  123. <style>
  124. page {
  125. background: #FAFAFA;
  126. }
  127. </style>
  128. <script>
  129. export default {
  130. data() {
  131. return {
  132. show: false,
  133. showa: false,
  134. showc: 1,
  135. id:0, // 活动id
  136. info:null,
  137. plist:[
  138. {
  139. name:'',
  140. phone:''
  141. }
  142. ], // 报名人数组
  143. deviceType:'wxapp'
  144. }
  145. },
  146. onLoad(e) {
  147. // #ifdef APP-PLUS
  148. this.deviceType = 'wxh5'
  149. // #endif
  150. // #ifdef MP-WEIXIN
  151. this.deviceType = 'wxapp'
  152. // #endif
  153. this.id = e.id || 0
  154. this.getDetail()
  155. },
  156. computed:{
  157. account(){
  158. if(this.info){
  159. return (this.info.price*this.plist.length).toFixed(2)
  160. }else{
  161. return 0
  162. }
  163. }
  164. },
  165. methods:{
  166. openLoaction(){
  167. uni.openLocation({
  168. latitude: this.info.lotx/1, // 纬度
  169. longitude: this.info.loty/1, // 经度
  170. name:this.info.address,
  171. success: res=> {
  172. console.log(res,'success');
  173. }
  174. });
  175. },
  176. // 加一条
  177. addItem(){
  178. console.log('+++++')
  179. this.plist.push({
  180. name:'',
  181. phone:''
  182. })
  183. },
  184. // 减一条
  185. lessItem(){
  186. if(this.plist.length>1){
  187. this.plist.pop()
  188. }
  189. },
  190. getDetail(){
  191. this.$post({
  192. data:{
  193. do:'GoodInfo',
  194. data:{
  195. id:this.id,
  196. user_id:uni.getStorageSync('id'),
  197. pw:375
  198. }
  199. }
  200. }).then(res=>{
  201. this.info = res.data
  202. })
  203. },
  204. // 提交报名信息
  205. subInfo(){
  206. let flag = this.plist.every(item=>item.name&&item.phone)
  207. if(!flag){
  208. uni.showToast({
  209. title:'请完善报名人员信息',
  210. icon:'none'
  211. })
  212. return
  213. }
  214. this.$post({
  215. data:{
  216. do:'Good',
  217. data:{
  218. good_id:this.id,
  219. is_luck:"",
  220. luck_id:"",
  221. user_id:uni.getStorageSync('id'),
  222. pw:"375",
  223. app_content:this.plist
  224. },
  225. deviceType:this.deviceType
  226. }
  227. }).then(res=>{
  228. let pay = res.data
  229. // #ifdef APP-PLUS
  230. uni.requestPayment({
  231. provider: 'wxpay',
  232. orderInfo: pay.orderinfo, //微信、支付宝订单数据 【注意微信的订单信息,键值应该全部是小写,不能采用驼峰命名】
  233. success() {
  234. uni.showToast({
  235. title: '支付成功'
  236. })
  237. setTimeout(()=>{
  238. uni.navigateTo({
  239. url:'/pages/lecturer/wdhd'
  240. })
  241. },1500)
  242. },
  243. fail(res) {
  244. console.log(res)
  245. uni.showToast({
  246. title: '支付失败',
  247. icon: 'error'
  248. })
  249. }
  250. })
  251. // #endif
  252. // #ifdef MP-WEIXIN
  253. uni.requestPayment({
  254. provider: 'wxpay',
  255. timeStamp: pay.timeStamp,
  256. nonceStr: pay.nonceStr,
  257. package: pay.package,
  258. signType: 'MD5',
  259. paySign: pay.paySign,
  260. success() {
  261. uni.showToast({
  262. title: '支付成功'
  263. })
  264. setTimeout(()=>{
  265. uni.navigateTo({
  266. url:'/pages/lecturer/wdhd'
  267. })
  268. },1500)
  269. },
  270. fail(res) {
  271. console.log(res)
  272. uni.showToast({
  273. title: '支付失败',
  274. icon: 'error'
  275. })
  276. }
  277. })
  278. // #endif
  279. })
  280. }
  281. }
  282. }
  283. </script>
  284. <style lang="scss" scoped>
  285. .dituopa2 {
  286. font-size: 28rpx;
  287. font-family: PingFang SC-Medium, PingFang SC;
  288. font-weight: 500;
  289. color: #333333;
  290. padding: 20rpx 0;
  291. }
  292. .baominga2 {
  293. font-size: 14px;
  294. font-family: Alibaba PuHuiTi-Medium, Alibaba PuHuiTi;
  295. font-weight: 500;
  296. color: #373737;
  297. padding: 30rpx 0;
  298. }
  299. .baominga3{
  300. padding: 20rpx 22rpx;
  301. font-size: 14px;
  302. font-family: PingFang SC-Medium, PingFang SC;
  303. font-weight: 500;
  304. color: #333333;
  305. }
  306. .w-1{
  307. width: 100%;
  308. }
  309. .h-1{
  310. height: 100%;
  311. }
  312. </style>