browse.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="margin-lr-sm">
  3. <view v-if="dataList.length != 0" class="flex margin-top-sm bg padding-sm radius" @click="goOrder(item)"
  4. @longpress="delData(item)" v-for="(item,index) in dataList" :key="index">
  5. <!-- <image :src="item.orderTaking.headImg?item.orderTaking.headImg: '../../static/logo.png'"
  6. style="width: 220rpx;height: 200rpx;border-radius: 10rpx;"></image> -->
  7. <view style="width: 300upx;height: 260upx;border-radius: 10rpx;">
  8. <image :src="item.headImg?item.headImg: '../../static/logo.png'" style="width: 300upx;height: 260upx;"
  9. mode="aspectFit"></image>
  10. </view>
  11. <view class=" margin-left-sm text-white flex-direction" style="width: 50%;">
  12. <view class="flex justify-between">
  13. <view class="flex">
  14. <view v-if="item.orderTaking.authentication == 2">
  15. <image src="../../static/images/qi.png" style="width: 35rpx;height: 35rpx;"></image>
  16. </view>
  17. <view class="" v-if="item.orderTaking.authentication == 1">
  18. <image src="../../static/images/geren.png"
  19. style="width: 35rpx;height: 35rpx;margin-left: 10rpx;"></image>
  20. </view>
  21. <view class="margin-right-xs u-line-1"
  22. style="margin-top: -2px;display: inline-block;width: 320rpx; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
  23. {{item.orderTaking.myLevel}}
  24. </view>
  25. </view>
  26. </view>
  27. <view style="color: #999999;font-size: 24rpx;line-height: 40rpx;"
  28. v-if="item.orderTaking.authentication == 1">
  29. <text v-if="item.sex == 1">女</text>
  30. <text v-if="item.sex == 0">男</text>
  31. /<text>{{item.age}}岁</text>
  32. /<text>{{item.orderTaking.orderLevel}}</text>
  33. /<text>{{item.orderTaking.region}}</text>
  34. </view>
  35. <view style="color: #999999;" v-if="item.authentication == 2">
  36. <text>{{item.orderTakingUserName}}</text> /<text>{{item.orderTaking.region}}</text>
  37. </view>
  38. <view class="flex radius" style="line-height: 45rpx;">
  39. <view style="width: 100%;overflow: hidden;display: flex;flex-wrap: wrap;">
  40. <text v-for="(item,index) in item.orderTaking.gameId" :key="index" class="box">{{item}}</text>
  41. </view>
  42. </view>
  43. <view
  44. style="width: 100%;display: flex;justify-content: space-between;align-items: center;margin-top: 20rpx;">
  45. <view style="color:#FF1200;font-size: 31rpx;">
  46. ¥{{item.orderTaking.oldMoney}}/月
  47. </view>
  48. <!-- <view>{{item.updateTime}}</view> -->
  49. </view>
  50. </view>
  51. </view>
  52. <empty v-if="dataList.length == 0"></empty>
  53. </view>
  54. </template>
  55. <script>
  56. import empty from '../../components/empty.vue'
  57. export default {
  58. components: {
  59. empty
  60. },
  61. data() {
  62. return {
  63. dataList: [],
  64. page: 1,
  65. limit: 10,
  66. myId: '',
  67. isVip: false,
  68. age: 0,
  69. birthDate: ''
  70. }
  71. },
  72. onLoad(e) {
  73. this.$queue.showLoading("加载中...");
  74. this.myId = uni.getStorageSync('userId')
  75. this.isVip = uni.getStorageSync('isVIP') ? uni.getStorageSync('isVIP') : false
  76. this.getBrowseList()
  77. },
  78. methods: {
  79. //换算年龄
  80. getAge(e) {
  81. console.log('出生日期:' + e)
  82. this.birthDate = e
  83. //创建系统日期
  84. var today = new Date();
  85. //把出生日期转换成日期
  86. this.birthDate = new Date(this.birthDate);
  87. //分别获取到年份后相减
  88. let age = today.getFullYear() - this.birthDate.getFullYear();
  89. return age;
  90. // console.log(this.age+'当前年龄')
  91. },
  92. // 足迹
  93. getBrowseList() {
  94. let data = {
  95. page: this.page,
  96. limit: this.limit
  97. }
  98. this.$Request.get("/app/userBrowse/myBrowse", data).then(res => {
  99. uni.hideLoading();
  100. if (res.code == 0) {
  101. if (this.page == 1) {
  102. this.dataList = res.data.list
  103. for (let i = 0; i < this.dataList.length; i++) {
  104. this.dataList[i].orderTaking.gameId = this.dataList[i].orderTaking.gameId.split(
  105. ",");
  106. // this.dataList[i].orderTaking.region = this.dataList[i].orderTaking.region.split(
  107. // ",");
  108. if (this.dataList[i].orderTaking.region) {
  109. let region = this.dataList[i].orderTaking.region.split(",");
  110. this.dataList[i].orderTaking.region = region[1]
  111. } else {
  112. this.dataList[i].orderTaking.region = '不限地区'
  113. }
  114. this.dataList[i].age = this.getAge(this.dataList[i].birthdate)
  115. }
  116. } else {
  117. this.dataList = [...this.dataList, ...res.data.list]
  118. for (let i = 0; i < this.dataList.length; i++) {
  119. this.dataList[i].orderTaking.gameId = this.dataList[i].orderTaking.gameId.split(
  120. ",");
  121. // this.dataList[i].orderTaking.region = this.dataList[i].orderTaking.region.split(
  122. // ",");
  123. if (this.dataList[i].orderTaking.region) {
  124. let region = this.dataList[i].orderTaking.region.split(",");
  125. this.dataList[i].orderTaking.region = region[1]
  126. } else {
  127. this.dataList[i].orderTaking.region = '不限地区'
  128. }
  129. this.dataList[i].age = this.getAge(this.dataList[i].birthdate)
  130. }
  131. }
  132. } else {
  133. console.log(res.msg)
  134. }
  135. uni.stopPullDownRefresh();
  136. })
  137. },
  138. // 跳转订单
  139. goOrder(e) {
  140. uni.navigateTo({
  141. url: '/pages/index/game/order?id=' + e.orderTaking.id
  142. });
  143. },
  144. // 删除
  145. delData(e) {
  146. let that = this
  147. uni.showModal({
  148. title: '提示',
  149. content: '确定删除吗?',
  150. success: function(res) {
  151. if (res.confirm) {
  152. console.log('用户点击确定');
  153. let data = {
  154. id: e.id
  155. }
  156. that.$Request.post("/app/userBrowse/deleteMyBrowse", data).then(res => {
  157. if (res.code == 0) {
  158. uni.showToast({
  159. title: '删除成功!',
  160. icon: 'none'
  161. })
  162. that.getBrowseList()
  163. }
  164. })
  165. } else if (res.cancel) {
  166. console.log('用户点击取消');
  167. }
  168. }
  169. })
  170. }
  171. },
  172. onReachBottom: function() {
  173. this.page = this.page + 1;
  174. this.getBrowseList()
  175. },
  176. onPullDownRefresh: function() {
  177. this.page = 1;
  178. this.getBrowseList()
  179. },
  180. }
  181. </script>
  182. <style>
  183. page {
  184. background-color: #f7f7f7;
  185. }
  186. .bg {
  187. background: #ffffff;
  188. }
  189. .line_s {
  190. display: inline-flex;
  191. width: 10rpx;
  192. height: 10rpx;
  193. background: #1AD566;
  194. border-radius: 50%;
  195. margin-right: 10rpx;
  196. }
  197. .line_x {
  198. display: inline-flex;
  199. width: 10rpx;
  200. height: 10rpx;
  201. background: #000000;
  202. border-radius: 50%;
  203. margin-right: 10rpx;
  204. }
  205. .box {
  206. border: 1px solid #005dff;
  207. border-radius: 4rpx;
  208. color: #005dff;
  209. padding: 0rpx 8rpx;
  210. font-size: 22rpx;
  211. margin-top: 10rpx;
  212. margin-right: 5rpx;
  213. }
  214. </style>