增加新模块
This commit is contained in:
+224
@@ -0,0 +1,224 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_product = require("../../api/product.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
searchList: [
|
||||
{
|
||||
id: 1,
|
||||
name: "酒"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "鸿星尔克"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "361"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "国美"
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "刘丹"
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "榴莲"
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "会心一笑"
|
||||
}
|
||||
],
|
||||
// 搜索历史记录
|
||||
isShowSearch: false,
|
||||
searchVal: null,
|
||||
poductList: [],
|
||||
// 产品列表
|
||||
imgSize: "min"
|
||||
// big:大,min:笑
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
jumpHome() {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/home/home"
|
||||
});
|
||||
},
|
||||
// 删除历史
|
||||
searchHistoryDelete(item) {
|
||||
common_vendor.index.__f__("log", "at pages/search/search.vue:141", "item", item);
|
||||
this.isShowSearch = false;
|
||||
},
|
||||
/**
|
||||
* 查询产品
|
||||
*/
|
||||
async searchClick(item) {
|
||||
this.searchVal = item.name;
|
||||
this.searchClickFun();
|
||||
},
|
||||
/**
|
||||
* 查询产品
|
||||
*/
|
||||
async searchClickFun() {
|
||||
const param = {
|
||||
keyword: this.searchVal
|
||||
};
|
||||
const resp = await api_product.searchList(param);
|
||||
if (resp && resp.bizcode === 100) {
|
||||
this.poductList = resp.data;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 切换图大小
|
||||
*/
|
||||
toggleImg() {
|
||||
this.imgSize = this.imgSize === "big" ? "min" : "big";
|
||||
},
|
||||
jumpInfo(item) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/productInfo/productInfo?id=" + item.id
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
|
||||
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
||||
const _easycom_up_tag2 = common_vendor.resolveComponent("up-tag");
|
||||
(_easycom_up_image2 + _easycom_up_input2 + _easycom_up_tag2)();
|
||||
}
|
||||
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
|
||||
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
||||
const _easycom_up_tag = () => "../../uni_modules/uview-plus/components/u-tag/u-tag.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_image + _easycom_up_input + _easycom_up_tag)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.o($options.jumpHome),
|
||||
b: common_vendor.p({
|
||||
src: "/static/common/left.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
c: common_vendor.o($options.jumpHome),
|
||||
d: common_vendor.p({
|
||||
src: "/static/common/search.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
e: common_vendor.o((...args) => $options.searchClickFun && $options.searchClickFun(...args)),
|
||||
f: common_vendor.o(($event) => $data.searchVal = $event),
|
||||
g: common_vendor.p({
|
||||
placeholder: "搜索关键字(商品、店铺、品牌)",
|
||||
customStyle: {
|
||||
"border-color": "#FF7C41 !important",
|
||||
"padding": "0 0 0 20rpx !important",
|
||||
"border-radius": "20rpx !important",
|
||||
"width": "590rpx"
|
||||
},
|
||||
modelValue: $data.searchVal
|
||||
}),
|
||||
h: !$data.searchVal
|
||||
}, !$data.searchVal ? common_vendor.e({
|
||||
i: common_vendor.o(($event) => {
|
||||
$data.isShowSearch = true;
|
||||
}),
|
||||
j: common_vendor.p({
|
||||
src: "/static/common/delete.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
k: $data.searchList && $data.searchList.length !== 0
|
||||
}, $data.searchList && $data.searchList.length !== 0 ? {
|
||||
l: common_vendor.f($data.searchList, (item, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.o(($event) => $options.searchHistoryDelete(item), item.id),
|
||||
b: common_vendor.o(($event) => $options.searchClick(item), item.id),
|
||||
c: "c10c040c-4-" + i0,
|
||||
d: common_vendor.p({
|
||||
plain: true,
|
||||
text: item.name,
|
||||
type: "warning",
|
||||
show: true,
|
||||
closable: $data.isShowSearch
|
||||
}),
|
||||
e: item.id
|
||||
};
|
||||
})
|
||||
} : {
|
||||
m: common_vendor.p({
|
||||
src: "/static/common/not_search.png",
|
||||
width: "100",
|
||||
height: "100",
|
||||
bgColor: "#f1f6ff00"
|
||||
})
|
||||
}) : common_vendor.e({
|
||||
n: common_vendor.o($options.toggleImg),
|
||||
o: common_vendor.p({
|
||||
src: $data.imgSize === "big" ? "/static/search/dt.png" : "/static/search/xt.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
p: $data.poductList && $data.poductList.length !== 0
|
||||
}, $data.poductList && $data.poductList.length !== 0 ? common_vendor.e({
|
||||
q: $data.imgSize === "big"
|
||||
}, $data.imgSize === "big" ? {
|
||||
r: common_vendor.f($data.poductList, (item, k0, i0) => {
|
||||
return {
|
||||
a: "c10c040c-7-" + i0,
|
||||
b: common_vendor.p({
|
||||
src: item.url,
|
||||
width: "100%",
|
||||
height: "150px",
|
||||
bgColor: "#f1f6ff00",
|
||||
radius: "10"
|
||||
}),
|
||||
c: common_vendor.t(item.title),
|
||||
d: common_vendor.t(item.adPrice),
|
||||
e: common_vendor.t(item.price),
|
||||
f: item.id,
|
||||
g: common_vendor.o(($event) => $options.jumpInfo(item), item.id)
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
s: $data.imgSize === "min"
|
||||
}, $data.imgSize === "min" ? {
|
||||
t: common_vendor.f($data.poductList, (item, k0, i0) => {
|
||||
return {
|
||||
a: "c10c040c-8-" + i0,
|
||||
b: common_vendor.p({
|
||||
src: item.url,
|
||||
width: "100",
|
||||
height: "100",
|
||||
bgColor: "#f1f6ff00",
|
||||
radius: "10"
|
||||
}),
|
||||
c: common_vendor.t(item.title),
|
||||
d: common_vendor.t(item.adPrice),
|
||||
e: common_vendor.t(item.price),
|
||||
f: item.id,
|
||||
g: common_vendor.o(($event) => $options.jumpInfo(item), item.id)
|
||||
};
|
||||
})
|
||||
} : {}) : {
|
||||
v: common_vendor.p({
|
||||
src: "/static/common/not_search.png",
|
||||
width: "100",
|
||||
height: "100",
|
||||
bgColor: "#f1f6ff00"
|
||||
})
|
||||
}));
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c10c040c"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/search/search.js.map
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"usingComponents": {
|
||||
"up-image": "../../uni_modules/uview-plus/components/u-image/u-image",
|
||||
"up-input": "../../uni_modules/uview-plus/components/u-input/u-input",
|
||||
"up-tag": "../../uni_modules/uview-plus/components/u-tag/u-tag"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="search_warp data-v-c10c040c"><view class="header_comm data-v-c10c040c"><up-image wx:if="{{b}}" class="data-v-c10c040c" bindclick="{{a}}" u-i="c10c040c-0" bind:__l="__l" u-p="{{b}}"></up-image><view class="data-v-c10c040c"><up-input wx:if="{{g}}" class="data-v-c10c040c" u-s="{{['prefix','suffix']}}" u-i="c10c040c-1" bind:__l="__l" bindupdateModelValue="{{f}}" u-p="{{g}}"><up-image class="data-v-c10c040c" bindclick="{{c}}" u-i="c10c040c-2,c10c040c-1" bind:__l="__l" u-p="{{d}}" slot="prefix"></up-image><view class="search_but_warp data-v-c10c040c" bindtap="{{e}}" slot="suffix">搜索</view></up-input></view></view><view wx:if="{{h}}" class="search_history data-v-c10c040c"><view class="search_history_title data-v-c10c040c"><view class="data-v-c10c040c">历史搜索</view><up-image wx:if="{{j}}" class="data-v-c10c040c" bindclick="{{i}}" u-i="c10c040c-3" bind:__l="__l" u-p="{{j}}"></up-image></view><view wx:if="{{k}}" class="search_history_cotent data-v-c10c040c"><view wx:for="{{l}}" wx:for-item="item" wx:key="e" class="data-v-c10c040c" style="margin:0 10rpx 10rpx 0"><up-tag wx:if="{{item.d}}" class="data-v-c10c040c" bindclose="{{item.a}}" bindclick="{{item.b}}" u-i="{{item.c}}" bind:__l="__l" u-p="{{item.d}}"></up-tag></view></view><view wx:else class="not_order_warp data-v-c10c040c"><view class="not_order_warp_img data-v-c10c040c"><up-image wx:if="{{m}}" class="data-v-c10c040c" u-i="c10c040c-5" bind:__l="__l" u-p="{{m}}"></up-image></view><view class="not_order_msg_warp data-v-c10c040c">暂无搜索记录</view></view></view><view wx:else class="poduct_list data-v-c10c040c"><view class="poduct_search_warp data-v-c10c040c"><view class="data-v-c10c040c">综合</view><view class="data-v-c10c040c">销量</view><view class="data-v-c10c040c">优惠卷</view><view class="data-v-c10c040c"><up-image wx:if="{{o}}" class="data-v-c10c040c" bindclick="{{n}}" u-i="c10c040c-6" bind:__l="__l" u-p="{{o}}"></up-image></view></view><view class="poduct_content_warp data-v-c10c040c"><view wx:if="{{p}}" class="data-v-c10c040c"><view wx:if="{{q}}" class="big_warp data-v-c10c040c"><view wx:for="{{r}}" wx:for-item="item" wx:key="f" class="big_item_warp data-v-c10c040c" bindtap="{{item.g}}"><up-image wx:if="{{item.b}}" class="data-v-c10c040c" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-image><view class="big_item_content_warp data-v-c10c040c"><view class="title data-v-c10c040c">{{item.c}}</view><view class="total_or_quantity data-v-c10c040c"><view class="total_ data-v-c10c040c"><text class="data-v-c10c040c">¥</text><text class="data-v-c10c040c" style="font-size:36rpx">{{item.d}}</text></view><view class="data-v-c10c040c">已售{{item.e}}件</view></view></view></view></view><view wx:if="{{s}}" class="min_warp data-v-c10c040c"><view wx:for="{{t}}" wx:for-item="item" wx:key="f" class="min_item_warp data-v-c10c040c" bindtap="{{item.g}}"><up-image wx:if="{{item.b}}" class="data-v-c10c040c" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-image><view class="min_item_content_warp data-v-c10c040c"><view class="title data-v-c10c040c">{{item.c}}</view><view class="total_or_quantity data-v-c10c040c"><view class="total_ data-v-c10c040c"><text class="data-v-c10c040c">¥</text><text class="data-v-c10c040c" style="font-size:36rpx">{{item.d}}</text></view><view class="data-v-c10c040c">已售{{item.e}}件</view></view></view></view></view></view><view wx:else class="not_order_warp data-v-c10c040c"><view class="not_order_warp_img data-v-c10c040c"><up-image wx:if="{{v}}" class="data-v-c10c040c" u-i="c10c040c-9" bind:__l="__l" u-p="{{v}}"></up-image></view><view class="not_order_msg_warp data-v-c10c040c">抱歉没有搜索此类商品~</view></view></view></view></view>
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/* uni.scss */
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
.search_warp.data-v-c10c040c {
|
||||
background-color: #F5F5F5;
|
||||
height: 100vh;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.search_warp .search_but_warp.data-v-c10c040c {
|
||||
background: #FF7C41;
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx 40rpx;
|
||||
text-align: center;
|
||||
color: #FFF;
|
||||
}
|
||||
.search_warp .search_history.data-v-c10c040c {
|
||||
padding: 60rpx 40rpx;
|
||||
}
|
||||
.search_warp .search_history .search_history_title.data-v-c10c040c {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.search_warp .search_history .search_history_cotent.data-v-c10c040c {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_search_warp.data-v-c10c040c {
|
||||
background: #FFFFFF;
|
||||
font-weight: bold;
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 10rpx 60rpx;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp.data-v-c10c040c {
|
||||
padding: 30rpx;
|
||||
height: calc(100vh - 340rpx);
|
||||
overflow-y: auto;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp .big_warp.data-v-c10c040c {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp .big_warp .big_item_warp.data-v-c10c040c {
|
||||
width: 48%;
|
||||
margin-bottom: 20rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp .big_warp .big_item_content_warp.data-v-c10c040c {
|
||||
padding: 20rpx;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp .big_warp .big_item_content_warp .title.data-v-c10c040c {
|
||||
font-weight: bold;
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp .min_warp .min_item_warp.data-v-c10c040c {
|
||||
padding: 30rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
display: flex;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp .min_warp .min_item_content_warp.data-v-c10c040c {
|
||||
margin-left: 10rpx;
|
||||
display: grid;
|
||||
width: 100%;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp .min_warp .title.data-v-c10c040c {
|
||||
font-weight: bold;
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp .total_or_quantity.data-v-c10c040c {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 10rpx 0 6rpx;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
}
|
||||
.search_warp .poduct_list .poduct_content_warp .total_.data-v-c10c040c {
|
||||
font-weight: bold;
|
||||
font-size: 26rpx;
|
||||
color: #F52D1D;
|
||||
}
|
||||
Reference in New Issue
Block a user