feat(uniapp_v2): 二开功能迁移与小程序主包优化
- 从 uniapp 迁移 HJF 页面、API、组件及用户/订单相关改动 - queue、assets 使用独立分包以降低主包体积 - 修复首页单根节点与支付结果页 v-if 链 - 关闭 HjfDemoPanel 全局注册;uniNoticeBar 注释 $getAppWebview 避免 __webviewId__ 报错 - 配置域名与 manifest 应用名称;cache/store 防御性处理 Made-with: Cursor
This commit is contained in:
183
pro_v3.5.1/view/uniapp_v2/pages/behalf/cashier/index.vue
Normal file
183
pro_v3.5.1/view/uniapp_v2/pages/behalf/cashier/index.vue
Normal file
@@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="flex-col flex-center py-80">
|
||||
<baseMoney :money="payPriceShow" symbolSize="48" integerSize="64" decimalSize="48" color="#333" weight></baseMoney>
|
||||
<view class="flex-y-center mt-20">
|
||||
<text class="fs-24 text--w111-333 lh-36rpx pr-10">支付剩余时间</text>
|
||||
<countDown
|
||||
:is-day="false"
|
||||
tip-text=" "
|
||||
day-text=" "
|
||||
hour-text=":"
|
||||
minute-text=":"
|
||||
second-text=" "
|
||||
bgColor="#FFFFFF"
|
||||
colors="#FF7E00"
|
||||
dotColor="#FF7E00"
|
||||
:datatime="invalidTime"></countDown>
|
||||
</view>
|
||||
</view>
|
||||
<view class="px-20">
|
||||
<view class="bg--w111-fff rd-24rpx px-24">
|
||||
<view class="pt-60 flex-center fs-30 lh-42rpx fw-500">
|
||||
<text>方式一:</text>
|
||||
<view class="flex-y-center pl-30" @tap="checkType('weixin')">
|
||||
<text class="iconfont" :class="paytype == 'weixin' ? 'icon-ic_Selected' : 'icon-ic_unselect'"></text>
|
||||
<text class="pl-10">微信扫码</text>
|
||||
</view>
|
||||
<view class="flex-y-center ml-50" @tap="checkType('alipay')">
|
||||
<text class="iconfont" :class="paytype == 'alipay' ? 'icon-ic_Selected' : 'icon-ic_unselect'"></text>
|
||||
<text class="pl-10">支付宝扫码</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center mt-40 pb-50 border-b" v-show="config.code">
|
||||
<w-qrcode :options="config"></w-qrcode>
|
||||
</view>
|
||||
<view class="pt-50 flex-center fs-30 lh-42rpx fw-500">方式二:用户进入商城支付订单</view>
|
||||
<view class="py-60 flex-center">
|
||||
<image class="guide" :src="imgHost + '/statics/images/pay_guide.png'"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-200"></view>
|
||||
<view class="fixed-lb w-full pb-safe">
|
||||
<view class="w-full h-128 flex-center">
|
||||
<view class="w-710 h-80 flex-center rd-40rpx fs-28 bg-primary text--w111-fff" @tap="backPage">返回</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import countDown from '@/components/countDown';
|
||||
import { getCashierApi, getPayStatusApi } from "@/api/admin.js";
|
||||
import {HTTP_REQUEST_URL} from '@/config/app';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imgHost:HTTP_REQUEST_URL,
|
||||
payPriceShow:0,
|
||||
invalidTime:0,
|
||||
orderId: '',
|
||||
paytype:'weixin',
|
||||
userId:0,
|
||||
qrcode:'',
|
||||
config: {
|
||||
code: '',
|
||||
size: 280, // 二维码大小
|
||||
level: 3, //等级 0~4
|
||||
bgColor: '#FFFFFF',
|
||||
color: ['#333', '#333'], //边框颜色支持渐变色
|
||||
},
|
||||
timer: null
|
||||
}
|
||||
},
|
||||
components: {
|
||||
countDown,
|
||||
},
|
||||
onLoad(options) {
|
||||
this.userId = options.uid || 0;
|
||||
if (options.order_id) {
|
||||
this.orderId = options.order_id;
|
||||
this.getCashierOrder();
|
||||
}
|
||||
|
||||
},
|
||||
onUnload() {
|
||||
this.stopSetInterval();
|
||||
},
|
||||
methods: {
|
||||
getCashierOrder(){
|
||||
let data = {
|
||||
uni: this.orderId,
|
||||
paytype: this.paytype,
|
||||
quitUrl: '/pages/behalf/cashier/index'
|
||||
};
|
||||
getCashierApi(this.userId,data).then(res=>{
|
||||
if(res.data.status == 'SUCCESS'){
|
||||
return this.$util.Tips({
|
||||
title: '支付成功'
|
||||
}, {
|
||||
tab: 5,
|
||||
url: '/pages/behalf/record/index'
|
||||
});
|
||||
}
|
||||
this.payPriceShow = res.data.result.pay_price;
|
||||
this.invalidTime = res.data.result.jsConfig.invalid;
|
||||
this.config.code = this.paytype == 'weixin' ? res.data.result.jsConfig.code_url : res.data.result.jsConfig.qrCode;
|
||||
this.createSetInterval(res.data.result.order_id);
|
||||
}).catch(err=>{
|
||||
return this.$util.Tips({
|
||||
title: err
|
||||
})
|
||||
})
|
||||
},
|
||||
checkType(val){
|
||||
this.paytype = val;
|
||||
this.getCashierOrder();
|
||||
},
|
||||
createSetInterval(order_id) {
|
||||
this.stopSetInterval();
|
||||
this.timer = setInterval(() => {
|
||||
this.getOrderResult(order_id);
|
||||
}, 2000);
|
||||
},
|
||||
stopSetInterval() {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
},
|
||||
getOrderResult(id){
|
||||
//接口响应成功以后销毁定时器
|
||||
getPayStatusApi({
|
||||
order_id:id,
|
||||
end_time:this.invalidTime
|
||||
}).then(res=>{
|
||||
if(res.data.time == 0){
|
||||
this.stopSetInterval();
|
||||
this.getCashierOrder();
|
||||
}
|
||||
if(res.data.status || res.data.time == 0){
|
||||
this.stopSetInterval();
|
||||
uni.reLaunch({
|
||||
url:'/pages/behalf/record/index'
|
||||
})
|
||||
}
|
||||
}).catch(err=>{
|
||||
return this.$util.Tips({
|
||||
title: err
|
||||
})
|
||||
})
|
||||
},
|
||||
backPage(){
|
||||
uni.reLaunch({
|
||||
url:'/pages/admin/work/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/deep/ .styleAll{
|
||||
padding: 0 6rpx;
|
||||
border: 1rpx solid #DDDDDD;
|
||||
border-radius: 8rpx;
|
||||
font-family: Regular;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.border-b{
|
||||
border-bottom: 1px dashed #ccc;
|
||||
}
|
||||
.icon-ic_Selected{
|
||||
color: $primary-admin;
|
||||
}
|
||||
.bg-primary{
|
||||
background-color: $primary-admin;
|
||||
}
|
||||
.guide{
|
||||
width: 570rpx;
|
||||
height: 214rpx;
|
||||
}
|
||||
</style>
|
||||
115
pro_v3.5.1/view/uniapp_v2/pages/behalf/components/cartList.vue
Normal file
115
pro_v3.5.1/view/uniapp_v2/pages/behalf/components/cartList.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<base-drawer mode="bottom" :visible="cartData.iScart" background-color="transparent" mask maskClosable @close="closeList">
|
||||
<view class="bg--w111-fff rd-t-40rpx p-32">
|
||||
<view class="text-center fs-32 text--w111-333 fw-500">待购清单</view>
|
||||
<view class="mt-36">
|
||||
<scroll-view scroll-y="true" style="max-height: 1000rpx;">
|
||||
<view class="w-full flex-between-center item"
|
||||
v-for="(item,index) in cartData.cartList" :key="index">
|
||||
<text class="iconfont fs-36"
|
||||
:class="item.select ? 'icon-a-ic_CompleteSelect' : 'icon-ic_unselect'"
|
||||
@tap="selectItem(item,index)"></text>
|
||||
<view class="flex-1 flex pl-18">
|
||||
<image v-if="item.productInfo.attrInfo" :src="item.productInfo.attrInfo.image" class="w-136 h-136 rd-16rpx block"></image>
|
||||
<image v-else :src="item.productInfo.image" class="w-136 h-136 rd-16rpx block"></image>
|
||||
<view class='flex-1 h-136 pl-20'>
|
||||
<view class="w-340 line1 fs-28 lh-40rpx fw-500">{{item.productInfo.store_name}}</view>
|
||||
<view class="w-324 line1 fs-22 lh-30rpx text--w111-999 mt-12">{{item.productInfo.attrInfo.suk}}</view>
|
||||
<view class="flex-1 flex-between-center mt-18">
|
||||
<view class="fs-36 Regular">¥{{item.truePrice}}</view>
|
||||
<view class="flex-y-center">
|
||||
<text class="iconfont icon-ic_Reduce fs-24"
|
||||
:class="item.cart_num <= 1 ? 'text--w111-f5f5f5' : ''"
|
||||
@tap="cartNumAdd(false,item,index)"></text>
|
||||
<input type="number" v-model="item.cart_num"
|
||||
:always-embed="true" :adjust-position="true" cursor-spacing="30"
|
||||
class="w-88 h-44 rd-4rpx bg--w111-f5f5f5 fs-24 text-center mx-10"></input>
|
||||
<text class="iconfont icon-ic_increase fs-24" @tap="cartNumAdd(true,item,index)"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="bt-box"></view>
|
||||
<view class="w-full fixed-lb pb-safe bg--w111-fff">
|
||||
<view class="w-full h-96 pl-32 pr-20 flex-between-center">
|
||||
<view class="flex-y-center" @tap="selectAll">
|
||||
<text class="iconfont fs-36" :class="allSelect ? 'icon-a-ic_CompleteSelect' : 'icon-ic_unselect'"></text>
|
||||
<text class="fs-26 pl-12">全选</text>
|
||||
</view>
|
||||
|
||||
<view class="flex-y-center">
|
||||
<view class="w-160 h-64 rd-40rpx flex-center fs-24 con_border text-primary" @tap="cartDel">删除</view>
|
||||
<view class="w-160 h-64 rd-40rpx flex-center fs-24 bg-primary text--w111-fff ml-16" @tap="cartConfirm">下单</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</base-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import baseDrawer from '@/components/tui-drawer/tui-drawer.vue'
|
||||
export default {
|
||||
name:'cartList',
|
||||
props:{
|
||||
cartData: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
allSelect: false
|
||||
}
|
||||
},
|
||||
components:{
|
||||
baseDrawer
|
||||
},
|
||||
methods:{
|
||||
closeList(){
|
||||
this.$emit('closeList', false);
|
||||
},
|
||||
selectItem(item,index){
|
||||
this.$emit('onSelect',index);
|
||||
},
|
||||
selectAll(){
|
||||
this.$emit('onSelectAll',this.allSelect);
|
||||
this.allSelect = !this.allSelect;
|
||||
},
|
||||
cartDel(){
|
||||
this.$emit('onDelCart');
|
||||
},
|
||||
cartConfirm(){
|
||||
this.$emit('onCartConfirm');
|
||||
},
|
||||
cartNumAdd(type,item,index){
|
||||
this.$emit('onCartNum',{type,item,index});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.icon-ic_unselect{
|
||||
color: #ccc;
|
||||
}
|
||||
.icon-a-ic_CompleteSelect{
|
||||
color: $primary-admin;
|
||||
}
|
||||
.text-primary {
|
||||
color: $primary-admin;
|
||||
}
|
||||
.bg-primary{
|
||||
background: $primary-admin;
|
||||
}
|
||||
.con_border {
|
||||
border: 1rpx solid $primary-admin;
|
||||
}
|
||||
.bt-box{
|
||||
height: calc(100rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
.item ~ .item{
|
||||
margin-top: 48rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<base-drawer mode="bottom" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
|
||||
<view class="w-100% bg--w111-f5f5f5 rd-t-40rpx py-32">
|
||||
<view class="text-center fs-32 text--w111-333 fw-500">赠品</view>
|
||||
<view class="mt-48 px-20 scroll-content">
|
||||
<view class="text--w111-333 fs-28 lh-40rpx">本单可获得以下赠品</view>
|
||||
<view class="gift-card mt-24 bg--w111-fff rd-16rpx p-16 flex-y-center"
|
||||
v-for="(item,index) in giveCartInfo" :key="item.id" @tap="goPage(1,'/pages/goods_details/index?id=' + item.productInfo.id)">
|
||||
<image class="w-116 h-116 rd-16rpx" :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo"></image>
|
||||
<image class="w-116 h-116 rd-16rpx" :src="item.productInfo.image" v-else></image>
|
||||
<view class="flex-1 flex-between-center pl-16">
|
||||
<view class="w-460">
|
||||
<view class="w-full line1 fs-28 lh-40rpx">{{item.productInfo.store_name}}</view>
|
||||
<view class="fs-22 text--w111-999 lh-30rpx mt-12">数量x{{item.cart_num}}</view>
|
||||
</view>
|
||||
<text class="iconfont icon-ic_rightarrow fs-24 text--w111-999"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="gift-card mt-24 bg--w111-fff rd-16rpx p-16 flex-y-center"
|
||||
v-for="(item,index) in giveData.give_coupon" :key="index" @tap="goPage(1,'/pages/users/user_coupon/index')">
|
||||
<view class="w-116 h-116 rd-16rpx flex-center bg--w111-f5f5f5">
|
||||
<text class="fs-48 gold iconfont icon-a-ic_discount1"></text>
|
||||
</view>
|
||||
<view class="flex-1 flex-between-center pl-16">
|
||||
<view class="w-460">
|
||||
<view class="w-full line1 fs-28 lh-40rpx">{{item.coupon_title}}</view>
|
||||
<view class="fs-22 text--w111-999 lh-30rpx mt-12">数量x1</view>
|
||||
</view>
|
||||
<text class="iconfont icon-ic_rightarrow fs-24 text--w111-999"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="gift-card mt-24 bg--w111-fff rd-16rpx p-16 flex-y-center"
|
||||
v-if="giveData.give_integral>0"
|
||||
@tap="goPage(1,'/pages/users/user_integral/index')">
|
||||
<view class="w-116 h-116 rd-16rpx flex-center bg--w111-f5f5f5">
|
||||
<text class="fs-48 gold iconfont icon-ic_badge11"></text>
|
||||
</view>
|
||||
<view class="flex-1 flex-between-center pl-16">
|
||||
<view class="w-460">
|
||||
<view class="w-full line1 fs-28 lh-40rpx">{{giveData.give_integral}}积分</view>
|
||||
<view class="fs-22 text--w111-999 lh-30rpx mt-12">数量x1</view>
|
||||
</view>
|
||||
<text class="iconfont icon-ic_rightarrow fs-24 text--w111-999"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mx-20">
|
||||
<view class="mt-52 h-72 flex-center rd-36px bg-color fs-26 text--w111-fff" @tap="showGiftDrawer = false">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</base-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import baseDrawer from '@/components/tui-drawer/tui-drawer.vue';
|
||||
export default {
|
||||
props:{
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
giveCartInfo:{
|
||||
type: Array,
|
||||
default: ()=>[]
|
||||
},
|
||||
giveData:{
|
||||
type: Object,
|
||||
default: ()=>{}
|
||||
},
|
||||
},
|
||||
components: {
|
||||
baseDrawer
|
||||
},
|
||||
methods:{
|
||||
closeDrawer() {
|
||||
this.$emit('closeDrawer');
|
||||
},
|
||||
goPage(type,url){
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.gold{
|
||||
color: #DCA658;
|
||||
}
|
||||
.scroll-content{
|
||||
height: 800rpx;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<base-drawer mode="bottom" :visible="attr.cartAttr" background-color="transparent" mask maskClosable
|
||||
@close="closeAttr">
|
||||
<view class="scroll-content bg--w111-fff rd-t-40rpx">
|
||||
<view class="w-full pt-32">
|
||||
<view class="px-32 flex">
|
||||
<image class="w-180 h-180 rd-16rpx" :src="attr.productSelect.image"></image>
|
||||
<view class="pl-24 mt-30">
|
||||
<baseMoney :money="attr.productSelect.price" symbolSize="32" integerSize="48"
|
||||
decimalSize="32" color="#FF7E00" weight></baseMoney>
|
||||
<view class="fs-24 pt-10 text--w111-FF7E00" v-show="is_channel">采购价:{{attr.productSelect.channel_price}}</view>
|
||||
<view class="mt-20 fs-24 text--w111-999">库存:{{ attr.productSelect.stock }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="px-32">
|
||||
<scroll-view scroll-y="true" style="max-height: 454rpx" >
|
||||
<view class="item mt-32" v-for="(item, indexw) in attr.productAttr" :key="indexw">
|
||||
<view class="fs-28 fw-500">{{ item.attr_name }}</view>
|
||||
<view class="flex-y-center flex-wrap">
|
||||
<view class="sku-item" :class="item.index === itemn.attr ? 'active' : ''"
|
||||
v-for="(itemn, indexn) in item.attr_value" @click="tapAttr(indexw, indexn)"
|
||||
:key="indexn">
|
||||
{{ itemn.attr }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="flex-between-center mt-40 px-32">
|
||||
<view class="fs-28 fw-500">数量</view>
|
||||
<view class="flex-1 flex justify-end items-center">
|
||||
<text class="fs-22 text-primary">(最多可购买{{attr.productSelect.stock}}件)</text>
|
||||
<view class="flex-y-center pl-24">
|
||||
<text class="iconfont icon-ic_Reduce fs-24"
|
||||
:class="attr.productSelect.cart_num <= 1 ? 'text--w111-f5f5f5' : ''"
|
||||
@tap="CartNumDes"></text>
|
||||
<input type="number" v-model="attr.productSelect.cart_num"
|
||||
data-name="productSelect.cart_num" :always-embed="true" :adjust-position="true" cursor-spacing="30"
|
||||
@input="bindCode(attr.productSelect.cart_num)" class="w-88 h-44 rd-4rpx bg--w111-f5f5f5 fs-24 text-center mx-10"></input>
|
||||
<text class="iconfont icon-ic_increase fs-24" @tap="CartNumAdd"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box" v-show="attr.productSelect.stock == 0">
|
||||
<view class="w-full h-72 rd-40rpx flex-center fs-26 bg--w111-ccc text--w111-fff">已售罄</view>
|
||||
</view>
|
||||
<view class="btn-box flex-between-center" v-show="attr.productSelect.stock > 0">
|
||||
<view class="w-346 h-72 rd-40rpx flex-center fs-26 con_border text-primary"
|
||||
:class="{'disabled': cartButton == 0}"
|
||||
@tap="goCart(0)">加入购物车</view>
|
||||
<view class="w-346 h-72 rd-40rpx flex-center fs-26 bg-primary text--w111-fff" @tap="goCart(1)">立即下单</view>
|
||||
</view>
|
||||
</view>
|
||||
</base-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import baseDrawer from '@/components/tui-drawer/tui-drawer.vue'
|
||||
export default {
|
||||
name:'skuSelect',
|
||||
props:{
|
||||
attr: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
cartButton:{
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
is_channel:{
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
components:{
|
||||
baseDrawer
|
||||
},
|
||||
methods:{
|
||||
goCart(type) {
|
||||
if(type == 0 && this.cartButton == 0) return
|
||||
if(this.attr.productSelect.stock == 0) return
|
||||
this.$emit('goCat',type);
|
||||
},
|
||||
bindCode: function(e) {
|
||||
this.$emit('iptCartNum', this.attr.productSelect.cart_num);
|
||||
},
|
||||
closeAttr: function() {
|
||||
this.$emit('myevent');
|
||||
},
|
||||
CartNumDes: function() {
|
||||
this.$emit('ChangeCartNum', false);
|
||||
},
|
||||
CartNumAdd: function() {
|
||||
this.$emit('ChangeCartNum', true);
|
||||
},
|
||||
tapAttr: function(indexw, indexn) {
|
||||
let that = this;
|
||||
that.$emit("attrVal", {
|
||||
indexw: indexw,
|
||||
indexn: indexn
|
||||
});
|
||||
this.$set(this.attr.productAttr[indexw], 'index', this.attr.productAttr[indexw].attr_values[indexn]);
|
||||
let value = that
|
||||
.getCheckedValue()
|
||||
.join(",");
|
||||
that.$emit("ChangeAttr", value);
|
||||
|
||||
},
|
||||
//获取被选中属性;
|
||||
getCheckedValue: function() {
|
||||
let productAttr = this.attr.productAttr;
|
||||
let value = [];
|
||||
for (let i = 0; i < productAttr.length; i++) {
|
||||
for (let j = 0; j < productAttr[i].attr_values.length; j++) {
|
||||
if (productAttr[i].index === productAttr[i].attr_values[j]) {
|
||||
value.push(productAttr[i].attr_values[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sku-item {
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border: 1rpx solid #F2F2F2;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
padding: 0 44rpx;
|
||||
border-radius: 28rpx;
|
||||
margin: 24rpx 0 0 16rpx;
|
||||
background-color: #F2F2F2;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: $primary-admin;
|
||||
background: $light-primary-admin;
|
||||
border-color: $primary-admin;
|
||||
}
|
||||
|
||||
.text-primary {
|
||||
color: $primary-admin;
|
||||
}
|
||||
.bg-primary{
|
||||
background: $primary-admin;
|
||||
}
|
||||
.con_border {
|
||||
border: 1rpx solid $primary-admin;
|
||||
}
|
||||
.btn-box{
|
||||
padding:0 20rpx calc(20rpx + env(safe-area-inset-bottom));
|
||||
margin: 78rpx auto 0;
|
||||
}
|
||||
.disabled{
|
||||
background-color: #ccc;
|
||||
color: #fff;
|
||||
border: 1rpx solid #ccc;
|
||||
}
|
||||
.text--w111-FF7E00{
|
||||
color: #FF7E00;
|
||||
}
|
||||
</style>
|
||||
251
pro_v3.5.1/view/uniapp_v2/pages/behalf/components/skuSelect.js
Normal file
251
pro_v3.5.1/view/uniapp_v2/pages/behalf/components/skuSelect.js
Normal file
@@ -0,0 +1,251 @@
|
||||
import { adminCartAdd, adminCartDel, adminCartNum } from "@/api/admin.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
attr: {
|
||||
cartAttr: false,
|
||||
productAttr: [],
|
||||
productSelect: {}
|
||||
},
|
||||
productValue: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 默认选中属性
|
||||
*
|
||||
*/
|
||||
DefaultSelect: function() {
|
||||
let productAttr = this.attr.productAttr;
|
||||
let valueobj = [];
|
||||
let value = [];
|
||||
for (var key in this.productValue) {
|
||||
if (this.productValue[key].stock > 0) {
|
||||
valueobj = this.attr.productAttr.length ? key.split(',') : [];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 处理已售罄时默认选中第一个
|
||||
if (!valueobj.length && this.attr.productAttr.length) {
|
||||
value = Object.keys(this.productValue)[0].split(',');
|
||||
} else {
|
||||
value = valueobj;
|
||||
}
|
||||
for (let i = 0; i < productAttr.length; i++) {
|
||||
this.$set(productAttr[i], 'index', value[i]);
|
||||
}
|
||||
//sort();排序函数:数字-英文-汉字;
|
||||
let productSelect = this.productValue[value.join(',')];
|
||||
this.$set(this.attr.productSelect, 'store_name', this.storeInfo.store_name);
|
||||
if (productSelect && productAttr.length) {
|
||||
this.$set(this.attr.productSelect, 'image', productSelect.image);
|
||||
this.$set(this.attr.productSelect, 'price', productSelect.price);
|
||||
this.$set(this.attr.productSelect, 'channel_price', productSelect.channel_price || '');
|
||||
this.$set(this.attr.productSelect, 'stock', productSelect.stock);
|
||||
this.$set(this.attr.productSelect, 'unique', productSelect.unique);
|
||||
this.$set(this.attr.productSelect, 'cart_num', 1);
|
||||
this.$set(this, 'attrValue', value.join(','));
|
||||
this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
|
||||
this.$set(this, 'attrTxt', '已选择');
|
||||
} else if (!productSelect && productAttr.length) {
|
||||
this.$set(this.attr.productSelect, 'image', this.storeInfo.image);
|
||||
this.$set(this.attr.productSelect, 'price', this.storeInfo.price);
|
||||
this.$set(this.attr.productSelect, 'channel_price', this.storeInfo.price);
|
||||
this.$set(this.attr.productSelect, 'stock', 0);
|
||||
this.$set(this.attr.productSelect, 'unique', '');
|
||||
this.$set(this.attr.productSelect, 'cart_num', 0);
|
||||
this.$set(this.attr.productSelect, 'vip_price', this.storeInfo.vip_price);
|
||||
this.$set(this, 'attrValue', '');
|
||||
this.$set(this, 'attrTxt', '请选择');
|
||||
} else if (!productSelect && !productAttr.length) {
|
||||
this.$set(this.attr.productSelect, 'image', this.storeInfo.image);
|
||||
this.$set(this.attr.productSelect, 'price', this.storeInfo.price);
|
||||
this.$set(this.attr.productSelect, 'channel_price', this.storeInfo.price);
|
||||
this.$set(this.attr.productSelect, 'stock', this.storeInfo.stock);
|
||||
this.$set(this.attr.productSelect, 'unique', this.storeInfo.unique || '');
|
||||
this.$set(this.attr.productSelect, 'cart_num', 1);
|
||||
this.$set(this.attr.productSelect, 'vip_price', this.storeInfo.vip_price);
|
||||
this.$set(this, 'attrValue', '');
|
||||
this.$set(this, 'attrTxt', '请选择');
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 属性变动赋值
|
||||
*
|
||||
*/
|
||||
ChangeAttr: function(res) {
|
||||
let productSelect = this.productValue[res];
|
||||
this.$set(this, "selectSku", productSelect);
|
||||
if (productSelect && productSelect.stock >= 0) {
|
||||
this.$set(this.attr.productSelect, 'image', productSelect.image);
|
||||
this.$set(this.attr.productSelect, 'price', productSelect.price);
|
||||
this.$set(this.attr.productSelect, 'channel_price', productSelect.channel_price || '');
|
||||
this.$set(this.attr.productSelect, 'stock', productSelect.stock);
|
||||
this.$set(this.attr.productSelect, 'unique', productSelect.unique);
|
||||
this.$set(this.attr.productSelect, 'cart_num', 1);
|
||||
this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
|
||||
this.$set(this, 'attrValue', res);
|
||||
this.$set(this, 'attrTxt', '已选择');
|
||||
} else {
|
||||
this.$set(this.attr.productSelect, 'image', this.storeInfo.image);
|
||||
this.$set(this.attr.productSelect, 'price', this.storeInfo.price);
|
||||
this.$set(this.attr.productSelect, 'channel_price', this.storeInfo.price);
|
||||
this.$set(this.attr.productSelect, 'stock', 0);
|
||||
this.$set(this.attr.productSelect, 'unique', '');
|
||||
this.$set(this.attr.productSelect, 'cart_num', 0);
|
||||
this.$set(this.attr.productSelect, 'vip_price', this.storeInfo.vip_price);
|
||||
this.$set(this, 'attrValue', '');
|
||||
this.$set(this, 'attrTxt', '请选择');
|
||||
}
|
||||
},
|
||||
attrVal(val) {
|
||||
this.$set(this.attr.productAttr[val.indexw], 'index', this.attr.productAttr[val.indexw].attr_values[val
|
||||
.indexn]);
|
||||
},
|
||||
/**
|
||||
* 购物车手动填写
|
||||
*
|
||||
*/
|
||||
iptCartNum: function(e) {
|
||||
this.$set(this.attr.productSelect, 'cart_num', e);
|
||||
},
|
||||
onMyEvent: function() {
|
||||
this.$set(this.attr, 'cartAttr', false);
|
||||
},
|
||||
// 改变多属性购物车
|
||||
ChangeCartNumDuo(changeValue) {
|
||||
if(changeValue){
|
||||
if(this.attr.productSelect.cart_num == this.attr.productSelect.stock) return this.$util.Tips({
|
||||
title: '该产品没有更多库存了'
|
||||
});
|
||||
this.attr.productSelect.cart_num++;
|
||||
}else{
|
||||
if(this.attr.productSelect.cart_num == 1) return
|
||||
this.attr.productSelect.cart_num--;
|
||||
}
|
||||
},
|
||||
// 多规格加入购物车;
|
||||
goCatNum(type) {
|
||||
this.goCartChange(true,null,type);
|
||||
},
|
||||
goCartChange(duo, productId,type){
|
||||
let data = {
|
||||
productId: duo ? this.id : productId,
|
||||
cartNum: duo ? this.attr.productSelect.cart_num : 1,
|
||||
uniqueId: duo ? this.attr.productSelect.unique : "",
|
||||
'new':type,
|
||||
tourist_uid: this.touristId,
|
||||
is_channel: this.is_channel
|
||||
};
|
||||
adminCartAdd(this.userId,data).then(res=>{
|
||||
if(duo){
|
||||
this.attr.cartAttr = false;
|
||||
}
|
||||
if(type){
|
||||
uni.navigateTo({
|
||||
url: `/pages/behalf/order_confirm/index?cartId=${res.data.cartId}&uid=${this.userId}&news=1`
|
||||
});
|
||||
}
|
||||
this.$util.Tips({
|
||||
title: '加入购物车成功'
|
||||
});
|
||||
this.getCartList(1);
|
||||
|
||||
}).catch(err => {
|
||||
return this.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
});
|
||||
},
|
||||
goCartDuo(item) {
|
||||
if (!this.isLogin) {
|
||||
toLogin();
|
||||
} else {
|
||||
this.storeName = item.store_name;
|
||||
this.getAttrs(item.id);
|
||||
this.$set(this, 'id', item.id);
|
||||
this.$set(this.attr, 'cartAttr', true);
|
||||
}
|
||||
},
|
||||
// 点击默认单属性购物车
|
||||
goCartDan(item) {
|
||||
if (!this.isLogin) {
|
||||
this.getIsLogin();
|
||||
} else {
|
||||
this.goCartChange(false, item.id,item.cart_button == 1 ? 0 : 1);
|
||||
}
|
||||
},
|
||||
closeList(e) {
|
||||
this.$set(this.cartData, 'iScart', e);
|
||||
},
|
||||
selectitem(index){
|
||||
this.cartData.cartList[index].select = !this.cartData.cartList[index].select;
|
||||
let isSelect = this.cartData.cartList.filter(el=> el.select == true);
|
||||
if(isSelect.length == this.cartData.cartList.length){
|
||||
this.$refs.cartPopup.allSelect = true;
|
||||
}else{
|
||||
this.$refs.cartPopup.allSelect = false;
|
||||
}
|
||||
},
|
||||
selectAll(val){
|
||||
this.cartData.cartList.map(item=>{
|
||||
this.$set(item,'select',val ? false : true);
|
||||
})
|
||||
},
|
||||
cartDelChange(){
|
||||
let ids = [];
|
||||
this.cartData.cartList.forEach(item=>{
|
||||
if(item.select){
|
||||
ids.push(item.id);
|
||||
}
|
||||
})
|
||||
if(!ids.length) return this.$util.Tips({
|
||||
title: '请先选择商品'
|
||||
});
|
||||
adminCartDel(this.userId,{
|
||||
ids: ids.toString(),
|
||||
tourist_uid: this.touristId,
|
||||
}).then(res=>{
|
||||
this.getCartList(0);
|
||||
this.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
}).catch(err => {
|
||||
return this.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
});
|
||||
},
|
||||
cartNumChange(data){
|
||||
if(data.type){
|
||||
if(data.item.cart_num == data.item.productInfo.attrInfo.stock) return this.$util.Tips({
|
||||
title: '该产品没有更多库存了'
|
||||
});
|
||||
}else{
|
||||
if(data.item.cart_num == 1) return
|
||||
}
|
||||
adminCartNum(this.userId,{
|
||||
id: data.item.id,
|
||||
number: data.type ? data.item.cart_num + 1 : data.item.cart_num - 1,
|
||||
tourist_uid: this.touristId
|
||||
}).then(res=>{
|
||||
if(data.type){
|
||||
this.cartData.cartList[data.index].cart_num++;
|
||||
}else{
|
||||
this.cartData.cartList[data.index].cart_num--;
|
||||
}
|
||||
this.getTotalPrice();
|
||||
this.$util.Tips({
|
||||
title: res.msg
|
||||
});
|
||||
}).catch(err => {
|
||||
return this.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
49
pro_v3.5.1/view/uniapp_v2/pages/behalf/goods_list/index.vue
Normal file
49
pro_v3.5.1/view/uniapp_v2/pages/behalf/goods_list/index.vue
Normal file
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<view>
|
||||
<template1 v-if="level == 3" :userId="userId" :touristId="touristId" :is_channel="is_channel" ref="classOne"></template1>
|
||||
<template2 v-if="level == 2" :userId="userId" :touristId="touristId" :is_channel="is_channel" ref="classTwo"></template2>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import template1 from './template/template1.vue';
|
||||
import template2 from './template/template2.vue';
|
||||
export default {
|
||||
name:'behalfGoodsList',
|
||||
data() {
|
||||
return {
|
||||
userId:0,
|
||||
touristId:0,
|
||||
is_channel: ''
|
||||
}
|
||||
},
|
||||
components: {
|
||||
template1,
|
||||
template2
|
||||
},
|
||||
computed:{
|
||||
...mapGetters(['isLogin', 'uid', 'diyCategory']),
|
||||
level(){
|
||||
return this.diyCategory.level
|
||||
},
|
||||
},
|
||||
onLoad(e) {
|
||||
this.userId = e.uid || 0;
|
||||
this.is_channel = e.is_channel || '';
|
||||
if(e.uid == 0 && !this.$Cache.get('touristId')){
|
||||
let tid = Math.floor(Math.random() * 90000) + 10000;
|
||||
this.$Cache.set('touristId', tid)
|
||||
this.touristId = tid;
|
||||
}else if(e.uid == 0 && this.$Cache.get('touristId')){
|
||||
this.touristId = this.$Cache.get('touristId');
|
||||
}else if(e.uid != 0){
|
||||
this.touristId = 0;
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,703 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="flex-col bg--w111-fff" :style="{ height: windowHeight + 'px' }">
|
||||
<view :style="{paddingTop: sysHeight + 'px'}" class="text--w111-999">
|
||||
<view class="h-80 px-32 flex-y-center">
|
||||
<text class="iconfont icon-ic_leftarrow fs-40 mr-16" @tap="goBack"></text>
|
||||
<!-- #ifdef MP -->
|
||||
<view class="w-468 h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP -->
|
||||
<view class="flex-1 h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
|
||||
<!-- #endif -->
|
||||
<text class="iconfont icon-ic_search fs-28"></text>
|
||||
<input class="flex-1 h-full fs-28 pl-18" v-model="keyword" placeholder="请输入商品名称" placeholder-class="text--w111-999" @confirm="searchSubmit" />
|
||||
<!-- <text class="fs-24 pl-18">请输入商品名称</text> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex border_e">
|
||||
<scroll-view scroll-x="true" class="white-nowrap vertical-middle w-678 pl-20 pt-24 pb-24"
|
||||
show-scrollbar="false">
|
||||
<view class="inline-block mr-8" v-for="(item,index) in categoryList" :key="index"
|
||||
@tap="tapNav(index,item)">
|
||||
<view class="flex-col flex-center">
|
||||
<view :class="index == navActive ? 'active_pic' : 'scroll_pic'">
|
||||
<image :src="item.pic" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="w-120 h-40 flex-center fs-24 text--w111-333"
|
||||
:class="index == navActive ? 'active_cate_text' : ''">{{item.cate_name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="flex-1 flex-col flex-center fs-24" @tap="openCateDrawer(true)">
|
||||
<text>全</text>
|
||||
<text>部</text>
|
||||
<image class="w-28 h-28 block mt-8" src="@/static/img/all_pic.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="scroll_box flex flex-1">
|
||||
<view class="w-168 h-full bg--w111-f5f5f5">
|
||||
<scroll-view :scroll-top="0" scroll-y="true" class="h-full">
|
||||
<view class="w-168 h-96 flex-center fs-26 text--w111-666"
|
||||
v-for="(item,index) in categoryErList"
|
||||
:key="index"
|
||||
:class="[{'aside_active': index===tabClick},'aside_' + index]"
|
||||
@tap="longClick(index,item)">{{item.cate_name}}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="relative w-full h-full">
|
||||
<view class="flex-1 pl-24 pr-20 abs-lt" v-if="threeCateList.length">
|
||||
<view class="flex mt-24 mb-16">
|
||||
<scroll-view scroll-x="true" class="white-nowrap vertical-middle w-464"
|
||||
show-scrollbar="false">
|
||||
<view class="inline-block mr-16" v-for="(item,index) in threeCateList" :key="index"
|
||||
@tap="threeCateClick(index,item)">
|
||||
<view
|
||||
class="w-144 h-56 rd-30rpx bg--w111-f5f5f5 flex-center fs-24 text--w111-333"
|
||||
:class="index===threeClick?'cate_active':''">{{item.cate_name}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="w-56 h-56 rd-30rpx bg--w111-f5f5f5 flex-center ml-16"
|
||||
v-if="threeCateList.length"
|
||||
@tap="openCateDrawer(false)">
|
||||
<text class="iconfont icon-ic_downarrow fs-32 text--w111-333"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-96" v-if="threeCateList.length"></view>
|
||||
<view v-else class="mt-24"></view>
|
||||
<view class="pl-24 pr-20" :class="!threeCateList.length ? 'mt-24' : ''">
|
||||
<scroll-view :scroll-top="0" scroll-y="true" @scrolltolower="lower" @scroll="scroll"
|
||||
:style="{'height':scrollHeight + 'px'}">
|
||||
<!-- 小图模板 -->
|
||||
<view>
|
||||
<view class="mb-24 flex justify-between" v-for="(item,index) in tempArr" :key="index"
|
||||
@tap="goDetail(item)">
|
||||
<easy-loadimage
|
||||
:image-src="item.image"
|
||||
:borderSrc="item.activity_frame.image"
|
||||
width="176rpx"
|
||||
height="176rpx"
|
||||
borderRadius="16rpx"></easy-loadimage>
|
||||
<view class="flex-1 flex-col justify-between pl-20">
|
||||
<view class="w-full">
|
||||
<view class="line1 w-346 fs-28 text-#333 lh-40rpx">{{item.store_name}}</view>
|
||||
<view class="flex items-end flex-wrap mt-12 w-full">
|
||||
<BaseTag
|
||||
:text="label.label_name"
|
||||
:color="label.color"
|
||||
:background="label.bg_color"
|
||||
:borderColor="label.border_color"
|
||||
:circle="label.border_color ? true : false"
|
||||
:imgSrc="label.icon"
|
||||
v-for="(label, idx) in item.store_label" :key="idx"></BaseTag>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between-center">
|
||||
<view class="flex items-baseline">
|
||||
<baseMoney :money="item.price" symbolSize="24" integerSize="40" color="#FF7E00"
|
||||
decimalSize="24" weight>
|
||||
</baseMoney>
|
||||
</view>
|
||||
<view class="flex-center w-48 h-48 rd-30rpx bg-primary text--w111-fff"
|
||||
@tap.stop="goCartDuo(item)" v-if="item.spec_type">
|
||||
<text class="iconfont icon-ic_ShoppingCart1 fs-30"></text>
|
||||
</view>
|
||||
<view v-if="!item.spec_type">
|
||||
<view
|
||||
class="flex-center w-48 h-48 rd-30rpx bg-primary text--w111-fff "
|
||||
@tap.stop="goCartDan(item,index)">
|
||||
<text class="iconfont icon-ic_ShoppingCart1 fs-30"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!tempArr.length && !loading">
|
||||
<emptyPage :title="keyword ? '无搜索结果,换个词试试吧' : '暂无商品,看点别的吧~'"
|
||||
:src="keyword ? '/statics/images/noSearch.gif' : '/statics/images/empty-box.gif'"></emptyPage>
|
||||
</view>
|
||||
<view class="white-box"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-full fixed-lb pb-safe bg--w111-fff">
|
||||
<view class="w-full h-96 flex-between-center pl-28 pr-12">
|
||||
<view class="flex-y-center" @tap="getCartList(0)">
|
||||
<view class="w-96 h-96 rd-50rpx bg-primary flex-center relative cart-icon">
|
||||
<image src="@/static/img/cart_pic.png" class="w-54 h-54"></image>
|
||||
<uni-badge class="badge-style" v-if="cartData.cartList.length" :text="cartData.cartList.length"></uni-badge>
|
||||
</view>
|
||||
<view class="flex items-baseline ml-24">
|
||||
<baseMoney :money="totalPrice" symbolSize="32" integerSize="48" decimalSize="32"
|
||||
color="#333" weight></baseMoney>
|
||||
<view class="fs-24 text--w111-999 lh-34rpx pl-16" v-show="totalPrice > 0">
|
||||
查看明细<text class="iconfont icon-ic_uparrow fs-24"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-186 h-72 rd-40rpx flex-center text--w111-fff fs-26 fw-500 bg-primary mr-12"
|
||||
@tap="subOrder">去结算({{cartData.cartList.length}})</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="more_box abs-lt w-full bg--w111-fff rd-b-32rpx z-20" v-show="showCateDrawer">
|
||||
<view :style="{paddingTop: sysHeight + 'px'}">
|
||||
<view class="h-80 px-32 flex-y-center">
|
||||
<!-- #ifdef MP -->
|
||||
<view class="w-508 h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP -->
|
||||
<view class="w-full h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
|
||||
<!-- #endif -->
|
||||
<text class="iconfont icon-ic_search fs-28"></text>
|
||||
<text class="fs-24 text--w111-999 pl-18">请输入商品名称</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pt-32 pl-30 pr-30">
|
||||
<view v-if="!topNavShow">
|
||||
<view class="fs-32 text--w111-333" v-if="categoryList.length">
|
||||
{{categoryList[navActive].cate_name}}
|
||||
</view>
|
||||
<view class="grid-column-4 grid-gap-24rpx mt-24">
|
||||
<view class="w-154 h-56 rd-30rpx flex-center fs-24 text--w111-333 bg--w111-f5f5f5"
|
||||
v-for="(item,index) in threeCateList" :key="index"
|
||||
@tap="threeCateClick(index,item)" :class="index===threeClick?'cate_active':''">
|
||||
{{item.cate_name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="grid-column-5 grid-gap-x-22rpx grid-gap-y-32rpx" v-if="topNavShow">
|
||||
<view class="flex-col flex-center" v-for="(item,index) in categoryList" :key="index"
|
||||
@tap="tapNav(index,item)">
|
||||
<view :class="index == navActive ? 'active_pic' : 'scroll_pic'">
|
||||
<image :src="item.pic" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="w-120 h-40 flex-center fs-24 text--w111-333"
|
||||
:class="index == navActive ? 'active_cate_text' : ''">{{item.cate_name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center fs-24 text--w111-999 h-80 mt-32" @tap="closeCateDrawer">
|
||||
<text>点击收起 <text class="iconfont icon-ic_uparrow pl-4 fs-24"></text> </text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mask" v-show="showCateDrawer" @tap="closeCateDrawer"></view>
|
||||
<cartList
|
||||
ref="cartPopup"
|
||||
:cartData="cartData"
|
||||
@closeList="closeList"
|
||||
@onSelect="selectitem"
|
||||
@onSelectAll="selectAll"
|
||||
@onDelCart="cartDelChange"
|
||||
@onCartConfirm="subOrder"
|
||||
@onCartNum="cartNumChange">
|
||||
</cartList>
|
||||
<productWindow
|
||||
:attr="attr"
|
||||
:cartButton="storeInfo.cart_button"
|
||||
:is_channel="is_channel"
|
||||
@myevent="onMyEvent"
|
||||
@ChangeAttr="ChangeAttr"
|
||||
@ChangeCartNum="ChangeCartNumDuo"
|
||||
@attrVal="attrVal"
|
||||
@iptCartNum="iptCartNum"
|
||||
@goCat="goCatNum"></productWindow>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let windowHeight = uni.getWindowInfo().windowHeight;
|
||||
let sysHeight = uni.getWindowInfo().statusBarHeight;
|
||||
import { adminCategory, adminProList, adminCartList } from "@/api/admin.js"
|
||||
import {getAttr,postCartNum} from '@/api/store.js';
|
||||
import {mapState,mapGetters} from 'vuex';
|
||||
import {toLogin} from '@/libs/login.js';
|
||||
import skuSelect from '../../components/skuSelect.js'
|
||||
import emptyPage from '@/components/emptyPage.vue';
|
||||
import productWindow from "../../components/productWindow.vue"
|
||||
import cartList from "../../components/cartList.vue"
|
||||
export default {
|
||||
props: {
|
||||
userId:{
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
touristId:{
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
is_channel:{
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
windowHeight: windowHeight,
|
||||
showCateDrawer: false,
|
||||
sysHeight: sysHeight,
|
||||
categoryList: [],
|
||||
navActive: 0,
|
||||
categoryTitle: '',
|
||||
categoryErList: [],
|
||||
tabLeft: 0,
|
||||
isWidth: 0, //每个导航栏占位
|
||||
tabClick: 0, //导航栏被点击
|
||||
iSlong: false,
|
||||
tempArr: [],
|
||||
loading: false,
|
||||
loadend: false,
|
||||
loadTitle: '加载更多',
|
||||
page: 1,
|
||||
limit: 10,
|
||||
cid: 0, //一级分类
|
||||
sid: 0, //二级分类
|
||||
tid: 0, //三级分类
|
||||
keyword:'',
|
||||
isAuto: false, //没有授权的不会自动授权
|
||||
isShowAuth: false, //是否隐藏授权
|
||||
attr: {
|
||||
cartAttr: false,
|
||||
productAttr: [],
|
||||
productSelect: {}
|
||||
},
|
||||
productValue: [],
|
||||
attrValue: '', //已选属性
|
||||
storeName: '', //多属性产品名称
|
||||
id: 0,
|
||||
cartData: {
|
||||
cartList: [],
|
||||
iScart: false
|
||||
},
|
||||
totalPrice: 0.00,
|
||||
lengthCart: 0,
|
||||
is_vip: 0, //是否是会员
|
||||
cart_num: 0,
|
||||
storeInfo: {},
|
||||
scrollHeight: 0,
|
||||
threeCateList: [],
|
||||
threeClick: 0,
|
||||
topNavShow: true,
|
||||
selectSku: {},
|
||||
skuArr: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
productWindow,
|
||||
emptyPage,
|
||||
cartList
|
||||
},
|
||||
mixins: [skuSelect],
|
||||
computed: {
|
||||
...mapState({
|
||||
cartNum: state => state.indexData.cartNum
|
||||
}),
|
||||
...mapGetters(['isLogin', 'uid', 'cartNum'])
|
||||
},
|
||||
watch:{
|
||||
cartNum(){
|
||||
this.getCartList(1);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getAllCategory();
|
||||
setTimeout(() => {
|
||||
this.getScrollHeight();
|
||||
}, 500);
|
||||
if(this.isLogin){
|
||||
this.getCartList(1);
|
||||
}
|
||||
uni.$on('newAttrNum', (data) => {
|
||||
if (data.length) {
|
||||
this.tempArr.forEach((item) => {
|
||||
data.forEach(j => {
|
||||
if (item.id == j.id) {
|
||||
item.cart_num = j.num
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
uni.$on('newCartNum', (data) => {
|
||||
if (data.length) {
|
||||
this.tempArr.forEach((item) => {
|
||||
data.forEach(j => {
|
||||
if (item.id == j.product_id) {
|
||||
item.cart_num = 0
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getScrollHeight() {
|
||||
let sysH = uni.getWindowInfo().statusBarHeight;
|
||||
this.scrollHeight = windowHeight - 138 - sysH;
|
||||
},
|
||||
getAllCategory() {
|
||||
let that = this;
|
||||
adminCategory().then(res => {
|
||||
if (!res.data.length) return
|
||||
let data = res.data;
|
||||
that.categoryTitle = data[0].cate_name;
|
||||
that.cid = data[0].id;
|
||||
that.sid = 0;
|
||||
that.tid = 0;
|
||||
that.navActive = 0;
|
||||
that.tabClick = 0;
|
||||
that.categoryList = data;
|
||||
that.categoryErList = res.data[0].children ? res.data[0].children : [];
|
||||
that.threeCateList = res.data[0].children[0].children ? res.data[0].children[0].children : [];
|
||||
if (this.threeCateList.length) {
|
||||
this.threeCateList.unshift({
|
||||
cate_name: '全部商品',
|
||||
id: 0
|
||||
})
|
||||
}
|
||||
that.page = 1;
|
||||
that.loadend = false;
|
||||
that.tempArr = [];
|
||||
that.productslist();
|
||||
})
|
||||
},
|
||||
// 产品列表
|
||||
productslist() {
|
||||
let that = this;
|
||||
if (that.loadend) return;
|
||||
if (that.loading) return;
|
||||
that.loading = true;
|
||||
that.loadTitle = '';
|
||||
adminProList({
|
||||
page: that.page,
|
||||
limit: that.limit,
|
||||
type: 1,
|
||||
cid: that.cid,
|
||||
sid: that.sid,
|
||||
tid: that.tid,
|
||||
keyword:that.keyword,
|
||||
uid: that.userId,
|
||||
is_channel: this.is_channel
|
||||
}).then(res => {
|
||||
let list = res.data,
|
||||
loadend = list.length < that.limit;
|
||||
that.tempArr = that.$util.SplitArray(list, that.tempArr);
|
||||
that.$set(that, 'tempArr', that.tempArr);
|
||||
that.loading = false;
|
||||
that.loadend = loadend;
|
||||
that.loadTitle = loadend ? "没有更多内容啦~" : "加载更多";
|
||||
that.page = that.page + 1;
|
||||
}).catch(err => {
|
||||
that.loading = false;
|
||||
that.loadTitle = '加载更多'
|
||||
});
|
||||
},
|
||||
tapNav(index, item) {
|
||||
uni.pageScrollTo({
|
||||
duration: 0,
|
||||
scrollTop: 0
|
||||
})
|
||||
let list = this.categoryList[index];
|
||||
this.navActive = index;
|
||||
this.categoryTitle = list.cate_name;
|
||||
this.categoryErList = item.children ? item.children : [];
|
||||
this.threeCateList = [];
|
||||
if (this.categoryErList.length) {
|
||||
this.threeCateList = item.children[0].children ? item.children[0].children : [];
|
||||
if (this.threeCateList && !this.haveAll(this.threeCateList)) {
|
||||
this.threeCateList.unshift({
|
||||
cate_name: '全部商品',
|
||||
id: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
this.tabClick = 0;
|
||||
this.tabLeft = 0;
|
||||
this.cid = list.id;
|
||||
this.sid = 0;
|
||||
this.tid = 0;
|
||||
this.page = 1;
|
||||
this.loadend = false;
|
||||
this.tempArr = [];
|
||||
this.productslist();
|
||||
},
|
||||
// 导航栏点击
|
||||
longClick(index, item) {
|
||||
this.tabClick = index; //设置导航点击了哪一个
|
||||
this.threeClick = 0;
|
||||
this.sid = this.categoryErList[index].id;
|
||||
this.tid = 0;
|
||||
this.threeCateList = item.children && item.children.length ? item.children : [];
|
||||
|
||||
if (this.threeCateList && this.threeCateList.length && !this.haveAll(this.threeCateList)) {
|
||||
this.threeCateList.unshift({
|
||||
cate_name: '全部商品',
|
||||
id: 0
|
||||
})
|
||||
}
|
||||
this.page = 1;
|
||||
this.loadend = false;
|
||||
this.tempArr = [];
|
||||
this.productslist();
|
||||
},
|
||||
threeCateClick(index, item) {
|
||||
this.threeClick = index;
|
||||
this.tid = item.id;
|
||||
this.page = 1;
|
||||
this.loadend = false;
|
||||
this.tempArr = [];
|
||||
this.productslist();
|
||||
},
|
||||
searchSubmit(){
|
||||
this.page = 1;
|
||||
this.loadend = false;
|
||||
this.tempArr = [];
|
||||
this.productslist();
|
||||
},
|
||||
deepClone(obj) {
|
||||
let newObj = Array.isArray(obj) ? [] : {}
|
||||
if (obj && typeof obj === "object") {
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
newObj[key] = (obj && typeof obj[key] === 'object') ? this.deepClone(obj[key]) : obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return newObj
|
||||
},
|
||||
haveAll(arr) {
|
||||
let cloneMap = this.deepClone(arr),
|
||||
list = [];
|
||||
cloneMap.forEach(item => {
|
||||
list.push(item.id);
|
||||
})
|
||||
return list.includes(0) ? true : false
|
||||
},
|
||||
// 生成订单;
|
||||
subOrder() {
|
||||
let that = this,
|
||||
list = that.cartData.cartList,
|
||||
ids = [];
|
||||
if (list.length) {
|
||||
list.forEach(item => {
|
||||
if (item.attrStatus && item.status) {
|
||||
ids.push(item.id)
|
||||
}
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: `/pages/behalf/order_confirm/index?cartId=${ids.join(',')}&uid=${this.userId}&news=0`
|
||||
});
|
||||
that.cartData.iScart = false;
|
||||
} else {
|
||||
return that.$util.Tips({
|
||||
title: '请选择产品'
|
||||
});
|
||||
}
|
||||
},
|
||||
// 计算总价;
|
||||
getTotalPrice() {
|
||||
let that = this,
|
||||
list = that.cartData.cartList,
|
||||
totalPrice = 0.00;
|
||||
list.forEach(item => {
|
||||
if (item.attrStatus && item.status) {
|
||||
totalPrice = that.$util.$h.Add(totalPrice, that.$util.$h.Mul(item.cart_num, item.truePrice));
|
||||
}
|
||||
})
|
||||
that.$set(that, 'totalPrice', totalPrice);
|
||||
},
|
||||
getCartList(iSshow) {
|
||||
let that = this;
|
||||
adminCartList(this.userId, {
|
||||
is_channel: this.is_channel,
|
||||
tourist_uid: this.touristId,
|
||||
}).then(res => {
|
||||
res.data.map(item=>{
|
||||
this.$set(item,'select',false);
|
||||
})
|
||||
that.$set(that.cartData, 'cartList', res.data);
|
||||
if (res.data.length) {
|
||||
that.$set(that.cartData, 'iScart', iSshow ? false : !that.cartData.iScart);
|
||||
} else {
|
||||
that.$set(that.cartData, 'iScart', false);
|
||||
}
|
||||
that.getTotalPrice();
|
||||
})
|
||||
},
|
||||
// 商品详情接口;
|
||||
getAttrs(id) {
|
||||
let that = this;
|
||||
let data = '';
|
||||
if(this.is_channel){
|
||||
data = {is_channel: 1,uid: that.userId};
|
||||
}
|
||||
getAttr(id, 0, data).then(res => {
|
||||
that.$set(that.attr, 'productAttr', res.data.productAttr);
|
||||
that.$set(that, 'productValue', res.data.productValue);
|
||||
that.$set(that, 'is_vip', res.data.storeInfo.is_vip);
|
||||
that.$set(that, 'storeInfo', res.data.storeInfo);
|
||||
that.skuArr = [];
|
||||
for (let key in res.data.productValue) {
|
||||
let obj = res.data.productValue[key];
|
||||
that.skuArr.push(obj)
|
||||
}
|
||||
if (!that.skuArr.length) {
|
||||
that.skuArr = [{
|
||||
image: this.storeInfo.image,
|
||||
suk: this.storeInfo.store_name,
|
||||
price: this.storeInfo.price
|
||||
}];
|
||||
}
|
||||
this.$set(this, "selectSku", that.skuArr[0]);
|
||||
that.DefaultSelect();
|
||||
})
|
||||
},
|
||||
//点击sku图片打开轮播图
|
||||
showImg(index) {
|
||||
this.$refs.cusPreviewImg.open(this.selectSku.suk)
|
||||
},
|
||||
//滑动轮播图选择商品
|
||||
changeSwitch(e) {
|
||||
let productSelect = this.skuArr[e];
|
||||
this.$set(this, 'selectSku', productSelect);
|
||||
var skuList = productSelect.suk.split(',');
|
||||
skuList.forEach((i, index) => {
|
||||
this.$set(this.attr.productAttr[index], 'index', skuList[index]);
|
||||
})
|
||||
if (productSelect) {
|
||||
this.$set(this.attr.productSelect, 'image', productSelect.image);
|
||||
this.$set(this.attr.productSelect, 'price', productSelect.price);
|
||||
this.$set(this.attr.productSelect, 'stock', productSelect.stock);
|
||||
this.$set(this.attr.productSelect, 'unique', productSelect.unique);
|
||||
this.$set(this.attr.productSelect, 'cart_num', 1);
|
||||
this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
|
||||
this.$set(this, 'attrValue', productSelect.suk);
|
||||
this.$set(this, 'attrTxt', '已选择');
|
||||
}
|
||||
},
|
||||
// 去详情页
|
||||
goDetail(item) {
|
||||
if(item.spec_type){
|
||||
this.goCartDuo(item);
|
||||
}else{
|
||||
this.goCartDan(item);
|
||||
}
|
||||
},
|
||||
closeCateDrawer() {
|
||||
this.showCateDrawer = false;
|
||||
},
|
||||
openCateDrawer(type) {
|
||||
this.topNavShow = type;
|
||||
this.showCateDrawer = true;
|
||||
},
|
||||
lower(e) {
|
||||
this.productslist();
|
||||
},
|
||||
scroll(e) {
|
||||
uni.$emit('scroll');
|
||||
},
|
||||
goBack(){
|
||||
uni.navigateBack()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scroll_box {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.aside_active {
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: $primary-admin;
|
||||
font-weight: 500;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
width: 6rpx;
|
||||
height: 48rpx;
|
||||
background-color: $primary-admin;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.cate_active {
|
||||
color: $primary-admin;
|
||||
background: $light-primary-admin;
|
||||
border: 1rpx solid $primary-admin;
|
||||
}
|
||||
|
||||
.text-primary{
|
||||
color: $primary-admin;
|
||||
}
|
||||
.bg-primary{
|
||||
background: $primary-admin;
|
||||
}
|
||||
|
||||
.bg-primary-light {
|
||||
background: $light-primary-admin;
|
||||
}
|
||||
|
||||
.cart-icon{
|
||||
margin-left: -4rpx;
|
||||
top: -20rpx;
|
||||
}
|
||||
|
||||
.border_e {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.active_pic {
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
background-color: #fff;
|
||||
padding: 3rpx;
|
||||
border-radius: 50%;
|
||||
border: 3rpx solid $primary-admin;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.scroll_pic {
|
||||
image {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.active_cate_text {
|
||||
background: $primary-admin;
|
||||
color: #fff;
|
||||
border-radius: 20rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
.badge-style {
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: -20rpx;
|
||||
/deep/ .uni-badge--error {
|
||||
background-color: $primary-admin !important;
|
||||
}
|
||||
}
|
||||
.white-box{
|
||||
height: calc(300rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,655 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="flex-col bg--w111-fff" :style="{ height: windowHeight + 'px' }">
|
||||
<view :style="{paddingTop: sysHeight + 'px'}" class="text--w111-999">
|
||||
<view class="h-80 px-32 flex-y-center">
|
||||
<text class="iconfont icon-ic_leftarrow fs-40 mr-16" @tap="goBack"></text>
|
||||
<!-- #ifdef MP -->
|
||||
<view class="w-468 h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP -->
|
||||
<view class="flex-1 h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
|
||||
<!-- #endif -->
|
||||
<text class="iconfont icon-ic_search fs-28"></text>
|
||||
<input class="flex-1 h-full fs-28 pl-18 text--w111-333" v-model="keyword" placeholder="请输入商品名称" placeholder-class="text--w111-999" @confirm="searchSubmit" />
|
||||
<!-- <text class="fs-24 pl-18">请输入商品名称</text> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="scroll_box flex flex-1">
|
||||
<view class="w-168 h-full bg--w111-f5f5f5">
|
||||
<scroll-view :scroll-top="0" scroll-y="true" class="h-full">
|
||||
<view class="w-168 h-96 flex-center fs-26 text--w111-666"
|
||||
v-for="(item,index) in categoryList":key="index"
|
||||
:class="index == navActive?'aside_active':''"
|
||||
@tap="tapNav(index,item)">
|
||||
{{item.cate_name}}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="relative w-full h-full">
|
||||
<view class="flex-1 pl-24 pr-20 abs-lt">
|
||||
<view class="flex mt-24 mb-16">
|
||||
<scroll-view scroll-x="true" class="white-nowrap vertical-middle w-464"
|
||||
show-scrollbar="false">
|
||||
<view class="inline-block mr-16"
|
||||
v-for="(item,index) in categoryErList" :key="index"
|
||||
@tap="longClick(index,item)">
|
||||
<view
|
||||
class="w-144 h-56 rd-30rpx bg--w111-f5f5f5 flex-center fs-24 text--w111-333"
|
||||
:class="index===tabClick?'cate_active':''">{{item.cate_name}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="w-56 h-56 rd-30rpx bg--w111-f5f5f5 flex-center ml-16"
|
||||
v-if="categoryErList.length"
|
||||
@tap="openCateDrawer(false)">
|
||||
<text class="iconfont icon-ic_downarrow fs-32 text--w111-333"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-96"></view>
|
||||
<view class="px-24">
|
||||
<scroll-view :scroll-top="0" scroll-y="true" @scrolltolower="lower" @scroll="scroll"
|
||||
:style="{'height':scrollHeight + 'px'}">
|
||||
<!-- 小图模板 -->
|
||||
<view>
|
||||
<view class="mb-24 flex justify-between" v-for="(item,index) in tempArr"
|
||||
:key="index" @tap="goDetail(item)">
|
||||
<easy-loadimage
|
||||
:image-src="item.image"
|
||||
:borderSrc="item.activity_frame.image"
|
||||
width="176rpx"
|
||||
height="176rpx"
|
||||
borderRadius="16rpx"></easy-loadimage>
|
||||
<view class="flex-1 flex-col justify-between pl-20">
|
||||
<view class="w-full">
|
||||
<view class="line1 w-346 fs-28 text-#333 lh-40rpx">{{item.store_name}}</view>
|
||||
<view class="flex items-end flex-wrap mt-12 w-full">
|
||||
<BaseTag
|
||||
:text="label.label_name"
|
||||
:color="label.color"
|
||||
:background="label.bg_color"
|
||||
:borderColor="label.border_color"
|
||||
:circle="label.border_color ? true : false"
|
||||
:imgSrc="label.icon"
|
||||
v-for="(label, idx) in item.store_label" :key="idx"></BaseTag>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between-center">
|
||||
<view class="flex items-baseline">
|
||||
<baseMoney :money="item.price" symbolSize="24" integerSize="40" color="#FF7E00"
|
||||
decimalSize="24" weight>
|
||||
</baseMoney>
|
||||
</view>
|
||||
<view class="flex-center w-48 h-48 rd-30rpx bg-primary text--w111-fff" v-if="item.spec_type">
|
||||
<text class="iconfont icon-ic_ShoppingCart1 fs-30"></text>
|
||||
</view>
|
||||
<view v-if="!item.spec_type">
|
||||
<view class="flex-center w-48 h-48 rd-30rpx bg-primary text--w111-fff ">
|
||||
<text class="iconfont icon-ic_ShoppingCart1 fs-30"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!tempArr.length && !loading">
|
||||
<emptyPage :title="keyword ? '无搜索结果,换个词试试吧' : '暂无商品,看点别的吧~'"
|
||||
:src="keyword ? '/statics/images/noSearch.gif' : '/statics/images/empty-box.gif'"></emptyPage>
|
||||
</view>
|
||||
<view class="white-box"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-full fixed-lb pb-safe bg--w111-fff">
|
||||
<view class="w-full h-96 flex-between-center pl-28 pr-12">
|
||||
<view class="flex-y-center" @tap="getCartList(0)">
|
||||
<view class="w-96 h-96 rd-50rpx bg-primary flex-center relative cart-icon">
|
||||
<image src="@/static/img/cart_pic.png" class="w-54 h-54"></image>
|
||||
<uni-badge class="badge-style" v-if="cartData.cartList.length" :text="cartData.cartList.length"></uni-badge>
|
||||
</view>
|
||||
<view class="flex items-baseline ml-24">
|
||||
<baseMoney :money="totalPrice" symbolSize="32" integerSize="48" decimalSize="32"
|
||||
color="#333" weight></baseMoney>
|
||||
<view class="fs-24 text--w111-999 lh-34rpx pl-16" v-show="totalPrice > 0">
|
||||
查看明细 <text class="iconfont icon-ic_uparrow fs-24"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-186 h-72 rd-40rpx flex-center text--w111-fff fs-26 fw-500 bg-primary mr-12"
|
||||
@tap="subOrder">去结算({{cartData.cartList.length}})</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="more_box abs-lt w-full bg--w111-fff rd-b-32rpx z-20" v-show="showCateDrawer">
|
||||
<view :style="{paddingTop: sysHeight + 'px'}">
|
||||
<view class="h-80 px-32 flex-y-center">
|
||||
<!-- #ifdef MP -->
|
||||
<view class="w-508 h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP -->
|
||||
<view class="w-full h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
|
||||
<!-- #endif -->
|
||||
<text class="iconfont icon-ic_search fs-28"></text>
|
||||
<text class="fs-24 text--w111-999 pl-18">请输入商品名称</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pt-32 pl-30 pr-30">
|
||||
<view>
|
||||
<view class="fs-32 text--w111-333" v-if="categoryErList.length">
|
||||
{{categoryErList[tabClick].cate_name}}
|
||||
</view>
|
||||
<view class="grid-column-4 grid-gap-24rpx mt-24">
|
||||
<view class="w-154 h-56 rd-30rpx flex-center fs-24 text--w111-333 bg--w111-f5f5f5"
|
||||
v-for="(item,index) in categoryErList" :key="index" @tap="longClick(index,item)"
|
||||
:class="index===tabClick?'cate_active':''">
|
||||
{{item.cate_name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center fs-24 text--w111-999 h-80 mt-32" @tap="closeCateDrawer">
|
||||
<text>点击收起 <text class="iconfont icon-ic_uparrow fs-24 pl-4"></text> </text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mask" v-show="showCateDrawer" @tap="closeCateDrawer"></view>
|
||||
<cartList
|
||||
ref="cartPopup"
|
||||
:cartData="cartData"
|
||||
@closeList="closeList"
|
||||
@onSelect="selectitem"
|
||||
@onSelectAll="selectAll"
|
||||
@onDelCart="cartDelChange"
|
||||
@onCartConfirm="subOrder"
|
||||
@onCartNum="cartNumChange">
|
||||
</cartList>
|
||||
<productWindow
|
||||
:attr="attr"
|
||||
:cartButton="storeInfo.cart_button"
|
||||
:is_channel="is_channel"
|
||||
@myevent="onMyEvent"
|
||||
@ChangeAttr="ChangeAttr"
|
||||
@ChangeCartNum="ChangeCartNumDuo"
|
||||
@attrVal="attrVal"
|
||||
@iptCartNum="iptCartNum"
|
||||
@goCat="goCatNum"></productWindow>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let windowHeight = uni.getWindowInfo().windowHeight;
|
||||
let sysHeight = uni.getWindowInfo().statusBarHeight;
|
||||
import { adminCategory, adminProList, adminCartList } from "@/api/admin.js"
|
||||
import { getAttr, postCartNum } from '@/api/store.js';
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
import {goShopDetail} from '@/libs/order.js';
|
||||
import {toLogin} from '@/libs/login.js';
|
||||
import skuSelect from '../../components/skuSelect.js'
|
||||
import emptyPage from '@/components/emptyPage.vue';
|
||||
import productWindow from "../../components/productWindow.vue"
|
||||
import cartList from "../../components/cartList.vue"
|
||||
export default {
|
||||
props: {
|
||||
userId:{
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
touristId:{
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
is_channel:{
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
windowHeight: windowHeight,
|
||||
showCateDrawer: false,
|
||||
sysHeight: sysHeight,
|
||||
categoryList: [],
|
||||
navActive: 0,
|
||||
categoryTitle: '',
|
||||
categoryErList: [],
|
||||
tabLeft: 0,
|
||||
isWidth: 0, //每个导航栏占位
|
||||
tabClick: 0, //导航栏被点击
|
||||
iSlong: false,
|
||||
tempArr: [],
|
||||
loading: false,
|
||||
loadend: false,
|
||||
loadTitle: '加载更多',
|
||||
page: 1,
|
||||
limit: 10,
|
||||
cid: 0, //一级分类
|
||||
sid: 0, //二级分类
|
||||
tid: 0, //三级分类
|
||||
keyword:'',
|
||||
isAuto: false, //没有授权的不会自动授权
|
||||
isShowAuth: false, //是否隐藏授权
|
||||
attr: {
|
||||
cartAttr: false,
|
||||
productAttr: [],
|
||||
productSelect: {}
|
||||
},
|
||||
productValue: [],
|
||||
attrValue: '', //已选属性
|
||||
storeName: '', //多属性产品名称
|
||||
id: 0,
|
||||
cartData: {
|
||||
cartList: [],
|
||||
iScart: false
|
||||
},
|
||||
totalPrice: 0.00,
|
||||
lengthCart: 0,
|
||||
is_vip: 0, //是否是会员
|
||||
cart_num: 0,
|
||||
storeInfo: {},
|
||||
scrollHeight: 0,
|
||||
threeCateList: [],
|
||||
threeClick: 0,
|
||||
topNavShow: true,
|
||||
selectSku: {},
|
||||
skuArr: []
|
||||
}
|
||||
},
|
||||
mixins: [skuSelect],
|
||||
components: {
|
||||
emptyPage,
|
||||
productWindow,
|
||||
cartList
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['isLogin', 'uid'])
|
||||
},
|
||||
mounted() {
|
||||
this.getAllCategory();
|
||||
setTimeout(() => {
|
||||
this.getScrollHeight();
|
||||
}, 500)
|
||||
if(this.isLogin){
|
||||
this.getCartList(1);
|
||||
}
|
||||
uni.$on('newAttrNum', (data) => {
|
||||
if (data.length) {
|
||||
this.tempArr.forEach((item) => {
|
||||
data.forEach(j => {
|
||||
if (item.id == j.id) {
|
||||
item.cart_num = j.num
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
uni.$on('newCartNum', (data) => {
|
||||
if (data.length) {
|
||||
this.tempArr.forEach((item) => {
|
||||
data.forEach(j => {
|
||||
if (item.id == j.product_id) {
|
||||
item.cart_num = 0
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getScrollHeight() {
|
||||
let sysH = uni.getWindowInfo().statusBarHeight;
|
||||
this.scrollHeight = windowHeight - sysH;
|
||||
},
|
||||
getAllCategory() {
|
||||
let that = this;
|
||||
adminCategory().then(res => {
|
||||
if (!res.data.length) return
|
||||
res.data.map(item=>{
|
||||
if(item.children && item.children.length){
|
||||
item.children.unshift({
|
||||
id:item.id,
|
||||
cate_name: '全部商品'
|
||||
})
|
||||
}
|
||||
})
|
||||
let data = res.data;
|
||||
that.categoryTitle = data[0].cate_name;
|
||||
that.cid = data[0].id;
|
||||
that.sid = 0;
|
||||
that.tid = 0;
|
||||
that.navActive = 0;
|
||||
that.tabClick = 0;
|
||||
that.categoryList = data;
|
||||
that.categoryErList = res.data[0].children ? res.data[0].children : [];
|
||||
that.page = 1;
|
||||
that.loadend = false;
|
||||
that.tempArr = [];
|
||||
that.productslist();
|
||||
})
|
||||
},
|
||||
// 产品列表
|
||||
productslist() {
|
||||
let that = this;
|
||||
if (that.loadend) return;
|
||||
if (that.loading) return;
|
||||
that.loading = true;
|
||||
that.loadTitle = '';
|
||||
adminProList({
|
||||
page: that.page,
|
||||
limit: that.limit,
|
||||
type: 1,
|
||||
cid: that.cid,
|
||||
sid: that.sid,
|
||||
tid: that.tid,
|
||||
keyword:that.keyword,
|
||||
uid: that.userId,
|
||||
is_channel: this.is_channel
|
||||
}).then(res => {
|
||||
let list = res.data,
|
||||
loadend = list.length < that.limit;
|
||||
that.tempArr = that.$util.SplitArray(list, that.tempArr);
|
||||
that.$set(that, 'tempArr', that.tempArr);
|
||||
that.loading = false;
|
||||
that.loadend = loadend;
|
||||
that.loadTitle = loadend ? "没有更多内容啦~" : "加载更多";
|
||||
that.page = that.page + 1;
|
||||
}).catch(err => {
|
||||
that.loading = false;
|
||||
that.loadTitle = '加载更多'
|
||||
});
|
||||
},
|
||||
tapNav(index, item) {
|
||||
uni.pageScrollTo({
|
||||
duration: 0,
|
||||
scrollTop: 0
|
||||
})
|
||||
let list = this.categoryList[index];
|
||||
this.navActive = index;
|
||||
this.categoryTitle = list.cate_name;
|
||||
this.categoryErList = item.children ? item.children : [];
|
||||
this.tabClick = 0;
|
||||
this.tabLeft = 0;
|
||||
this.cid = list.id;
|
||||
this.sid = 0;
|
||||
this.page = 1;
|
||||
this.loadend = false;
|
||||
this.tempArr = [];
|
||||
this.productslist();
|
||||
},
|
||||
// 导航栏点击
|
||||
longClick(index, item) {
|
||||
this.tabClick = index; //设置导航点击了哪一个
|
||||
this.sid = this.categoryErList[index].id;
|
||||
this.page = 1;
|
||||
this.loadend = false;
|
||||
this.tempArr = [];
|
||||
this.productslist();
|
||||
},
|
||||
searchSubmit(){
|
||||
this.page = 1;
|
||||
this.loadend = false;
|
||||
this.tempArr = [];
|
||||
this.productslist();
|
||||
},
|
||||
deepClone(obj) {
|
||||
let newObj = Array.isArray(obj) ? [] : {}
|
||||
if (obj && typeof obj === "object") {
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
newObj[key] = (obj && typeof obj[key] === 'object') ? this.deepClone(obj[key]) : obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return newObj
|
||||
},
|
||||
haveAll(arr) {
|
||||
let cloneMap = this.deepClone(arr),
|
||||
list = [];
|
||||
cloneMap.forEach(item => {
|
||||
list.push(item.id);
|
||||
})
|
||||
return list.includes(0) ? true : false
|
||||
},
|
||||
// 生成订单;
|
||||
subOrder() {
|
||||
let that = this,
|
||||
list = that.cartData.cartList,
|
||||
ids = [];
|
||||
if (list.length) {
|
||||
list.forEach(item => {
|
||||
if (item.attrStatus && item.status) {
|
||||
ids.push(item.id)
|
||||
}
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: `/pages/behalf/order_confirm/index?cartId=${ids.join(',')}&uid=${this.userId}&news=0`
|
||||
});
|
||||
that.cartData.iScart = false;
|
||||
} else {
|
||||
return that.$util.Tips({
|
||||
title: '请选择产品'
|
||||
});
|
||||
}
|
||||
},
|
||||
// 计算总价;
|
||||
getTotalPrice() {
|
||||
let that = this,
|
||||
list = that.cartData.cartList,
|
||||
totalPrice = 0.00;
|
||||
list.forEach(item => {
|
||||
if (item.attrStatus && item.status) {
|
||||
totalPrice = that.$util.$h.Add(totalPrice, that.$util.$h.Mul(item.cart_num, item
|
||||
.truePrice));
|
||||
}
|
||||
})
|
||||
that.$set(that, 'totalPrice', totalPrice);
|
||||
},
|
||||
getCartList(iSshow) {
|
||||
let that = this;
|
||||
adminCartList(this.userId,{
|
||||
tourist_uid: this.touristId,
|
||||
is_channel: this.is_channel
|
||||
}).then(res => {
|
||||
res.data.map(item=>{
|
||||
this.$set(item,'select',false);
|
||||
})
|
||||
that.$set(that.cartData, 'cartList', res.data);
|
||||
if (res.data.length) {
|
||||
that.$set(that.cartData, 'iScart', iSshow ? false : !that.cartData.iScart);
|
||||
} else {
|
||||
that.$set(that.cartData, 'iScart', false);
|
||||
}
|
||||
that.getTotalPrice();
|
||||
})
|
||||
},
|
||||
CartNumAdd(index, item) {
|
||||
if (item.is_limit && item.cart_num >= item.limit_num) {
|
||||
this.$util.Tips({
|
||||
title: "购买最多不能超过" + item.limit_num
|
||||
});
|
||||
} else {
|
||||
this.ChangeCartNumDan(true, index, item);
|
||||
}
|
||||
},
|
||||
// 商品详情接口;
|
||||
getAttrs(id) {
|
||||
let that = this;
|
||||
let data ='';
|
||||
if(this.is_channel){
|
||||
data = {is_channel: 1,uid: that.userId};
|
||||
}
|
||||
getAttr(id, 0, data).then(res => {
|
||||
// uni.hideLoading();
|
||||
that.$set(that.attr, 'productAttr', res.data.productAttr);
|
||||
that.$set(that, 'productValue', res.data.productValue);
|
||||
that.$set(that, 'is_vip', res.data.storeInfo.is_vip);
|
||||
that.$set(that, 'storeInfo', res.data.storeInfo);
|
||||
that.skuArr = [];
|
||||
for (let key in res.data.productValue) {
|
||||
let obj = res.data.productValue[key];
|
||||
that.skuArr.push(obj)
|
||||
}
|
||||
if (!that.skuArr.length) {
|
||||
that.skuArr = [{
|
||||
image: this.storeInfo.image,
|
||||
suk: this.storeInfo.store_name,
|
||||
price: this.storeInfo.price
|
||||
}];
|
||||
}
|
||||
this.$set(this, "selectSku", that.skuArr[0]);
|
||||
that.DefaultSelect();
|
||||
})
|
||||
},
|
||||
//点击sku图片打开轮播图
|
||||
showImg(index) {
|
||||
this.$refs.cusPreviewImg.open(this.selectSku.suk)
|
||||
},
|
||||
//滑动轮播图选择商品
|
||||
changeSwitch(e) {
|
||||
let productSelect = this.skuArr[e];
|
||||
this.$set(this, 'selectSku', productSelect);
|
||||
var skuList = productSelect.suk.split(',');
|
||||
skuList.forEach((i, index) => {
|
||||
this.$set(this.attr.productAttr[index], 'index', skuList[index]);
|
||||
})
|
||||
if (productSelect) {
|
||||
this.$set(this.attr.productSelect, 'image', productSelect.image);
|
||||
this.$set(this.attr.productSelect, 'price', productSelect.price);
|
||||
this.$set(this.attr.productSelect, 'stock', productSelect.stock);
|
||||
this.$set(this.attr.productSelect, 'unique', productSelect.unique);
|
||||
this.$set(this.attr.productSelect, 'cart_num', 1);
|
||||
this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
|
||||
this.$set(this, 'attrValue', productSelect.suk);
|
||||
this.$set(this, 'attrTxt', '已选择');
|
||||
}
|
||||
},
|
||||
// 去详情页
|
||||
goDetail(item) {
|
||||
// 判断单双规格
|
||||
if(item.spec_type){
|
||||
this.goCartDuo(item);
|
||||
}else{
|
||||
this.goCartDan(item);
|
||||
}
|
||||
},
|
||||
goBack(){
|
||||
uni.navigateBack()
|
||||
},
|
||||
closeCateDrawer() {
|
||||
this.showCateDrawer = false;
|
||||
},
|
||||
openCateDrawer(type) {
|
||||
this.topNavShow = type;
|
||||
this.showCateDrawer = true;
|
||||
},
|
||||
lower(e) {
|
||||
this.productslist();
|
||||
},
|
||||
scroll(e) {
|
||||
uni.$emit('scroll');
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scroll_box {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.aside_active {
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: $primary-admin;
|
||||
font-weight: 500;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
width: 6rpx;
|
||||
height: 48rpx;
|
||||
background-color: $primary-admin;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.cate_active {
|
||||
color: $primary-admin;
|
||||
background: $light-primary-admin;
|
||||
border: 1rpx solid $primary-admin;
|
||||
}
|
||||
|
||||
.text-primary-con {
|
||||
color: $primary-admin;
|
||||
}
|
||||
.bg-primary{
|
||||
background: $primary-admin;
|
||||
}
|
||||
|
||||
.bg-primary-light {
|
||||
background: $light-primary-admin;
|
||||
}
|
||||
.cart-icon{
|
||||
margin-left: -4rpx;
|
||||
top: -20rpx;
|
||||
}
|
||||
|
||||
.con_border {
|
||||
border: 1px solid $primary-admin;
|
||||
}
|
||||
|
||||
.border_e {
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
.active_pic {
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
background-color: #fff;
|
||||
padding: 3rpx;
|
||||
border-radius: 50%;
|
||||
border: 3rpx solid $primary-admin;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.scroll_pic {
|
||||
image {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.active_cate_text {
|
||||
background: $primary-admin;
|
||||
color: #fff;
|
||||
border-radius: 20rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
.badge-style {
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: -20rpx;
|
||||
/deep/ .uni-badge--error {
|
||||
background-color: $primary-admin !important;
|
||||
}
|
||||
.uni-badge {
|
||||
color: $primary-admin;
|
||||
border: 1px solid $primary-admin;
|
||||
z-index: 29;
|
||||
}
|
||||
}
|
||||
.white-box{
|
||||
height: calc(300rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
</style>
|
||||
1379
pro_v3.5.1/view/uniapp_v2/pages/behalf/order_confirm/index.vue
Normal file
1379
pro_v3.5.1/view/uniapp_v2/pages/behalf/order_confirm/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
146
pro_v3.5.1/view/uniapp_v2/pages/behalf/record/index.vue
Normal file
146
pro_v3.5.1/view/uniapp_v2/pages/behalf/record/index.vue
Normal file
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="px-20">
|
||||
<view class="w-full h-72 rd-36rpx bg--w111-fff flex-y-center mt-10 mb-32 px-32">
|
||||
<text class="iconfont icon-ic_search text--w111-999"></text>
|
||||
<input v-model="params.keyword" class="pl-18 flex-1 line1 fs-28" placeholder="请输入要查询的订单"
|
||||
placeholder-class="text--w111-999" @confirm="searchSubmit" />
|
||||
</view>
|
||||
<view class="order_card bg--w111-fff rd-24rpx pt-32 pb-32 pl-24 pr-24"
|
||||
v-for="(item, index) in orderList" :key="index" @click="goOrderDetails(item.order_id)">
|
||||
<view class="flex-between-center">
|
||||
<view class="flex-y-center">
|
||||
<text class="fs-28 lh-40rpx text--w111-333 pl-16">订单号:{{item.order_id}}</text>
|
||||
</view>
|
||||
<view class="fs-26">
|
||||
<view class="text-num">
|
||||
<text class="text--w111-999" v-if="item.status == 3">已完成</text>
|
||||
<text v-else>{{item._status._title}}</text>
|
||||
<text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mt-26" v-if="item.cartInfo.length && item.cartInfo.length == 1">
|
||||
<view class="flex justify-between" v-for="(items, i) in item.cartInfo" :key="i">
|
||||
<view class="flex">
|
||||
<easy-loadimage
|
||||
:image-src="items.productInfo.image"
|
||||
width="136rpx"
|
||||
height="136rpx"
|
||||
borderRadius="16rpx"></easy-loadimage>
|
||||
<view class="ml-20">
|
||||
<view class="w-346 fs-28 text--w111-333 lh-40rpx line2"> {{items.productInfo.store_name }}
|
||||
</view>
|
||||
<view class="w-346 fs-24 text--w111-999 lh-34rpx line1 mt-12">{{items.productInfo.attrInfo.suk}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<baseMoney v-if="items.productInfo.attrInfo" :money="items.productInfo.attrInfo.price"
|
||||
symbolSize="20" integerSize="32" decimalSize="20" color="#333333" weight></baseMoney>
|
||||
<baseMoney v-else :money="items.productInfo.price" symbolSize="20" integerSize="32"
|
||||
decimalSize="20" incolor="#333333" weight></baseMoney>
|
||||
<view class="fs-24 text--w111-999 lh-34rpx text-right">共{{item.total_num}}件</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mt-26 relative" v-if="item.cartInfo.length && item.cartInfo.length > 1">
|
||||
<scroll-view scroll-x="true" class="white-nowrap vertical-middle w-560" show-scrollbar="false">
|
||||
<view class="inline-block mr-16" v-for="(items,i) in item.cartInfo" :key="i">
|
||||
<easy-loadimage
|
||||
:image-src="items.productInfo.image"
|
||||
width="136rpx"
|
||||
height="136rpx"
|
||||
borderRadius="16rpx"></easy-loadimage>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="abs-rt h-136 flex-col flex-center items-end">
|
||||
<baseMoney :money="item.pay_price" symbolSize="20" integerSize="32" decimalSize="20"
|
||||
color="#333333" weight></baseMoney>
|
||||
<view class="fs-24 text--w111-999 lh-34rpx text-right">共{{item.total_num}}件</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="orderList.length == 0">
|
||||
<emptyPage title="暂无订单信息~" src="/statics/images/empty-box.png"></emptyPage>
|
||||
</block>
|
||||
</view>
|
||||
<home></home>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { adminOrderRecordList } from "@/api/admin.js";
|
||||
import emptyPage from '@/components/emptyPage.vue';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
params:{
|
||||
page:1,
|
||||
limit:10,
|
||||
keyword:'',
|
||||
},
|
||||
orderList:[],
|
||||
status: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
emptyPage,
|
||||
},
|
||||
onLoad() {
|
||||
this.getList();
|
||||
},
|
||||
onPageScroll(object) {
|
||||
uni.$emit('scroll');
|
||||
},
|
||||
methods: {
|
||||
goOrderDetails(id){
|
||||
uni.navigateTo({
|
||||
url:'/pages/admin/orderDetail/index?id=' + id
|
||||
})
|
||||
},
|
||||
searchSubmit(){
|
||||
this.params.page = 1;
|
||||
this.status = false;
|
||||
this.orderList = [];
|
||||
this.getList();
|
||||
},
|
||||
getList(){
|
||||
let that = this;
|
||||
if (that.status) return;
|
||||
adminOrderRecordList(this.params).then(res => {
|
||||
let len = res.data.length;
|
||||
this.orderList = this.orderList.concat(res.data)
|
||||
that.params.page++;
|
||||
that.status = this.params.limit > len;
|
||||
that.params.page = that.params.page;
|
||||
}).catch(err=>{
|
||||
return this.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
},
|
||||
onReachBottom(e) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.border_con {
|
||||
border: 1px solid $primary-admin;
|
||||
}
|
||||
.text-num{
|
||||
color: #FF7E00;
|
||||
}
|
||||
.abs-rt {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
.order_card ~ .order_card{
|
||||
margin-top:20rpx;
|
||||
|
||||
}
|
||||
</style>
|
||||
242
pro_v3.5.1/view/uniapp_v2/pages/behalf/user_list/index.vue
Normal file
242
pro_v3.5.1/view/uniapp_v2/pages/behalf/user_list/index.vue
Normal file
@@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<view class="px-20">
|
||||
<NavBar
|
||||
custom=""
|
||||
textSize="34rpx"
|
||||
iconColor="#333333"
|
||||
textColor="#333333"
|
||||
:isScrolling="pageScrollStatus"
|
||||
showBack>
|
||||
<view class="flex-center fs-34 nav-tab fw-400">
|
||||
<text :class="{'text--w111-333 fw-500': tabActive == 0}" @tap="checkTab(0)">普通用户</text>
|
||||
<text class="pl-44" :class="{'text--w111-333 fw-500': tabActive == 1}" @tap="checkTab(1)">采购商</text>
|
||||
</view>
|
||||
</NavBar>
|
||||
<view class="flex-between-center mt-10">
|
||||
<view class="flex-1 h-72 rd-40rpx bg--w111-fff px-32 flex-y-center relative">
|
||||
<text class="iconfont icon-ic_search fs-28"></text>
|
||||
<input v-model="params.keyword" class="pl-18 flex-1 line1 fs-28"
|
||||
placeholder="请输入采购商名称/手机号/ID"
|
||||
placeholder-class="text--w111-999" @confirm="searchSubmit" v-if="tabActive" />
|
||||
<input v-model="params.nickname" class="pl-18 flex-1 line1 fs-28"
|
||||
placeholder="请输入用户昵称/手机号/用户ID"
|
||||
placeholder-class="text--w111-999" @confirm="searchSubmit" v-else />
|
||||
<text class="iconfont icon-ic_close1 fs-28 text--w111-999 z-10" v-if="params.nickname" @tap="clearWord"></text>
|
||||
</view>
|
||||
<view class="w-72 h-72 rd-50-p111- bg--w111-fff flex-center ml-20" @tap="goPage('/pages/behalf/record/index')">
|
||||
<text class="iconfont icon-ic_order text--w111-666"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="add-box w-full h-176 rd-24rpx mt-32 flex-col flex-center text-primary"
|
||||
@tap="goPage('/pages/behalf/goods_list/index?uid=0')" v-show="!tabActive">
|
||||
<text class="iconfont icon-ic_picture fs-44"></text>
|
||||
<text class="fs-24 lh-34rpx pt-12">未注册用户点此下单</text>
|
||||
</view>
|
||||
<view v-if="userList.length && tabActive == 0">
|
||||
<view class="w-full h-176 rd-24rpx item flex-between-center bg--w111-fff mt-20"
|
||||
v-for="(item,index) in userList" :key="index">
|
||||
<view class="flex-y-center">
|
||||
<easy-loadimage
|
||||
:image-src="item.avatar"
|
||||
width="96rpx"
|
||||
height="96rpx"
|
||||
borderRadius="50%"></easy-loadimage>
|
||||
<view class="w-400 ml-24">
|
||||
<view class="fs-28 fw-500 flex-y-center">
|
||||
<text>{{item.nickname}}</text>
|
||||
<view class="svip flex-center" v-if="item.isMember == 1">SVIP</view>
|
||||
<view class="vip flex-center" v-if="item.level_status == 1 && item.level_grade">
|
||||
<text class="iconfont icon-huiyuandengji"></text>
|
||||
V{{item.level_grade}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="fs-24 text--w111-999 lh-34rpx pt-4">{{item.phone}}</view>
|
||||
<view class="flex-y-center fs-24 lh-34rpx">
|
||||
<view class="flex-y-center">
|
||||
<text class="text--w111-999 pr-10">积分:</text>
|
||||
<text>{{item.integral}}</text>
|
||||
</view>
|
||||
<view class="flex-y-center pl-30">
|
||||
<text class="text--w111-999 pr-10">余额:</text>
|
||||
<text>{{item.now_money}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-144 h-56 rd-28rpx flex-center fs-24 text--w111-fff bg-primary" @tap="goPage('/pages/behalf/goods_list/index?uid=' + item.uid)">下单</view>
|
||||
</view>
|
||||
<view class="flex-center fs-26 text--w111-999 pt-24" v-if="userList.length > 0">{{loadTit}}...</view>
|
||||
</view>
|
||||
<view v-else-if="userList.length && tabActive == 1">
|
||||
<view class="w-full h-176 rd-24rpx item flex-between-center bg--w111-fff mt-20"
|
||||
v-for="(item,index) in userList" :key="index">
|
||||
<view class="flex-y-center">
|
||||
<easy-loadimage
|
||||
:image-src="item.user_avatar"
|
||||
width="96rpx"
|
||||
height="96rpx"
|
||||
borderRadius="50%"></easy-loadimage>
|
||||
<view class="w-400 ml-24">
|
||||
<view class="fs-28 fw-500 flex-y-center">
|
||||
<text class="pr-12">{{item.channel_name}}</text>
|
||||
<view class="channel-tag flex-center flex-center fs-18">采购商身份</view>
|
||||
</view>
|
||||
<view class="fs-24 text--w111-999 lh-34rpx pt-4">{{item.phone}} (ID:{{item.id}})</view>
|
||||
<view class="fs-24 text--w111-999 lh-34rpx">
|
||||
渠道折扣:<text class="text--w111-333">{{item.identity_discount / 10}}折</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-144 h-56 rd-28rpx flex-center fs-24 text--w111-fff bg-primary" @tap="goPage('/pages/behalf/goods_list/index?uid=' + item.uid + '&is_channel=1')">下单</view>
|
||||
</view>
|
||||
<view class="flex-center fs-26 text--w111-999 pt-24" v-if="userList.length > 0">{{loadTit}}...</view>
|
||||
</view>
|
||||
<view v-else class="mt-20">
|
||||
<emptyPage title="暂无用户信息~" src="/statics/images/empty-box.png"></emptyPage>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { adminUserList, adminChannelListApi } from "@/api/admin.js";
|
||||
import emptyPage from '@/components/emptyPage.vue';
|
||||
import NavBar from "@/components/NavBar.vue"
|
||||
export default {
|
||||
name:'userList',
|
||||
data(){
|
||||
return {
|
||||
params:{
|
||||
page:1,
|
||||
limit:10,
|
||||
nickname:'',
|
||||
keyword: ''
|
||||
},
|
||||
userList:[],
|
||||
status: false,
|
||||
loadTit:'正在加载',
|
||||
pageScrollStatus:false,
|
||||
tabActive: 0
|
||||
}
|
||||
},
|
||||
components: {
|
||||
emptyPage,
|
||||
NavBar
|
||||
},
|
||||
onLoad() {
|
||||
this.getList();
|
||||
},
|
||||
onPageScroll(object) {
|
||||
if (object.scrollTop > 30) {
|
||||
this.pageScrollStatus = true;
|
||||
} else if (object.scrollTop < 30) {
|
||||
this.pageScrollStatus = false;
|
||||
}
|
||||
uni.$emit('scroll');
|
||||
},
|
||||
methods:{
|
||||
checkTab(val){
|
||||
this.tabActive = val;
|
||||
this.userList = [];
|
||||
this.status = false;
|
||||
this.params.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
getList(){
|
||||
let that = this;
|
||||
if (that.status) return;
|
||||
that.loadTit = '加载更多';
|
||||
let funApi = this.tabActive ? adminChannelListApi : adminUserList;
|
||||
funApi(this.params).then(res => {
|
||||
let len = res.data.list.length;
|
||||
this.userList = this.userList.concat(res.data.list)
|
||||
that.params.page++;
|
||||
that.status = this.params.limit > len;
|
||||
that.params.page = that.params.page;
|
||||
that.loadTit = that.status ? '没有更多内容啦~' : '加载更多';
|
||||
}).catch(err=>{
|
||||
that.loadTit = '加载更多';
|
||||
return this.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
})
|
||||
},
|
||||
searchSubmit(){
|
||||
this.params.page = 1;
|
||||
this.status = false;
|
||||
this.userList = [];
|
||||
this.getList();
|
||||
},
|
||||
clearWord(){
|
||||
this.params.nickname = ''
|
||||
},
|
||||
goPage(url){
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
},
|
||||
onReachBottom(e) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.text-primary{
|
||||
color: $primary-admin;
|
||||
}
|
||||
.bg-primary{
|
||||
background: $primary-admin;
|
||||
}
|
||||
.add-box{
|
||||
border: 2rpx dashed $primary-admin;
|
||||
background: $light-primary-admin;
|
||||
color: $primary-admin;
|
||||
}
|
||||
.add-icon{
|
||||
border: 2rpx solid $primary-admin;
|
||||
}
|
||||
.item{
|
||||
padding: 30rpx 24rpx;
|
||||
}
|
||||
.icon-ic_close1{
|
||||
position: absolute;
|
||||
right: 34rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
.nav-tab{
|
||||
color: #606266;
|
||||
}
|
||||
.svip {
|
||||
width: 56rpx;
|
||||
height: 26rpx;
|
||||
background: linear-gradient(270deg, #484643 0%, #1F1B17 100%);
|
||||
border-radius: 100rpx;
|
||||
font-size: 18rpx;
|
||||
font-weight: 600;
|
||||
color: #FDDAA4;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.vip{
|
||||
width: 64rpx;
|
||||
height: 26rpx;
|
||||
background: #FEF0D9;
|
||||
border: 1px solid #FACC7D;
|
||||
border-radius: 50rpx;
|
||||
font-size: 18rpx;
|
||||
font-weight: 500;
|
||||
color: #DFA541;
|
||||
margin-left: 10rpx;
|
||||
.iconfont {
|
||||
font-size: 20rpx;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
}
|
||||
.channel-tag{
|
||||
width: 110rpx;
|
||||
height: 28rpx;
|
||||
background: #FEF0D9;
|
||||
border-radius: 20rpx;
|
||||
border: 1rpx solid #FACC7D;
|
||||
color: #DFA541;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user