Browse Source

完成商品列表的显示

master
453530270@qq.com 3 years ago
parent
commit
4bcb0b08a7
  1. 2
      pages/index/components/banner.vue
  2. 13
      pages/index/components/goods.vue
  3. 35
      pages/index/index.vue
  4. 2
      utils/request/index.js

2
pages/index/components/banner.vue

@ -33,7 +33,7 @@
watch:{ watch:{
dataList:function(e){ dataList:function(e){
console.log("datalist",e) // console.log("datalist",e)
} }
}, },

13
pages/index/components/goods.vue

@ -3,7 +3,7 @@
<view class="diy-goods"> <view class="diy-goods">
<view class="goods-list display__list column__2"> <view class="goods-list display__list column__2">
<scroll-view> <scroll-view>
<view class="goods-item" v-for="(dataItem, index) in dataList" :key="index" @click="onTargetGoods(dataItem.goods_id)"> <view class="goods-item" v-for="(dataItem, index) in dataList.data" :key="index" @click="onTargetGoods(dataItem.goods_id)">
<!-- 多列商品 --> <!-- 多列商品 -->
<block> <block>
<!-- 标的图片 --> <!-- 标的图片 -->
@ -17,12 +17,12 @@
</view> </view>
<!-- 标的价格 && 销量--> <!-- 标的价格 && 销量-->
<view class="detail-price oneline-hide"> <view class="detail-price oneline-hide">
<text class="goods-price f-30 col-m">88888 {{ dataItem.goods_price }}</text> <text class="goods-price f-30 col-m"> {{ dataItem.price }}</text>
<text class="sale-count col-9 f-24">销量110 {{ dataItem.sale_count }}</text> <text class="sale-count col-9 f-24">销量110 {{ dataItem.sale_count }}</text>
</view> </view>
<!-- 标的所有者的信息 --> <!-- 标的所有者的信息 -->
<view class="detail-owner oneline-hide"> <view class="detail-owner oneline-hide">
<text class="oneline-hide"> 产权交易所 </text> <text class="oneline-hide"> {{dataItem.username}} </text>
</view> </view>
</view> </view>
@ -47,7 +47,12 @@
params: Object, params: Object,
dataList: Array dataList: Array
}, },
//
watch:{
dataList:function(e){
console.log("goods datalist",e)
}
},
/** /**
* 组件的方法列表 * 组件的方法列表
* 更新属性和数据的方法与更新页面数据的方法类似 * 更新属性和数据的方法与更新页面数据的方法类似

35
pages/index/index.vue

@ -83,32 +83,19 @@
mounted() { mounted() {
this.getBannerList(); this.getBannerList();
// //
// this.getHomeList(); this.getHomeList();
}, },
methods: { methods: {
// //
getBannerList(){ getBannerList(){
Api.pageinfo().then((res)=>{ Api.pageinfo().then((res)=>{
// console.log("fda",eval(res))
let ldata = res.data let ldata = res.data
// //
this.imglist = ldata.rotations this.imglist = ldata.rotations
}).catch(err=>{ }).catch(err=>{
console.log(err) console.log(err)
}); });
// Api.pageinfo().then(res=>{
//let aa = eval('(' + res + ')');
// let aa = JSON.stringify(res)
// console.log(aa.length)
// console.log(aa)
// if(res.resultCode =="00000000"){
// let ldata = res.data
// }
// console.log(res)
// });
}, },
// //
getHomeList(){ getHomeList(){
@ -116,28 +103,10 @@
let rqdata = {"pay_type":2,"goods_status":1,"page":1,"limit":6} let rqdata = {"pay_type":2,"goods_status":1,"page":1,"limit":6}
//let rqdata={pay_type: 1,record_type: 2,goods_status: 1,page: 1,limit: 6} //let rqdata={pay_type: 1,record_type: 2,goods_status: 1,page: 1,limit: 6}
Gapi.soglist(rqdata).then(res=>{ Gapi.soglist(rqdata).then(res=>{
if(res.resulteCode=='00000000'){ this.gdlist = res.data
this.gdlist = res.data.data
}
console.log("sgres:",res)
}).catch(err=>{ }).catch(err=>{
console.log(err) console.log(err)
}); });
//
// for(let i=0;i<5;i++){
// const obj = {
// "goods_id": 10002,
// "goods_name": "00A02",
// "selling_point": "",
// "goods_image": "http://192.168.66.16:8089/uploads/10001/20231021/be65b065b633bf469cb7bcfc15385936.jpg",
// "goods_price_min": "100.00",
// "goods_price_max": "100.00",
// "line_price_min": "120.00",
// "line_price_max": "120.00",
// "goods_sales": 0
// }
// this.gdlist.push(obj)
// }
} }
}, },

2
utils/request/index.js

@ -109,7 +109,7 @@ $http.dataFactory = async res => {
}) })
} }
console.log(res.response) // console.log(res.response)
let httpData = res.response.data let httpData = res.response.data
if (typeof httpData == "string") { if (typeof httpData == "string") {
try { try {

Loading…
Cancel
Save