yuyuechang.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <view class="content">
  3. <view class="top-bg">
  4. <image src="../../static/img/yuyue-top.jpg" mode="widthFix"></image>
  5. </view>
  6. <!-- <view class="changci-top flex">
  7. <view class="djs-wrap flex">
  8. 倒计时:
  9. <uni-countdown
  10. color="#C6914E"
  11. background-color="#F6EFDF"
  12. :show-day="false"
  13. :day="0"
  14. :hour="0"
  15. :minute="0"
  16. :second="0"
  17. ></uni-countdown>
  18. </view>
  19. <view class="user-info">
  20. <view class="" style="text-align: right;">
  21. 消费账户:{{userInfo.now_money*1 || '0'}}
  22. </view>
  23. <view class="" style="text-align: right;">
  24. 广告值: {{userInfo.aid_val*1 || '0'}}
  25. </view>
  26. </view>
  27. </view> -->
  28. <view class="" v-for="item in area">
  29. <view class="good-tit flex">
  30. <view class="tit-left flex">
  31. <image src="../../static/icon/red-tit.png" mode=""></image>{{item.name}}
  32. </view>
  33. <view class="tit-right">
  34. 实付金额:{{item.low}} ~ {{ item.high }}
  35. </view>
  36. </view>
  37. <view class="good-list flex" @click="(status==2 ||status==0) ?goumai(item): opentc()">
  38. <image src="../../static/icon/red-gift.png" mode="widthFix" v-for="itemg in 35"></image>
  39. </view>
  40. </view>
  41. <uni-popup ref="popupyyok" type="center">
  42. <view class="popupyyok-wrap">
  43. <image :src="good.image" mode=""></image>
  44. <view class="clamp2" style="padding: 20rpx 80rpx;color: #999999;font-size: 26rpx;">
  45. {{good.name}}
  46. </view>
  47. <view class="" style="font-size: 35rpx;font-weight: bold;color: #333333;">
  48. {{good.price}}
  49. </view>
  50. <view class="btn" @click="good.status == 1 ?zhifu(): goDetail()">
  51. {{(good.status == 1 ||good.status == 0) ? '立即支付':'查看详情'}}
  52. </view>
  53. </view>
  54. </uni-popup>
  55. <uni-popup ref="uppass" type="center">
  56. <view class="psw-wrapper">
  57. <view class="psw-title">请输入支付密码</view>
  58. <input type="password" v-model="password" class="psw-ipt"/>
  59. <view class="psw-btn">
  60. <text @click="cancel">取消</text>
  61. <text class="psw-qd" @click="pswQd">确定</text>
  62. </view>
  63. </view>
  64. </uni-popup>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. section,
  70. purchase,
  71. zfpay,
  72. see_order
  73. } from '@/api/index.js'
  74. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  75. import {
  76. mapState,
  77. mapMutations
  78. } from 'vuex';
  79. export default {
  80. components: {
  81. uniCountdown
  82. },
  83. data() {
  84. return {
  85. ccid: '',
  86. area: [],
  87. good: {},
  88. status: 2, //1购买了商品2未购买商品
  89. password: ''//交易密码
  90. }
  91. },
  92. computed: {
  93. ...mapState('user', ['userInfo'])
  94. },
  95. onLoad(opt) {
  96. this.ccid = opt.id
  97. this.see_order()
  98. this.section()
  99. },
  100. methods: {
  101. see_order() {
  102. let obj = this
  103. see_order({
  104. id: obj.ccid
  105. }).then(res => {
  106. console.log(res.data.status)
  107. obj.status = res.data.status
  108. if (res.data.status == 1) {
  109. obj.good = res.data.order
  110. }
  111. })
  112. },
  113. section() {
  114. let obj = this
  115. section({
  116. id: obj.ccid
  117. }).then(res => {
  118. console.log(res)
  119. obj.area = res.data
  120. })
  121. },
  122. goumai(item) {
  123. let obj = this
  124. purchase({
  125. id: obj.ccid,
  126. s_id: item.id
  127. }).then(res => {
  128. console.log(res)
  129. obj.good = res.data
  130. obj.$refs.popupyyok.open()
  131. })
  132. },
  133. zhifu() {
  134. let obj = this
  135. // zfpay({
  136. // order_id: obj.good.order_id
  137. // }).then(res => {
  138. // obj.$api.msg('支付成功')
  139. // obj.$refs.popupyyok.close()
  140. // })
  141. obj.$refs.popupyyok.close()
  142. obj.$refs.uppass.open()
  143. },
  144. opentc() {
  145. let obj = this
  146. obj.$refs.popupyyok.open()
  147. },
  148. goDetail() {
  149. uni.navigateTo({
  150. url: ''
  151. })
  152. },
  153. cancel() {
  154. let obj = this
  155. obj.$refs.uppass.close()
  156. },
  157. pswQd() {
  158. let obj = this
  159. zfpay({
  160. order_id: obj.good.order_id,
  161. pas: obj.password
  162. }).then(res => {
  163. obj.$api.msg('支付成功')
  164. obj.$refs.uppass.close()
  165. })
  166. },
  167. tishi() {
  168. return this.$api.msg('当前商品已售罄')
  169. }
  170. }
  171. }
  172. </script>
  173. <style lang="scss" scoped>
  174. .changci-top {
  175. background-color: #fff;
  176. padding: 0 25rpx;
  177. height: 100rpx;
  178. .djs-wrap {
  179. padding-left: 25rpx;
  180. }
  181. }
  182. .good-tit {
  183. // margin-top: 20rpx;
  184. background-color: #fff;
  185. padding: 20rpx;
  186. .tit-left {
  187. flex-shrink: 0;
  188. image {
  189. height: 36rpx;
  190. width: 36rpx;
  191. border-radius: 50%;
  192. margin-right: 10rpx;
  193. }
  194. }
  195. .tit-right {
  196. text-align: right;
  197. }
  198. }
  199. .good-list {
  200. flex-wrap: wrap;
  201. background-color: #fff;
  202. padding: 20rpx;
  203. // justify-content: flex-start;
  204. image {
  205. width: 80rpx;
  206. margin-left: 15rpx;
  207. }
  208. }
  209. .popupyyok-wrap {
  210. height: 707rpx;
  211. width: 551rpx;
  212. background-color: #fff;
  213. border-radius: 20rpx;
  214. text-align: center;
  215. // position: relative;
  216. image {
  217. width: 100%;
  218. height: 429rpx;
  219. }
  220. .btn {
  221. position: absolute;
  222. bottom: 10rpx;
  223. left: 0;
  224. right: 0;
  225. margin: auto;
  226. width: 295rpx;
  227. line-height: 69rpx;
  228. border-radius: 34rpx;
  229. background: #303030;
  230. color: #F8DABA;
  231. font-size: 35rpx;
  232. color: #F8DABA;
  233. }
  234. }
  235. .top-bg {
  236. width: 750rpx;
  237. margin-bottom: 20rpx;
  238. image {
  239. width: 100%;
  240. }
  241. }
  242. .uppass-wrap {
  243. width: 600rpx;
  244. height: 300rpx;
  245. background-color: #fff;
  246. border-radius: 20rpx;
  247. .up-tit {
  248. line-height: 100rpx;
  249. font-size: 32rpx;
  250. font-weight: bold;
  251. text-align: center;
  252. }
  253. .up-ipt {
  254. border: 1px solid #000000;
  255. display: block;
  256. width: 400rpx;
  257. background-color: #bfa;
  258. height: 100rpx;
  259. line-height: 100rpx;
  260. font-size: 28rpx;
  261. margin: auto;
  262. margin-top: 20rpx;
  263. }
  264. }
  265. .psw-wrapper {
  266. width: 548rpx;
  267. height: 344rpx;
  268. background-color: #FFFFFF;
  269. border-radius: 15rpx 15rpx;
  270. .psw-title {
  271. width: 100%;
  272. font-size: 35rpx;
  273. padding: 43rpx 0 49rpx;
  274. text-align: center;
  275. font-weight: 800;
  276. }
  277. .psw-ipt {
  278. display: block;
  279. background-color: #dce3ed;
  280. height: 90rpx;
  281. width: 464rpx;
  282. padding-left: 30rpx;
  283. margin: 0 auto;
  284. font-size: 80rpx;
  285. }
  286. .psw-btn text{
  287. display: inline-block;
  288. text-align: center;
  289. width: 50%;
  290. padding-top: 29rpx;
  291. font-size: 35rpx;
  292. }
  293. .psw-qd {
  294. color:#5771DF;
  295. }
  296. }
  297. </style>