Gao xiaosong 4 years ago
parent
commit
82d1739127
  1. 8
      api/store.js
  2. 5
      config/index.js
  3. 1590
      pages/shop/GoodsCon/index.vue
  4. 483
      pages/shop/GoodsList/index.vue
  5. 14
      pages/user/User/index.vue

8
api/store.js

@ -35,6 +35,14 @@ export function getProducts(q) {
login: false login: false
}); });
} }
/*
* 积分商品列表
* */
export function getProductsIntegral(q) {
return request.get("/products/integral", q, {
login: false
});
}
/* /*
* 购物车数量 * 购物车数量

5
config/index.js

@ -1,7 +1,8 @@
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'; // export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api';
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'; // export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; export const VUE_APP_API_URL = 'https://tapi.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static'; export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static';

1590
pages/shop/GoodsCon/index.vue

File diff suppressed because it is too large Load Diff

483
pages/shop/GoodsList/index.vue

@ -6,20 +6,11 @@
<input placeholder="搜索商品信息" v-model="where.keyword" /> <input placeholder="搜索商品信息" v-model="where.keyword" />
<text class="iconfont icon-sousuo" @click="submitForm"></text> <text class="iconfont icon-sousuo" @click="submitForm"></text>
</view> </view>
<view <view class="iconfont" :class="Switch === true ? 'icon-pailie' : 'icon-tupianpailie'" @click="switchTap"></view>
class="iconfont"
:class="Switch === true ? 'icon-pailie' : 'icon-tupianpailie'"
@click="switchTap"
></view>
</view> </view>
</form> </form>
<view class="nav acea-row row-middle"> <view class="nav acea-row row-middle">
<view <view class="item" :class="title ? 'font-color-red' : ''" @click="set_where(0)">{{ title ? title : "默认" }}</view>
class="item"
:class="title ? 'font-color-red' : ''"
@click="set_where(0)"
>{{ title ? title : "默认" }}</view
>
<view class="item" @click="set_where(1)"> <view class="item" @click="set_where(1)">
价格 价格
<image src="@/static/images/horn.png" v-if="price === 0" /> <image src="@/static/images/horn.png" v-if="price === 0" />
@ -33,274 +24,276 @@
<image src="@/static/images/down.png" v-if="stock === 2" /> <image src="@/static/images/down.png" v-if="stock === 2" />
</view> </view>
<!-- down --> <!-- down -->
<view <view class="item" :class="nows ? 'font-color-red' : ''" @click="set_where(3)">新品</view>
class="item"
:class="nows ? 'font-color-red' : ''"
@click="set_where(3)"
>新品</view
>
</view> </view>
<view <view class="list acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'" ref="container"
class="list acea-row row-between-wrapper" v-if="isIntegral=='false'">
:class="Switch === true ? '' : 'on'" <view @click="goGoodsCon(item)" class="item" :class="Switch === true ? '' : 'on'"
ref="container" v-for="(item, productListIndex) in productList" :key="productListIndex" :title="item.storeName">
>
<view
@click="goGoodsCon(item)"
class="item"
:class="Switch === true ? '' : 'on'"
v-for="(item, productListIndex) in productList"
:key="productListIndex"
:title="item.storeName"
>
<view class="pictrue" :class="Switch === true ? '' : 'on'"> <view class="pictrue" :class="Switch === true ? '' : 'on'">
<image :src="item.image" :class="Switch === true ? '' : 'on'" /> <image :src="item.image" :class="Switch === true ? '' : 'on'" />
</view> </view>
<view class="text" :class="Switch === true ? '' : 'on'"> <view class="text" :class="Switch === true ? '' : 'on'">
<view class="name line1">{{ item.storeName }}</view> <view class="name line1">{{ item.storeName }}</view>
<view <view class="money font-color-red" :class="Switch === true ? '' : 'on'">
class="money font-color-red"
:class="Switch === true ? '' : 'on'"
>
<text class="num">{{ item.price }}</text> <text class="num">{{ item.price }}</text>
</view> </view>
<view <view class="vip acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'">
class="vip acea-row row-between-wrapper"
:class="Switch === true ? '' : 'on'"
>
<view class="vip-money">{{ item.otPrice }}</view> <view class="vip-money">{{ item.otPrice }}</view>
<view>已售{{ item.sales }}</view> <view>已售{{ item.sales }}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="list acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'" ref="container"
v-if="isIntegral=='true'">
<view @click="goGoodsCon(item)" class="item" :class="Switch === true ? '' : 'on'"
v-for="(item, productListIndex) in productList" :key="productListIndex" :title="item.storeName">
<view class="pictrue" :class="Switch === true ? '' : 'on'">
<image :src="item.image" :class="Switch === true ? '' : 'on'" />
</view>
<view class="text" :class="Switch === true ? '' : 'on'">
<view class="name line1">{{ item.storeName }}</view>
<view class="money font-color-red" :class="Switch === true ? '' : 'on'">
<text class="num">{{ item.price }}积分</text>
</view>
<view class="vip acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'">
<!-- <view class="vip-money">{{ item.otPrice }}</view> -->
<view>已售{{ item.sales }}</view>
</view>
</view>
</view>
</view>
<Loading :loaded="loadend" :loading="loading"></Loading> <Loading :loaded="loadend" :loading="loading"></Loading>
<view <view class="noCommodity" style="background-color: #fff" v-if="productList.length === 0 && where.page > 1">
class="noCommodity"
style="background-color: #fff"
v-if="productList.length === 0 && where.page > 1"
>
<view class="noPictrue"> <view class="noPictrue">
<image src="@/static/images/noGood.png" class="image" /> <image src="@/static/images/noGood.png" class="image" />
</view> </view>
</view> </view>
<Recommend <Recommend v-if="productList.length === 0 && where.page > 1" :recommendLoading="recommendLoading"
v-if="productList.length === 0 && where.page > 1" @changeRecommendLoading="changeRecommendLoading"></Recommend>
:recommendLoading="recommendLoading"
@changeRecommendLoading="changeRecommendLoading"
></Recommend>
</view> </view>
</template> </template>
<script> <script>
import Recommend from "@/components/Recommend"; import Recommend from "@/components/Recommend";
import { getProducts } from "@/api/store"; import {
import Loading from "@/components/Loading"; getProducts,getProductsIntegral
} from "@/api/store";
import Loading from "@/components/Loading";
export default { export default {
name: "GoodsList", name: "GoodsList",
components: { components: {
Recommend, Recommend,
Loading, Loading,
}, },
props: {}, props: {},
data: function () { data: function () {
// const { s = "", id = 0, title = "" } = this.$yroute.query; // const { s = "", id = 0, title = "" } = this.$yroute.query;
const s = "", const s = "",
id = 0, id = 0,
title = ""; title = "";
return { return {
hostProduct: [], hostProduct: [],
productList: [], productList: [],
Switch: true, Switch: true,
where: { where: {
page: 1, page: 1,
limit: 8, limit: 8,
keyword: s, keyword: s,
sid: id, //id sid: id, //id
news: 0, news: 0,
priceOrder: "", priceOrder: "",
salesOrder: "", salesOrder: "",
}, },
title: title && id ? title : "", title: title && id ? title : "",
loadTitle: "", loadTitle: "",
loading: false, loading: false,
loadend: false, loadend: false,
price: 0, price: 0,
stock: 0, stock: 0,
nows: false, nows: false,
recommendLoading: false, recommendLoading: false,
target: false, target: false,
}; isIntegral: false
}, };
watch: {
title() {
this.updateTitle();
}, },
$yroute(to) { watch: {
// if (to.name !== "GoodsList") return; title() {
// const { s = "", id = 0, title = "" } = to.query; this.updateTitle();
// if (s !== this.where.keyword || id !== this.where.sid) { },
// this.where.keyword = s; $yroute(to) {
// this.loadend = false; // if (to.name !== "GoodsList") return;
// this.loading = false; // const { s = "", id = 0, title = "" } = to.query;
// this.where.page = 1; // if (s !== this.where.keyword || id !== this.where.sid) {
// this.where.sid = id; // this.where.keyword = s;
// this.title = title && id ? title : ""; // this.loadend = false;
// this.nows = false; // this.loading = false;
// this.$set(this, "productList", []); // this.where.page = 1;
// this.price = 0; // this.where.sid = id;
// this.stock = 0; // this.title = title && id ? title : "";
// this.get_product_list(); // this.nows = false;
// } // this.$set(this, "productList", []);
// this.price = 0;
// this.stock = 0;
// this.getProductList();
// }
},
}, },
}, mounted: function () {
mounted: function () { const {
const { s = "", id = 0, title = "" } = this.$yroute.query; s = "", id = 0, title = "", isIntegral = false
this.where.keyword = s; } = this.$yroute.query;
this.where.keyword = s;
this.updateTitle(); this.where.isIntegral = isIntegral == 'true' ? 1 : 0;
this.get_product_list(); this.isIntegral = isIntegral
}, this.updateTitle();
onReachBottom() { this.getProductList();
this.recommendLoading = true;
!this.loading && this.get_product_list();
},
onHide() {
// this.hostProduct = [];
// this.productList = [];
// this.Switch = true;
// this.where = {
// page: 1,
// limit: 8,
// keyword: s,
// sid: id, //id
// news: 0,
// priceOrder: "",
// salesOrder: ""
// };
// this.loadTitle = "";
// this.loading = false;
// this.loadend = false;
// this.price = 0;
// this.stock = 0;
// this.nows = fals;
},
methods: {
changeRecommendLoading(recommendLoading) {
this.recommendLoading = recommendLoading;
}, },
goGoodsCon(item) { onReachBottom() {
this.$yrouter.push({ this.recommendLoading = true;
path: "/pages/shop/GoodsCon/index", !this.loading && this.getProductList();
query: {
id: item.id,
},
});
}, },
updateTitle() { onHide() {
// document.title = this.title || this.$yroute.meta.title; // this.hostProduct = [];
// this.productList = [];
// this.Switch = true;
// this.where = {
// page: 1,
// limit: 8,
// keyword: s,
// sid: id, //id
// news: 0,
// priceOrder: "",
// salesOrder: ""
// };
// this.loadTitle = "";
// this.loading = false;
// this.loadend = false;
// this.price = 0;
// this.stock = 0;
// this.nows = fals;
}, },
get_product_list() { methods: {
var that = this; changeRecommendLoading(recommendLoading) {
this.setWhere(); this.recommendLoading = recommendLoading;
// if (to.name !== "GoodsList") return; },
const { s = "", id = 0, title = "" } = this.$yroute.query; goGoodsCon(item) {
if (s !== this.where.keyword || id !== this.where.sid) { this.$yrouter.push({
path: "/pages/shop/GoodsCon/index",
query: {
id: item.id,
isIntegral:this.isIntegral
},
});
},
updateTitle() {
// document.title = this.title || this.$yroute.meta.title;
},
getProductList() {
var that = this;
this.setWhere();
// if (to.name !== "GoodsList") return;
const {
s = "", id = 0, title = ""
} = this.$yroute.query;
if (s !== this.where.keyword || id !== this.where.sid) {
this.loadend = false;
this.loading = false;
this.where.page = 1;
this.where.sid = id;
this.title = title && id ? title : "";
this.nows = false;
this.$set(this, "productList", []);
this.price = 0;
this.stock = 0;
// this.getProductList();
}
let q = that.where;
let getData = this.isIntegral !== 'true' ? getProducts : getProductsIntegral
getData(q).then((res) => {
that.loading = false;
if (that.target) {
that.productList = res.data;
} else {
that.productList.push.apply(that.productList, res.data);
}
that.target = false
that.loadend = res.data.length < that.where.limit; //
that.where.page = that.where.page + 1;
});
},
submitForm: function () {
this.$set(this, "productList", []);
this.where.page = 1;
this.loadend = false; this.loadend = false;
this.loading = false; this.loading = false;
this.where.page = 1; this.getProductList();
this.where.sid = id; },
this.title = title && id ? title : ""; //
this.nows = false; set_where: function (index) {
this.$set(this, "productList", []); let that = this;
this.price = 0; switch (index) {
this.stock = 0; case 0:
// this.get_product_list(); return that.$yrouter.push({
} path: "/pages/shop/GoodsClass/index",
let q = that.where; });
getProducts(q).then((res) => { case 1:
that.loading = false; if (that.price === 0) that.price = 1;
if (that.target) { else if (that.price === 1) that.price = 2;
that.productList = res.data; else if (that.price === 2) that.price = 0;
} else { that.stock = 0;
that.productList.push.apply(that.productList, res.data); break;
case 2:
if (that.stock === 0) that.stock = 1;
else if (that.stock === 1) that.stock = 2;
else if (that.stock === 2) that.stock = 0;
that.price = 0;
break;
case 3:
that.nows = !that.nows;
break;
default:
break;
} }
that.target = false this.productList = [];
that.loadend = res.data.length < that.where.limit; // that.$set(that, "productList", []);
that.where.page = that.where.page + 1; that.where.page = 1;
}); that.target = true;
}, that.loadend = false;
submitForm: function () { that.getProductList();
this.$set(this, "productList", []); },
this.where.page = 1; //where
this.loadend = false; setWhere: function () {
this.loading = false; let that = this;
this.get_product_list(); if (that.price === 0) {
}, that.where.priceOrder = "";
// } else if (that.price === 1) {
set_where: function (index) { that.where.priceOrder = "asc";
let that = this; } else if (that.price === 2) {
switch (index) { that.where.priceOrder = "desc";
case 0: }
return that.$yrouter.push({ if (that.stock === 0) {
path: "/pages/shop/GoodsClass/index", that.where.salesOrder = "";
}); } else if (that.stock === 1) {
case 1: that.where.salesOrder = "asc";
if (that.price === 0) that.price = 1; } else if (that.stock === 2) {
else if (that.price === 1) that.price = 2; that.where.salesOrder = "desc";
else if (that.price === 2) that.price = 0; }
that.stock = 0; that.where.news = that.nows ? "1" : "0";
break; },
case 2: switchTap: function () {
if (that.stock === 0) that.stock = 1; let that = this;
else if (that.stock === 1) that.stock = 2; that.Switch = !that.Switch;
else if (that.stock === 2) that.stock = 0; },
that.price = 0;
break;
case 3:
that.nows = !that.nows;
break;
default:
break;
}
this.productList = [];
that.$set(that, "productList", []);
that.where.page = 1;
that.target = true;
that.loadend = false;
that.get_product_list();
},
//where
setWhere: function () {
let that = this;
if (that.price === 0) {
that.where.priceOrder = "";
} else if (that.price === 1) {
that.where.priceOrder = "asc";
} else if (that.price === 2) {
that.where.priceOrder = "desc";
}
if (that.stock === 0) {
that.where.salesOrder = "";
} else if (that.stock === 1) {
that.where.salesOrder = "asc";
} else if (that.stock === 2) {
that.where.salesOrder = "desc";
}
that.where.news = that.nows ? "1" : "0";
},
switchTap: function () {
let that = this;
that.Switch = !that.Switch;
}, },
}, };
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.noCommodity { .noCommodity {
border-top: 3px solid #f5f5f5; border-top: 3px solid #f5f5f5;
padding-bottom: 1px; padding-bottom: 1px;
} }
</style> </style>

14
pages/user/User/index.vue

@ -114,11 +114,11 @@
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view> </view>
</template> </template>
<!-- <view class="item" @click="goPages2()"> <view class="item" @click="goPages2()">
<view class="pictrue"></view> <view class="pictrue"></view>
<view class="cell">hexiao</view> <view class="cell">积分商城</view>
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view>--> </view>
</view> </view>
</view> </view>
</view> </view>
@ -353,7 +353,13 @@
}, },
goPages2: function () { goPages2: function () {
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/orderAdmin/OrderCancellation/index" path: "/pages/shop/GoodsList/index",
query: {
// id: 0,
title: '积分商城',
isIntegral: true,
}
}); });
} }
}, },

Loading…
Cancel
Save