index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="virtual">
  3. <view class="box" :key="index">
  4. <view class="goods-item" v-for="(item,index) in goodsData" :key="index" @click="handleItem(item,item.name)">
  5. <image class="icon" :src="i.mainImg" mode=""></image>
  6. <view class="goods-info">
  7. <view class="goods-title">
  8. {{item.item_name}}
  9. </view>
  10. <view class="goods-desc">
  11. {{item.item_name}}
  12. </view>
  13. </view>
  14. <view class="price">
  15. ¥{{Number(item.channel_price).toFixed(2)}}
  16. </view>
  17. </view>
  18. </view>
  19. <u-popup :show="show" round="32rpx" mode="bottom" @close="close" @open="open">
  20. <view class="content">
  21. <view class="popup-title">会员充值</view>
  22. <view class="goods-box">
  23. <image class="icon" :src="chooseInfo.mainImg" mode=""></image>
  24. <view class="goods-info">
  25. <view class="goods-title">
  26. {{chooseInfo.item_name}}
  27. </view>
  28. <view class="goods-desc">
  29. {{chooseInfo.catalogName}}
  30. </view>
  31. </view>
  32. <view class="price">
  33. <u-loading-icon v-if="loadingPrice" text="获取价格中"></u-loading-icon>
  34. <template v-else>
  35. ¥{{chooseInfo.channel_price}}
  36. </template>
  37. </view>
  38. </view>
  39. <view class="notice">
  40. 暂不提供IOS用户进行充值业务
  41. </view>
  42. <u--form labelPosition="top" :model="form" ref="uForm" borderBottom labelWidth="180rpx" :labelStyle="{'color': '#222222',
  43. 'font-weight': 'bold','line-height':'60rpx','font-size': '28rpx'}">
  44. <u-form-item label="充值账号" prop="account" borderBottom ref="item1">
  45. <u--input v-model.trim="form.account" placeholder="请输入充值账号" border="none"></u--input>
  46. </u-form-item>
  47. </u--form>
  48. <view class="goods-describe">
  49. <rich-text :nodes="chooseInfo.goodsDescribe"></rich-text>
  50. </view>
  51. <button class="btn" type="default" :loading="loading" @click="handleBuy">确认</button>
  52. </view>
  53. </u-popup>
  54. <u-modal :show="iosShow" content='暂不提供IOS用户进行充值业务' @confirm="iosShow = false"></u-modal>
  55. </view>
  56. </template>
  57. <script>
  58. import {getVirtuallist,getVirtualInfo} from '@/api/goods.js'
  59. import {SHOP_ID} from '@/utils/config.js'
  60. export default {
  61. data() {
  62. return {
  63. show: false,
  64. iosShow: false,
  65. goodsData:[],
  66. chooseInfo:null,
  67. loading:false,
  68. loadingPrice:false,
  69. form:{
  70. account:''
  71. },
  72. }
  73. },
  74. methods: {
  75. handleItem(item,catalogName) {
  76. console.log(item,catalogName);
  77. this.chooseInfo = JSON.parse(JSON.stringify(item) )
  78. this.chooseInfo.catalogName = catalogName ||'无'
  79. // this.show = true
  80. let that = this
  81. uni.navigateTo({
  82. url:`/detail/virtualGoods/detail`,
  83. success: function(res) {
  84. // 通过eventChannel向被打开页面传送数据
  85. res.eventChannel.emit('data', that.chooseInfo)
  86. }
  87. })
  88. // this.getVirtualInfo(item.mainId)
  89. },
  90. open() {
  91. },
  92. close() {
  93. this.show = false
  94. },
  95. getVirtuallist(){
  96. uni.showLoading({
  97. title:'加载中'
  98. })
  99. getVirtuallist().then(res=>{
  100. uni.hideLoading()
  101. if(res.state == 'Success'){
  102. this.goodsData = res.content.products
  103. }
  104. })
  105. },
  106. // getVirtualInfo(commodityId){
  107. // this.loadingPrice = true
  108. // getVirtualInfo({commodityId}).then(res=>{
  109. // this.loadingPrice = false
  110. // if(res.state == 'Success'){
  111. // this.chooseInfo.price = res.content.realPrice
  112. // }
  113. // })
  114. // },
  115. },
  116. created() {
  117. this.getVirtuallist()
  118. },
  119. }
  120. </script>
  121. <style lang="scss" >
  122. .virtual {
  123. padding: 0 24rpx 80rpx;
  124. background: #fff;
  125. .title-box {
  126. display: flex;
  127. align-items: center;
  128. padding: 24rpx 0;
  129. .icon {
  130. width: 40rpx;
  131. height: 40rpx;
  132. border-radius: 50%;
  133. background: red;
  134. }
  135. .title {
  136. font-size: 32rpx;
  137. color: #222222;
  138. font-weight: bold;
  139. margin-left: 12rpx;
  140. }
  141. }
  142. .u-grid{
  143. .item{
  144. width: 218rpx;
  145. height: 218rpx;
  146. background: rgba(249,249,249,0.39);
  147. border: 2rpx solid #F0F0F0;
  148. border-radius: 16rpx;
  149. padding: 26rpx;
  150. box-sizing: border-box;
  151. margin-bottom: 24rpx;
  152. display: flex;
  153. flex-direction: column;
  154. justify-content: space-between;
  155. .item-title{
  156. font-size: 24rpx;
  157. color: #000000;
  158. font-weight: bold;
  159. margin-top: 14rpx;
  160. text-align: center;
  161. }
  162. .price{
  163. font-size: 40rpx;
  164. font-weight: bold;
  165. color: #A97D3C;
  166. margin-top: 16rpx;
  167. text-align: center;
  168. justify-self: flex-end;
  169. }
  170. }
  171. }
  172. .goods-item{
  173. display: flex;
  174. border-bottom: 2rpx solid #F0F0F0;
  175. padding: 28rpx 0;
  176. margin-top: 28rpx;
  177. .icon{
  178. width: 160rpx;
  179. height: 160rpx;
  180. border-radius: 16rpx;
  181. background: #F0F0F0;
  182. }
  183. .goods-info{
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: center;
  187. flex: 1;
  188. margin-left: 20rpx;
  189. .goods-title{
  190. font-weight: 600;
  191. font-size: 32rpx;
  192. color: #222222;
  193. }
  194. .goods-desc{
  195. font-weight: 300;
  196. font-size: 24rpx;
  197. color: #AAAAAA;
  198. margin-top: 20rpx;
  199. }
  200. }
  201. .price{
  202. font-weight: 600;
  203. font-size: 36rpx;
  204. color: $uni-color-primary;
  205. align-self: center;
  206. }
  207. }
  208. }
  209. </style>