browse.vue 6.2 KB

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