Commit 4681e0a6 by LJM

Merge branch 'master' of http://git.ichunt.net/xiaokang/H5_2.0

parents 68c472e3 4bfb47db
......@@ -11,13 +11,14 @@
font-size: 34rpx;
font-weight: 500;
color:$uni-color333;
background: #fff;
background: #F5F5F7;
box-sizing: border-box;
padding:0 32rpx;
z-index: 1;
.icon{
font-size: 44rpx;
font-weight: normal;
color:#d1d1d1;
color:$uni-color999;
margin-right: 32rpx;
}
......@@ -29,12 +30,13 @@
}
.databox{
margin-top: 16rpx;
width:100%;
padding:0 24rpx;
background: #fff;
margin-bottom: 16rpx;
margin-bottom: 12rpx;
border-radius: 10px 10px 0px 0px;
.group{
background: #fff;
padding:24rpx 0;
border-bottom: 1rpx solid #F5F5F7;
&:last-child{border:0rpx;}
......@@ -116,4 +118,46 @@
}
}
}
.nodatabox{
padding-top: 100rpx;
text-align: center;
image{
display: block;
margin:0 auto;
width:356rpx;
height:356rpx;
margin-bottom: 28rpx;
}
color:$uni-color333;
font-size: 28rpx;
.kfqqbtns{
width: 702rpx;
height: 88rpx;
line-height: 88rpx;
background: #1969F9;
border-radius: 10px;
position: fixed;
left:24rpx;
bottom:0rpx;
font-size: 28rpx;
text-align: center;
color:#fff;
.icon{
font-size: 44rpx;
color:#fff;
margin-right: 12rpx;
position: relative;
top:4rpx;
}
}
}
.loadEnd{
height: 62rpx;
line-height: 62rpx;
background: #F5F5F7;
font-size: 22rpx;
text-align: center;
color:#C6C7CC;
}
}
\ No newline at end of file
......@@ -126,6 +126,7 @@
</template>
<script>
import {Api_Es,Ichunt_Api,Api_Url} from '@/util/api.js';
export default {
name: "addcar",
props: {
......@@ -144,10 +145,20 @@
},
methods: {
addcarpopfunc(goods_id){
console.log(goods_id)
if(goods_id){
this.popIsShow=!this.popIsShow;
this.getData(goods_id)
}
},
getData:function(goods_id){
this.request(Api_Url + "/goods/detail", 'POST', {id:this.goods_id},true,true).then(res => {
if (res.error_code == 0) {
}else{
}
});
}
},
}
......
import App from './App'
import { request } from '@/util/util.js'
import { request,setCookie,getCookie } from '@/util/util.js'
import filters from '@/filters'
import router from '@/router/index.js'
import { RouterMount } from 'uni-simple-router'
import directive from '@/directive'
import w_md5 from '@/util/md5.js'
// #ifndef VUE3
import Vue from 'vue'
......@@ -16,12 +17,29 @@ App.mpType = 'app'
//过滤器遍历
Object.keys(filters).forEach(key => Vue.filter(key, filters[key]));
//自定义指令
Vue.use(directive);
//生成临时Yo4teW_gid和Yo4teW_csrf
let time1s = parseInt(new Date().getTime() / 1000);
let gid_= w_md5.hex_md5_32(w_md5.hex_md5_32(String(time1s)+Math.random())+"usersign")
let csrf_= w_md5.hex_md5_32(w_md5.hex_md5_32(String(time1s)+Math.random())+"csrf")
if(!getCookie("Yo4teW_gid")){
setCookie('Yo4teW_gid', gid_, 7);
}
if(!getCookie("Yo4teW_csrf")){
setCookie('Yo4teW_csrf', csrf_, 7);
}
try {
function isPromise(obj) {
return (
......
......@@ -2,102 +2,125 @@
<view class="classlistpage">
<div class="lhead row verCenter">
<view class="back" v-back><text class="icon iconfont icon-arrleft"></text></view>
<view class="titlesi elep">分类列表分类列表分</view>
<view class="titlesi elep">{{class_id2_name||class_id1_name}}</view>
</div>
<view class="databox">
<view class="group">
<view class="group" v-for="(item,index) in list" :key="index">
<view class="toprs1 row bothSide">
<navigator url="#" class="row">
<view class="goodsName elep">LM358adsasd</view>
<view class="actag">95折</view>
<navigator :url="'/item?goods_id='+item.goods_id" class="row">
<view class="goodsName elep">{{item.goods_name}}</view>
<view class="actag" v-if="item.ac_type==10">{{item.activity_info.sign}}</view>
</navigator>
<view class="addcar" style="display:none;" @click="addcarpopfunc('10001')">加入购物车</view>
<view class="kfbtns" @click="addcarpopfunc('10001')">联系客服</view>
<view class="addcar" v-if="item.is_buy==1" @click="addcarpopfunc(item.goods_id)">加入购物车</view>
<view class="kfbtns" v-if="item.is_buy!=1" @click="addcarpopfunc(item.goods_id)">联系客服</view>
</view>
<view class="toprs2 row bothSide">
<view class="l2 elep"><text class="labelsd">品牌:</text>ST</view>
<view class="r2 elep"><text class="labelsd">起订量:</text>600</view>
<view class="l2 elep"><text class="labelsd">品牌:</text>{{item.brand_name}}</view>
<view class="r2 elep"><text class="labelsd">起订量:</text>{{item.moq}}</view>
</view>
<view class="toprs2 row bothSide">
<view class="l2 elep"><text class="labelsd">供应商:</text>mouser</view>
<view class="r2 elep"><text class="labelsd">库存:</text>6000000</view>
<view class="l2 elep"><text class="labelsd">供应商:</text>{{item.supplier_name}}</view>
<view class="r2 elep"><text class="labelsd">库存:</text>{{item.stock}}</view>
</view>
<view class="toprs3 row bothSide">
<view class="row">
<text class="labelsd">价格:</text>
<view class="row priceb">
<text class="p1">660+</text>
<text class="p2">130.86</text>
<text class="p3">$130.86</text>
<view class="row priceb" v-if="item.ladder_price[0]">
<text class="p1">{{item.ladder_price[0].purchases}}+</text>
<text class="p2">{{item.ladder_price[0].price_ac||item.ladder_price[0].price_cn}}</text>
<text class="p3">${{item.ladder_price[0].price_ac_us||item.ladder_price[0].price_us}}</text>
</view>
</view>
<text class="labelsd" @click="addcarpopfunc('10001')">更多阶梯价<text
class="icon iconfont icon-arrbot"></text></text>
</view>
</view>
<view class="group">
<view class="toprs1 row bothSide">
<navigator url="#" class="row">
<view class="goodsName elep">LM358adsasd</view>
<view class="actag">95折</view>
</navigator>
<view class="addcar" style="display:none;" @click="addcarpopfunc('10001')">加入购物车</view>
<view class="kfbtns" @click="addcarpopfunc('10001')">联系客服</view>
</view>
<view class="toprs2 row bothSide">
<view class="l2 elep"><text class="labelsd">品牌:</text>ST</view>
<view class="r2 elep"><text class="labelsd">起订量:</text>600</view>
</view>
<view class="toprs2 row bothSide">
<view class="l2 elep"><text class="labelsd">供应商:</text>mouser</view>
<view class="r2 elep"><text class="labelsd">库存:</text>6000000</view>
</view>
<view class="toprs3 row bothSide">
<view class="row">
<text class="labelsd">价格:</text>
<view class="row priceb">
<text class="p1">660+</text>
<text class="p2">¥130.86</text>
<text class="p3">$130.86</text>
</view>
</view>
<text class="labelsd" @click="addcarpopfunc('10001')">更多阶梯价<text
<text class="labelsd" @click="addcarpopfunc(item.goods_id)">更多阶梯价<text
class="icon iconfont icon-arrbot"></text></text>
</view>
</view>
</view>
<!-- 数据已全部加载 -->
<view v-if="isLoadEnd" class="loadEnd">—— 数据已全部加载 ——</view>
<view class="nodatabox" v-show="isInitLogin&&list.length==0">
<image src="https://img.ichunt.com/images/ichunt/202304/10/d502aef8d15d42187482a48915196270.png">
</image>
<view>抱歉,没有找到商品,您可以直接咨询客服</view>
<a class="kfqqbtns" :href="kfurl" target="_balnk">
<text class="icon iconfont icon-qq"></text>
联系客服
</a>
</view>
<addCar ref="addCarPop" />
</view>
</template>
<script>
import {Ichunt_Api} from '@/util/api.js';
import {Api_Es,Ichunt_Api} from '@/util/api.js';
import addCar from '@/components/addcar.vue';
export default {
data() {
return {
obj:"",
kfurl:"",
list:[],
isInitLogin:0,
class_id1:"",
class_id2:"",
class_id1_name:"",
class_id2_name:"",
page:1,
page_size:10,
isLoadEnd: false // 是否已全部加载完
};
},
async onReachBottom() {
// 如果正在加载中或已全部加载完,则直接返回
if (this.isLoadEnd) {
return;
}
// 开始加载数据
this.getData();
},
onShow() {
this.getData();
this.getqqurl()
},
onLoad: function(option) {
this.class_id1 = option.class_id1||"";
this.class_id2 = option.class_id2||"";
console.log(this.class_id1,this.class_id2)
},
methods: {
getData() {
this.request(Ichunt_Api + "/api/classify/getClassifyMap", 'GET', {}, ).then(res => {
getqqurl:function(){
this.request(Ichunt_Api + "/api/common/data", 'GET', {}, ).then(res => {
if (res.err_code === 0) {
this.obj=res.data;
this.actId=res.data[0].bcat_id
this.kfurl=res.data.kfqq_xk.data
}
});
},
getData() {
this.request(Api_Es + "/optimum/goods", 'POST', {class_id1:13396,page:this.page,page_size:this.page_size},true,true).then(res => {
this.isInitLogin=1;
if (res.error_code == 0) {
this.class_id1_name=res.data.class_id1_name;
this.class_id2_name=res.data.class_id2_name;
this.page++;
let newDataList = res.data.goods_lists||[];
this.list = this.list.concat(newDataList);
console.log(newDataList,this.list)
if (newDataList.length <this.page_size) {
this.isLoadEnd = true;
}
}else{
this.list=[]
}
});
},
addcarpopfunc(goods_id) {
this.$refs.addCarPop.addcarpopfunc(String(goods_id));
}
},
components: {
addCar
}
};
</script>
......
......@@ -80,9 +80,9 @@
</view>
</view>
<view class="goods-box">
<view class="titg">精选物料<text>简短的描述文字,简短的描述文字</text></view>
<view class="titg">精选物料</view>
<scroll-view class="goods-con" scroll-x="true">
<navigator :url="'/item/'+item.goods_id" class="goods-item"
<navigator :url="'/item?goods_id='+item.goods_id" class="goods-item"
v-for="(item,index) in obj.h5_home_choice_goods" :key="index">
<image :src="item.goods_images"></image>
<view class="xhg elep">{{item.goods_name}}</view>
......
......@@ -5,6 +5,9 @@ import Router from 'uni-simple-router'
Vue.use(Router)
//初始化
const router = new Router({
h5:{
loading: false,
},
APP: {
animation: {
animationType: 'pop-in',
......
......@@ -3,10 +3,6 @@ import API_BASE from '../util/api.js'
* 请求封装
*/
const request = (url = '', type = 'GET', param = {}, Loading, headertype) => {
const Yo4teW_csrf = getCookie('Yo4teW_csrf') || '';
const Yo4teW_gid = getCookie('Yo4teW_gid') || '';
const Yo4teW_uid = getCookie('Yo4teW_uid') || '';
//是否启动加载
if (Loading) {
uni.showLoading({
......@@ -18,23 +14,15 @@ const request = (url = '', type = 'GET', param = {}, Loading, headertype) => {
var params = Object.assign(param, {
pf: 2
});
//请求es相关
if (url && (url.indexOf("so12.ichunt.") != -1 || url.indexOf("so.liexin.net") != -1)) {
if (url.indexOf("so12.ichunt.") != -1 || url.indexOf("/esapi/") != -1) {
params = Object.assign(param, { hkyefgyd: 1 });
}
//如果uid没有,就添加参数ygagatetffafa,绕过验证登录
if (!Yo4teW_csrf && !Yo4teW_gid && !Yo4teW_uid) {
params = Object.assign(param, { ygagatetffafa: 1 });
}
//请求类型判断
let header = {
"Content-Type": "application/json; charset=utf-8"
}
if (headertype) {
header = {
'Content-Type': 'application/x-www-form-urlencoded'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment