Browse Source

小程序更新生活与首页搜索

vaecebyZ 1 year ago
parent
commit
1f76b6a486
3 changed files with 24 additions and 11 deletions
  1. 6 3
      pages/index/index.vue
  2. 11 5
      pages/index/searchResult.vue
  3. 7 3
      pages/life/index.vue

+ 6 - 3
pages/index/index.vue

@@ -139,7 +139,7 @@
                 ></image> -->
                   <view> ¥{{ item.realPrice }}</view>
                   <view class="distance">
-                    销售{{ item.saleNum.toFixed(2) }}
+                    销售{{ item.saleNum }}
                   </view>
                 </view>
               </view>
@@ -303,14 +303,17 @@ export default {
       //   },
       // });
       uni.navigateTo({
-        url: `./searchResult?column=${item.columnName}&columnId=${item.goodsCateId}&itemId=${item.id}`,
+        url: `./searchResult?column=${item.columnName}&goodsCateId=${item.goodsCateId}&columnId=${item.id}`,
       });
       console.log("item", item);
     },
     appSearch() {
       if (this.status == "noMore") return;
       this.status = "loading";
-      appSearch(this.query).then((res) => {
+      appSearch({
+        ...this.query,
+        qualityType:1,
+      }).then((res) => {
         if (res.state == "Success") {
           this.loading = false;
           let list = [];

+ 11 - 5
pages/index/searchResult.vue

@@ -148,7 +148,13 @@ export default {
     },
     getTabList() {
       // 如果是栏目点进来则更新标题
-      getSearchTypeData("?columnId="+this.query.itemId).then((res) => {
+      let query = this.query.itemId;
+      let str = "";
+      if(query){
+        str="?columnId="+query;
+        this.query.columnId=query;
+      }
+      getSearchTypeData(str).then((res) => {
         this.tabList = [
           {
             id: 0,
@@ -160,7 +166,7 @@ export default {
             cateName: "价格排序",
             child: [
               {
-                id: "acs",
+                id: "asc",
                 cateName: "价格升序",
               },
               {
@@ -183,10 +189,10 @@ export default {
     this.query.goodsName = options?.search || "";
 
     if (!this.query.goodsName) {
-      this.query.goodsCateId = options.columnId;
-      this.query.itemId=options.itemId;
+      this.query.columnId = options.columnId || "";
+      this.query.itemId = options.columnId || "";      
       uni.setNavigationBarTitle({
-        title: options.column,
+        title: options.column || "搜索结果",
       });
     }
     this.search();

+ 7 - 3
pages/life/index.vue

@@ -302,7 +302,11 @@
 			search() {
 				if(this.status == 'noMore') return
 				this.status = 'loading'
-				search(this.query).then(res=>{
+				search({
+					...this.query,
+					belongType:2,
+					isExceptGZU:true
+				}).then(res=>{
 					if(res.state == 'Success'){
 						this.loading = false
 						let list = []
@@ -392,7 +396,7 @@
 			// 广告位
 			getAdv(){
 				return new Promise((resolve,reject)=>{
-					getAdv({currentPage:1,pageSize:99,advertsType:1,status:1}).then(res=>{
+					getAdv({belongType:2,currentPage:1,pageSize:99,advertsType:1,status:1}).then(res=>{
 						if(res.state == 'Success'){
 							this.advList = res.content.records
 							// this.advList = res.content.records.filter((item,index)=>index<2)
@@ -405,7 +409,7 @@
 			// 获取商品列表内广告位
 			getGoodsAdv(){
 				return new Promise((resolve,reject)=>{
-					getAdv({currentPage:1,pageSize:99,advertsType:2,status:1}).then(res=>{
+					getAdv({belongType:2,currentPage:1,pageSize:99,advertsType:2,status:1}).then(res=>{
 						if(res.state == 'Success'){
 							this.advList1 = res.content.records
 							resolve(2)