index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  3. <tm-menubars title="" :shadow="0" :showback="false"></tm-menubars>
  4. <view class="C1b1b1b pb-10">
  5. <view class="sousuo">
  6. <tm-pickersCity class="dingwei fl" btn-color="bg-gradient-blue-accent" @confirm="okCity" :default-value="addr">
  7. <view>
  8. <text class="text-size-n">{{addr[1]}}</text>
  9. <tm-icons :size="24" color="white" name="icon-angle-down"></tm-icons>
  10. </view>
  11. </tm-pickersCity>
  12. <view>
  13. <tm-search @confirm="sosoFun" class="fl" v-model="soso" color="white" confirm-text=""></tm-search>
  14. <text class="quxiao fr" @click="goindex()">取消</text>
  15. </view>
  16. <view style="clear: both;"></view>
  17. <view v-if="sosotype==1">
  18. <text class="text-size-m fl mt-30">搜索记录</text>
  19. <view class="fr mt-30 qingchu" @click="qingkong" v-if="libiaoList.length !=0">
  20. <text class="text-size-s fl">清空记录</text>
  21. <tm-badges :offset="[0,-5]" icon="icon-times"></tm-badges>
  22. </view>
  23. </view>
  24. <view v-if="sosotype==2">
  25. <tm-dropDownMenu @change="change" :type="typeclick" un-color="white" :list="list2"></tm-dropDownMenu>
  26. </view>
  27. <view style="clear: both;"></view>
  28. </view>
  29. </view>
  30. <!-- 列表 -->
  31. <tm-grouplist class="liebiao mt-40" v-if="sosotype==1 && libiaoList.length !=0">
  32. <tm-listitem v-for="item in libiaoList" @click="sousuo(item.name)" :title="item.name" left-icon="" show-left-icon :show-right-icon="false">
  33. </tm-listitem>
  34. </tm-grouplist>
  35. <tm-empty v-if="sosotype==1 && libiaoList.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
  36. <div class="zhuti" v-if="sosotype==2">
  37. <tm-sheet class="kuang" style="padding-bottom: 30px !important;" v-if="listdata.length!=0">
  38. <view style="width: 94%;margin:0 auto;" class="remen">
  39. <view v-for="(item,index) in listdata" class="round-5 contone black mt-20" :class="index%2==0?'fl':'fr'" @click="goDetail(item.category_id)">
  40. <image class="logo" :src="item.image" mode="widthFix"></image>
  41. <view class="pa-15 text-size-s">
  42. <view class="text-overflow-2">
  43. <text class="text-size-lg">{{item.goods_name}}</text>
  44. <view class="text-gray mt-6">销量:{{item.stock_num}}</view>
  45. </view>
  46. <view class="mt-2 flex-between flex-center">
  47. <view class="touxiang mt-30">
  48. <text class="text-white text-size-m text-weight-b">{{item.market_price}}</text>
  49. </view>
  50. <view >
  51. <image @click="jiarufuFun(item)" class="remenzan" src="/static/img/86.png" mode="widthFix"></image>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view style="clear: both;"></view>
  57. <view style="clear: both;" class="more ma-40 pt-40" @click="gengmore()" v-if="this.listdata.length!=0">
  58. <image src="/static/img/30.png" mode="widthFix"></image>
  59. <text class="text-size-s">下拉加载更多~</text>
  60. </view>
  61. </view>
  62. </tm-sheet>
  63. <view style="height:60px"></view>
  64. </div>
  65. <!-- 弹出层消息 -->
  66. <tm-message ref="toast"></tm-message>
  67. </view>
  68. </template>
  69. <script>
  70. import{myRequest} from '@/api/request.js'
  71. export default {
  72. data() {
  73. return {
  74. libiaoList:[],
  75. activeIndex:0,
  76. soso:'',
  77. addr:['江西省','南昌市','西湖区'],
  78. value:'',
  79. list2: [{
  80. title: '最近上新',
  81. shang:true
  82. }, {
  83. title: '价格',
  84. shang:true
  85. },{
  86. title: '销量',
  87. shang:true
  88. }],
  89. typeclick:1,
  90. listdata:[],
  91. sosotype:1,
  92. page:1,
  93. pagesize:8,
  94. jia:1,
  95. num:1,
  96. };
  97. },
  98. onLoad() {
  99. },
  100. created() {
  101. this.sys = uni.getSystemInfoSync();
  102. this.getlishi()
  103. },
  104. methods: {
  105. goDetail(cartId){
  106. uni.navigateTo({
  107. url:'/pages/shopdetail/index?cartId='+cartId
  108. })
  109. },
  110. getlishi(){
  111. var that=this;
  112. myRequest({
  113. url: "/api/SearchHistory/searchList",
  114. method:'get',
  115. data:{}
  116. }).then(res => {
  117. if (res.data.code == 200) {
  118. that.libiaoList=res.data.data;
  119. }else{
  120. }
  121. })
  122. },
  123. qingkong(){
  124. var that=this;
  125. myRequest({
  126. url: "/api/SearchHistory/deleteSearch",
  127. method:'get',
  128. data:{}
  129. }).then(res => {
  130. if (res.data.code == 200) {
  131. that.getlishi();
  132. that.$refs.toast.show({model:'success',label:res.data.msg})
  133. }else{
  134. }
  135. })
  136. },
  137. sousuo(name){
  138. this.soso=name;
  139. this.sosoFun();
  140. },
  141. sosoFun(){
  142. let that=this;
  143. myRequest({
  144. url:'/api/ShopGoods/shopGoodsSearch',
  145. method:'post',
  146. data:{search:that.soso,page:that.page,pagesize:that.pagesize,sale_price:that.jia,sale_num:that.num}
  147. }).then(res=>{
  148. if(res.data.code==200){
  149. that.listdata=[];
  150. if(res.data.data.data){
  151. that.listdata=res.data.data.data;
  152. }else{
  153. that.listdata=[];
  154. }
  155. }else{
  156. that.$refs.toast.show({
  157. model: 'error',
  158. label: res.data.msg
  159. })
  160. }
  161. })
  162. this.sosotype=2
  163. },
  164. gengmore(){
  165. // this.randouh()
  166. },
  167. jiarufuFun(data){
  168. uni.navigateTo({
  169. url: "/pages/gouwuche/index",
  170. })
  171. // console.log(data)
  172. // this.gouwuche.push(data)
  173. },
  174. randouh(){
  175. let list2 = [],that=this;
  176. for(let i=0;i<8;i++){
  177. list2.push({
  178. image:'../../static/img/90.png',
  179. text:'帽子',
  180. jiage:'¥ 359.00',
  181. xiaol:'128'
  182. })
  183. }
  184. this.listdata=this.listdata.concat(list2)
  185. console.log(this.listdata)
  186. },
  187. goindex(){
  188. uni.navigateBack();
  189. },
  190. change(e){
  191. console.log(e);
  192. if(e.title=='价格'){
  193. if(e.shang){
  194. this.jia=1
  195. }else{
  196. this.jia=2
  197. }
  198. console.log(e.shang);
  199. }else{
  200. if(e.shang){
  201. this.num=1
  202. }else{
  203. this.num=2
  204. }
  205. }
  206. },
  207. },
  208. }
  209. </script>
  210. <style lang="scss">
  211. /deep/ .tm-menubars .body{background-color: #1b1b1b !important;}
  212. /deep/ .zhuti{padding: 10px 10px;}
  213. /deep/ .kuang{margin:0 !important;padding: 0px !important;}
  214. /deep/ .icon-search{
  215. font-size: 23px !important;
  216. color: #8E8E93 !important;
  217. }
  218. /deep/ .tm-search{
  219. width: 66%;
  220. background-color: #414141 !important;
  221. border-radius: 10px;
  222. }
  223. /deep/ .tm-search .grey-darken-5{
  224. background-color: #414141 !important;
  225. }
  226. .qingchu{background: #303440;padding:5px 15px;border-radius: 20px;width: 62px;}
  227. /deep/ .liebiao .grey-darken-4.bk{background-color: #0D0D0D !important;}
  228. /deep/ .liebiao .py-24{padding-top: 15px;padding-bottom: 15px;}
  229. /deep/ .tm-grouplist{margin:0 10px !important;}
  230. .quxiao{color: #707070;line-height: 47px;}
  231. /deep/ .tm--badges--cm{border: 1px solid #303440 !important;
  232. background-color: #303440 !important;right: -7px !important;top: 6px !important;}
  233. /deep/ .tm--badges{display: inherit !important;}
  234. .qingchu{background: #303440;padding:5px 15px;border-radius: 20px;width: 62px;}
  235. /deep/ .liebiao .grey-darken-4.bk{background-color: #0D0D0D !important;}
  236. /deep/ .liebiao .py-24{padding-top: 15px;padding-bottom: 15px;}
  237. /deep/ .tm-grouplist{margin:0 10px !important;}
  238. /deep/ .qiehuan2 .tm-tabs-con-item-border{display: none;}
  239. /deep/ .qiehuan1 .text-primary{color: white !important;}
  240. /deep/ .qiehuan2 .tm-tabs-con-item-text{
  241. font-size: 14px;
  242. background: none !important;
  243. height: 28px;
  244. vertical-align: middle;
  245. line-height: 28px;
  246. border-radius: 20px;
  247. padding-left: 14px;
  248. padding-right: 14px;
  249. margin-top: 17%;
  250. }
  251. /deep/ .qiehuan2 .text-weight-b{
  252. font-size: 14px;
  253. background: #303440 !important;
  254. height: 28px;
  255. vertical-align: middle;
  256. line-height: 28px;
  257. border-radius: 20px;
  258. padding-left: 14px;
  259. padding-right: 14px;
  260. margin-top: 17%;
  261. color: white !important;
  262. }
  263. .dingwei{width: 21%;margin-top:3%;}
  264. .shuruk{width: 77%;}
  265. .sousuo{width:94%;margin:0 auto;}
  266. .quxiao{color: #707070;line-height: 47px;}
  267. .contone{width: 48%;}
  268. .logo{width: 100%;}
  269. .remenzan{width: 18px !important;margin-top: 10px;}
  270. .more{text-align: center;}
  271. .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
  272. </style>