yuyuechang.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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="" @click.stop="goDetail()"></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.actual_price}}
  49. </view>
  50. <view class="btn" @click.stop="(good.status == 1 || good.status == 0) ?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. <view class="psw-content">购买需支付消费积分</view>
  59. <view class="psw-price">
  60. {{good.actual_price}}
  61. </view>
  62. <view class="psw-jg"></view>
  63. <view class="psw-paytype flex">
  64. <view class="">
  65. 支付方式
  66. </view>
  67. <view class="">
  68. 消费积分
  69. </view>
  70. </view>
  71. <input type="password" v-model="password" class="psw-ipt"/>
  72. <view class="psw-btn">
  73. <text @click="cancel">取消</text>
  74. <text class="psw-qd" @click="pswQd">确定</text>
  75. </view>
  76. </view>
  77. </uni-popup>
  78. </view>
  79. </template>
  80. <script>
  81. import {
  82. section,
  83. purchase,
  84. zfpay,
  85. see_order
  86. } from '@/api/index.js'
  87. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  88. import {
  89. mapState,
  90. mapMutations
  91. } from 'vuex';
  92. export default {
  93. components: {
  94. uniCountdown
  95. },
  96. data() {
  97. return {
  98. ccid: '',
  99. area: [],
  100. good: {},
  101. status: 2, //1购买了商品2未购买商品
  102. password: ''//交易密码
  103. }
  104. },
  105. computed: {
  106. ...mapState('user', ['userInfo'])
  107. },
  108. onLoad(opt) {
  109. this.ccid = opt.id
  110. this.see_order()
  111. this.section()
  112. },
  113. methods: {
  114. see_order() {
  115. let obj = this
  116. see_order({
  117. id: obj.ccid
  118. }).then(res => {
  119. console.log(res.data.status)
  120. obj.status = res.data.status
  121. if (res.data.status == 1) {
  122. obj.good = res.data.order
  123. obj.$refs.popupyyok.open()
  124. }
  125. })
  126. },
  127. section() {
  128. let obj = this
  129. section({
  130. id: obj.ccid
  131. }).then(res => {
  132. console.log(res)
  133. obj.area = res.data
  134. })
  135. },
  136. goumai(item) {
  137. let obj = this
  138. purchase({
  139. id: obj.ccid,
  140. s_id: item.id
  141. }).then(res => {
  142. console.log(res)
  143. obj.good = res.data
  144. obj.good.status = 1
  145. obj.$refs.popupyyok.open()
  146. })
  147. },
  148. zhifu() {
  149. let obj = this
  150. // zfpay({
  151. // order_id: obj.good.order_id
  152. // }).then(res => {
  153. // obj.$api.msg('支付成功')
  154. // obj.$refs.popupyyok.close()
  155. // })
  156. obj.$refs.popupyyok.close()
  157. obj.$refs.uppass.open()
  158. },
  159. opentc() {
  160. let obj = this
  161. obj.$refs.popupyyok.open()
  162. },
  163. goDetail() {
  164. console.log(this.good)
  165. uni.navigateTo({
  166. url: '/pages/product/showpro?id=' + this.good.product_id
  167. })
  168. },
  169. cancel() {
  170. let obj = this
  171. obj.$refs.uppass.close()
  172. },
  173. pswQd() {
  174. let obj = this
  175. zfpay({
  176. order_id: obj.good.order_id,
  177. pas: obj.password
  178. }).then(res => {
  179. obj.$api.msg('支付成功')
  180. obj.$refs.uppass.close()
  181. })
  182. },
  183. tishi() {
  184. return this.$api.msg('当前商品已售罄')
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="scss" scoped>
  190. .changci-top {
  191. background-color: #fff;
  192. padding: 0 25rpx;
  193. height: 100rpx;
  194. .djs-wrap {
  195. padding-left: 25rpx;
  196. }
  197. }
  198. .good-tit {
  199. // margin-top: 20rpx;
  200. background-color: #fff;
  201. padding: 20rpx;
  202. .tit-left {
  203. flex-shrink: 0;
  204. image {
  205. height: 36rpx;
  206. width: 36rpx;
  207. border-radius: 50%;
  208. margin-right: 10rpx;
  209. }
  210. }
  211. .tit-right {
  212. text-align: right;
  213. }
  214. }
  215. .good-list {
  216. flex-wrap: wrap;
  217. background-color: #fff;
  218. padding: 20rpx;
  219. // justify-content: flex-start;
  220. image {
  221. width: 80rpx;
  222. margin-left: 15rpx;
  223. }
  224. }
  225. .popupyyok-wrap {
  226. height: 707rpx;
  227. width: 551rpx;
  228. background-color: #fff;
  229. border-radius: 20rpx;
  230. text-align: center;
  231. // position: relative;
  232. image {
  233. width: 100%;
  234. height: 429rpx;
  235. border-radius: 20rpx 20rpx 0 0;
  236. }
  237. .btn {
  238. position: absolute;
  239. bottom: 10rpx;
  240. left: 0;
  241. right: 0;
  242. margin: auto;
  243. width: 295rpx;
  244. line-height: 69rpx;
  245. border-radius: 34rpx;
  246. background: #303030;
  247. color: #F8DABA;
  248. font-size: 35rpx;
  249. color: #F8DABA;
  250. }
  251. }
  252. .top-bg {
  253. width: 750rpx;
  254. margin-bottom: 20rpx;
  255. image {
  256. width: 100%;
  257. }
  258. }
  259. .uppass-wrap {
  260. width: 600rpx;
  261. height: 300rpx;
  262. background-color: #fff;
  263. border-radius: 20rpx;
  264. .up-tit {
  265. line-height: 100rpx;
  266. font-size: 32rpx;
  267. font-weight: bold;
  268. text-align: center;
  269. }
  270. .up-ipt {
  271. border: 1px solid #000000;
  272. display: block;
  273. width: 400rpx;
  274. background-color: #bfa;
  275. height: 100rpx;
  276. line-height: 100rpx;
  277. font-size: 28rpx;
  278. margin: auto;
  279. margin-top: 20rpx;
  280. }
  281. }
  282. .psw-wrapper {
  283. width: 548rpx;
  284. height: 548rpx;
  285. background-color: #FFFFFF;
  286. border-radius: 15rpx 15rpx;
  287. .psw-title {
  288. width: 100%;
  289. font-size: 35rpx;
  290. padding: 43rpx 0 40rpx;
  291. text-align: center;
  292. font-weight: 800;
  293. }
  294. .psw-content {
  295. width: 100%;
  296. font-size: 32rpx;
  297. text-align: center;
  298. }
  299. .psw-price {
  300. font-weight: bold;
  301. font-size: 68rpx;
  302. text-align: center;
  303. padding-top: 10rpx;
  304. }
  305. .psw-jg {
  306. height: 1px;
  307. width: 500rpx;
  308. background-color: #eee;
  309. margin: auto;
  310. }
  311. .psw-paytype {
  312. justify-content: space-between;
  313. padding: 10rpx 25rpx 30rpx;
  314. font-size: 26rpx;
  315. }
  316. .psw-ipt {
  317. display: block;
  318. background-color: #dce3ed;
  319. height: 90rpx;
  320. width: 464rpx;
  321. padding-left: 30rpx;
  322. margin: 0 auto;
  323. font-size: 80rpx;
  324. }
  325. .psw-btn text{
  326. display: inline-block;
  327. text-align: center;
  328. width: 50%;
  329. padding-top: 29rpx;
  330. font-size: 35rpx;
  331. }
  332. .psw-qd {
  333. color:#5771DF;
  334. }
  335. }
  336. </style>