history.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <view class="wrap">
  3. <view class="header clear">
  4. <view class="header_lf">浏览记录({{allData.total}})</view>
  5. <view class="header_rg" v-if="select === 0" @tap="changeSelect">管理</view>
  6. <view class="header_rg" v-else @tap="changeSelect">完成</view>
  7. </view>
  8. <view class="back"></view>
  9. <view class="shop_list">
  10. <view class="item" v-for="item,index in allData.browse" :key="index" @tap="toShop(item)">
  11. <view class="nav_list clear">
  12. <view class="select" v-if="select === 1" @tap.stop="changeselect(item,index)"><image :src="item.select === 1?'https://wx.fujinyangche.com/nvrnetwork/images/select.png':'https://wx.fujinyangche.com/nvrnetwork/images/no_select.png'"></image></view>
  13. <view class="nav_list_img">
  14. <image :src="url + item.imgLog"></image>
  15. </view>
  16. <view class="middle" style="float:left;width:400rpx;">
  17. <view class="clear">
  18. <view class="middle_title">{{item.name}}</view>
  19. <view class="middle_title_pai" v-if="item.status == 1">
  20. <image src="https://wx.fujinyangche.com/nvrnetwork/images/vip.png"></image>
  21. </view>
  22. </view>
  23. <view style="margin-left:20rpx;">
  24. <view class="middle_qian" v-for="item,index in item.mainBusiness" :key="index">{{item}}</view>
  25. </view>
  26. </view>
  27. <view class="recommend" v-if="item.isHot == 1">荐</view>
  28. <view class="distance">{{item.district}}</view>
  29. </view>
  30. <view class="back1"></view>
  31. </view>
  32. </view>
  33. <!-- 底部导航 -->
  34. <view class="footer" v-if="select === 1">
  35. <view class="select_all" @tap="changeSelectAll"><image :src="selectAll === 1?'https://wx.fujinyangche.com/nvrnetwork/images/select.png':'https://wx.fujinyangche.com/nvrnetwork/images/no_select.png'"></image> 全选</view>
  36. <view class="delete" @tap="del">删除</view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import api from "../../../../api.js";
  42. let app = getApp();
  43. export default {
  44. data() {
  45. return {
  46. url:app.globalData.url,
  47. select:0, //判断选择框是否出现
  48. selectAll:0, //全选按钮
  49. ids:[],//要删除id几何
  50. allData:null,//页面数据
  51. }
  52. },
  53. onLoad() {
  54. this.getData();
  55. },
  56. methods: {
  57. //加载数据
  58. getData(){
  59. let data = {
  60. token:app.globalData.token
  61. }
  62. api.getUserMyHistory(data).then((res)=>{
  63. console.log(res);
  64. this.allData = res.data.data;
  65. })
  66. },
  67. //点击管理按钮
  68. changeSelect(){
  69. if(this.select === 0){
  70. this.select = 1;
  71. }else{
  72. this.select = 0;
  73. }
  74. },
  75. //点击每个选择
  76. changeselect(item,index){
  77. if(this.allData.browse[index].select == 0){
  78. this.ids.push(item.id);
  79. this.allData.browse[index].select = 1;
  80. }else{
  81. this.ids.pop();
  82. this.allData.browse[index].select = 0;
  83. }
  84. //判断全选按钮是否选中
  85. let count = 0;
  86. let arr = this.allData.browse;
  87. for (let i = 0; i < arr.length; i++){
  88. if(arr[i].select ===1){
  89. count++;
  90. }
  91. if (count == arr.length) {//如果被选中的个数等于items的长度
  92. this.selectAll = 1 //全选checkbox选中
  93. } else {
  94. this.selectAll = 0//全选checkbox不选中
  95. }
  96. }
  97. },
  98. //全选按钮点击事件
  99. changeSelectAll(){
  100. let arr = this.allData.browse;
  101. let ids = this.ids;
  102. if(this.selectAll == 0){
  103. this.selectAll = 1;
  104. for (let i = 0; i < arr.length; i++){
  105. this.allData.browse[i].select = 1;
  106. if (ids.indexOf(arr[i].id) == -1){
  107. this.ids.push(arr[i].id)
  108. }
  109. }
  110. }else{
  111. this.ids = [];
  112. this.selectAll = 0;
  113. for (let i = 0; i < arr.length; i++){
  114. this.allData.browse[i].select = 0;
  115. }
  116. }
  117. },
  118. //删除按钮
  119. del(){
  120. let data = {
  121. ids:this.ids.join(",")
  122. }
  123. api.deleteMyhistory(data).then((res)=>{
  124. console.log(res);
  125. if(res.data.is){
  126. uni.showToast({
  127. title:res.data.msg,
  128. icon:'none',
  129. duration:2000
  130. })
  131. this.getData();
  132. }else{
  133. uni.showToast({
  134. title:res.data.msg,
  135. icon:'icon',
  136. duration:2000
  137. })
  138. }
  139. })
  140. },
  141. //进入店铺
  142. toShop(item){
  143. if(item.roleType == 1){
  144. uni.navigateTo({
  145. url:'../../service/classify/shop_detail/shop_detail?id=' + item.storeId
  146. })
  147. }
  148. }
  149. }
  150. }
  151. </script>
  152. <style>
  153. .header{
  154. height:100rpx;
  155. line-height: 100rpx;
  156. border-top:1px solid #f2f2f2;
  157. box-sizing: border-box;
  158. padding:0 30rpx;
  159. }
  160. .header_lf{
  161. float:left;
  162. font-size: 30rpx;
  163. color:#666666;
  164. }
  165. .header_rg{
  166. width:96rpx;
  167. height:44rpx;
  168. border-radius:2rpx;
  169. border:1px solid rgba(231,120,23,1);
  170. box-sizing: border-box;
  171. text-align: center;
  172. line-height: 44rpx;
  173. font-size: 22rpx;
  174. color:#E77817;
  175. float:right;
  176. margin-top:26rpx;
  177. }
  178. .clear:after{
  179. content: "";
  180. clear: both;
  181. display: block;
  182. }
  183. .shop_list{
  184. width:100%;
  185. overflow: hidden;
  186. box-sizing: border-box;
  187. background-color: #ffffff;
  188. }
  189. .nav_list{
  190. width:100%;
  191. height:208rpx;
  192. box-sizing: border-box;
  193. position: relative;
  194. padding:24rpx 0 24rpx 30rpx;
  195. }
  196. .nav_list_img{
  197. float:left;
  198. position: relative;
  199. overflow: hidden;
  200. }
  201. .end{
  202. width:170rpx;
  203. height:40rpx;
  204. background-color: #E77817;
  205. text-align: center;
  206. line-height: 40rpx;
  207. font-size: 20rpx;
  208. color:#ffffff;
  209. position: absolute;
  210. top:14rpx;
  211. left:-50rpx;
  212. transform: rotate(-45deg);
  213. display: none;
  214. }
  215. .show{
  216. display: block;
  217. }
  218. .nav_list_img image{
  219. display: block;
  220. width:160rpx;
  221. height:160rpx;
  222. border-radius: 12rpx;
  223. }
  224. .middle_title{
  225. margin-left: 20rpx;
  226. font-size: 30rpx;
  227. color:#2A2A2A;
  228. font-weight: bold;
  229. float:left;
  230. }
  231. .middle_title_pai{
  232. width:120rpx;
  233. height:37rpx;
  234. position: absolute;
  235. top:28rpx;
  236. right:30rpx;
  237. }
  238. .middle_title_pai image{
  239. display: block;
  240. width: 100%;
  241. height:100%;
  242. }
  243. .middle_qian{
  244. padding:0 16rpx;
  245. height:34rpx;
  246. background:rgba(231,120,23,0.06);
  247. border-radius:4rpx;
  248. text-align: center;
  249. line-height: 34rpx;
  250. font-size: 22rpx;
  251. color:#E77817;
  252. display: inline-block;
  253. margin: 20rpx 10rpx 0 0rpx;
  254. }
  255. /* .middle_qian:first-child{
  256. margin-left: 20rpx;
  257. } */
  258. .dengji{
  259. margin:24rpx 0 0 22rpx;
  260. }
  261. .dengji_icon{
  262. width:160rpx;
  263. height:28rpx;
  264. float:left;
  265. margin-top:4rpx;
  266. }
  267. .dengji_icon image{
  268. display: block;
  269. width:100%;
  270. height:100%;
  271. }
  272. .dengji_text{
  273. font-size: 24rpx;
  274. color:#222222;
  275. font-weight: bold;
  276. float:left;
  277. margin-left: 8rpx;
  278. }
  279. .recommend{
  280. width:28rpx;
  281. height:28rpx;
  282. color:#ffffff;
  283. font-size: 22rpx;
  284. text-align: center;
  285. line-height: 28rpx;
  286. background:linear-gradient(270deg,rgba(254,107,21,1) 0%,rgba(254,163,48,1) 100%);
  287. position: absolute;
  288. top:52rpx;
  289. right:0rpx;
  290. }
  291. .distance{
  292. font-size: 24rpx;
  293. color:#999999;
  294. position: absolute;
  295. right:30rpx;
  296. bottom:46rpx;
  297. }
  298. .select{
  299. width:40rpx;
  300. height:40rpx;
  301. float:left;
  302. margin-top:60rpx;
  303. margin-right: 30rpx;
  304. }
  305. .select image{
  306. display: block;
  307. width:100%;
  308. height:100%;
  309. }
  310. .footer{
  311. width:100%;
  312. height:100rpx;
  313. background:rgba(255,255,255,1);
  314. box-shadow:0px 4rpx 8rpx 0px rgba(0,0,0,0.5);
  315. position: fixed;
  316. bottom:0;
  317. left:0;
  318. z-index:100;
  319. }
  320. .delete{
  321. float:right;
  322. width:284rpx;
  323. height:72rpx;
  324. background:rgba(231,120,23,1);
  325. border-radius:6rpx;
  326. text-align: center;
  327. line-height: 72rpx;
  328. font-size: 30rpx;
  329. color:#ffffff;
  330. margin:14rpx 30rpx 0 0;
  331. }
  332. .select_all{
  333. width:calc(100% - 314rpx);
  334. height:100rpx;
  335. line-height: 100rpx;
  336. text-align: center;
  337. font-size: 30rpx;
  338. color:#222222;
  339. float:left;
  340. }
  341. .select_all image{
  342. display: inline-block;
  343. width: 40rpx;
  344. height:40rpx;
  345. margin-right: 6rpx;
  346. vertical-align: text-bottom;
  347. }
  348. .back1{
  349. height:10rpx;
  350. width:100%;
  351. background: #f7f7f7;
  352. }
  353. </style>