You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1431 lines
55 KiB

<template>
<view
style="display: flex;flex-direction: column;height: 100vh;background: -webkit-linear-gradient(left,#FEA65F,#FB9440);">
<view class="top" style="position: fixed;">
<swiper class="swiper" ref="swiper" :indicator-dots="true" :autoplay="true" :interval="3000"
:duration="1200" :circular='true'>
<swiper-item v-for="(item,index) in imgList" style="" @click="swiperClick(item)">
<image :src="item.bannerUrl" style="width: 100vw;height: 50vw; " mode="scaleToFill">
</image>
</swiper-item>
</swiper>
</view>
<loading-state ref="pageView" @request="request">
<!-- 总高度 - 底部导航栏高度 60px -->
<view style="height: calc(100vh - 60px);box-sizing: border-box;display: flex;flex-direction: column;">
<!-- 压住图片15px -->
<view style="height: calc(50vw - 15px);width: 100%;"></view>
<view
style="background: #fff; width: 100%; border-radius: 15px;display: flex;flex-direction: column; box-sizing: border-box;flex: 1;z-index: 1;">
<view class="center" style="">
<view style="width: 24%; display: flex;flex-direction: column;
position: relative;">
<view style="width: 100%;display: flex;flex-direction: column;margin-top: 20px;
height: 100%; overflow: hidden; overflow-y: auto;">
<view v-for="(item,index) in data.typeVos" @click="labelClick(index,item)"
style="display: flex;flex-direction: column;justify-content: center;">
<text class="label" :class="{'label2':selectIndex==index}">{{item.name}}</text>
</view>
</view>
<!-- <view v-if="isPurchase == '1'&&newPerGiftList.length>0" @click="newUserGift()" style="display: flex;flex-direction: column;justify-content: center;align-items: center;width: 100%;
position: absolute; bottom: 0; margin-bottom: 10px;">
<image src="../../static/newUserGift.png" style="width: 40px;height: 40px;"></image>
<text style="font-size: 12px;margin-top: 5px;color: #666;">新人专享</text>
</view> -->
</view>
<view style="width: 77%;background-color: #fff;overflow-y: auto;">
<view style="z-index: 1;background: #FFFFFF;position: sticky;top: 0;padding: 10px; ">
<view style="display: flex;flex-direction: row;overflow-x: auto;">
<view v-for="(item,index2) in data.brandVos"
style="display: flex;flex-direction: column; justify-content: center;align-items: center;margin-right: 10px; flex: 1;"
@click.stop="brandClick(index2)">
<image src="https://supervise.yxtsoft.com/lpk/image/family_icon.png"
mode="aspectFill" :class="selectIndex2 == index2?'top_img1':'top_img2'"
style="width: 55px;height:55px;border-radius: 50%;padding:5px;"></image>
<text
:class="selectIndex2 == index2?'top_text1':'top_text2'">{{item.brandName}}</text>
</view>
</view>
</view>
<view style="width: 100%; display: flex;flex-direction: column;overflow-y: auto;">
<view v-for="(item,index) in goods"
style="display: flex;flex-direction: column;justify-content: center;width: 95%; margin-top: 15px; margin-left: 3%;">
<view style="display: flex;flex-direction: row;align-items: center;width: 100%; ">
<image :src="item.iconUrl" @click="itemClick(item.goodsSid)"
style="width: 90px;height: 90px; border-radius: 10px; " mode="aspectFill">
</image>
<view
style="display: flex;flex-direction: column;flex: 1; padding-bottom: 15px; margin-left: 10px;"
:style="{'border-bottom':(index == goods.length-1 ? 'none' : '1px #EFEFEF solid')}">
<text style="font-size: 13px;color: #000;"
@click="itemClick(item.goodsSid)">{{item.name}}</text>
<!--
<text
style="font-size: 10px;color: #999;margin-top: 5px;">{{item.remark}}</text> -->
<view
style="display: flex;flex-direction: row;align-items: center;margin-top: 8px;">
<text style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
font-size: 10px;color: #EE752F;">{{item.weight}}{{item.specificationUnit}}/{{item.unitName}}</text>
<text style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
font-size: 10px;color: #EE752F; margin-left: 10px; margin-right: 10px; ">{{item.remarks}}</text>
</view>
<!-- sss -->
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between; margin-top: 15px;
margin-right: 15px;">
<text style="font-size: 14px;color: #FF5006;">¥{{item.jprice}}元</text>
<view style="display: flex;flex-direction: row;align-items: center;">
<image src="../../static/jian_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jian(item)">
</image>
<text
style="font-size: 14px;padding:5px; margin-left: 8px;margin-right: 8px;"
@click.stop="numberClick(item)">{{item.goodsNumber}}</text>
<image src="../../static/jia_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jia(item)">
</image>
</view>
</view>
</view>
</view>
</view>
<view v-if="notData"
style="display: flex;flex-direction: column;justify-content: center;align-items: center;margin-top: 5vw;">
<image src="https://supervise.yxtsoft.com/lpk/image/supplementing.png"
mode="aspectFill" style="width: 40vw;height: 40vw; "></image>
<view
style="display: flex;flex-direction: row;align-items: center;margin-top: -15px;">
<text style="font-size: 16px; color: #999;">商品还在补充中~</text>
</view>
</view>
<view v-if="notAuthentication"
style="display: flex;flex-direction: column;justify-content: center;align-items: center;margin-top: 5vw;">
<image src="../../static/authentication_icon.png" mode="scaleToFill"
style="width: 80px;height: 80px; "></image>
<view style="display: flex;flex-direction: column;align-items: center; justify-content: center;margin: 20px 30px;
">
<text
style="text-indent: 2em; font-size: 16px; color: #999;">您好,【企业菜窖】需要通过认证才能进行购买</text>
<text style="font-size: 14px;color: #fff;padding: 10px 40px; border-radius: 20px;
background: #FF9901;margin-top: 20px;" @click="authentication()">立即认证</text>
</view>
</view>
</view>
</view>
</view>
<view class="bottom" style="margin-top: 10px;">
<view style="display: flex;flex-direction: row;align-items: center;margin-left: 20px; ">
<view style=" display: flex;flex-direction: row;align-items: center; border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 0px 5px;height: 42px;flex: 1;
display: flex;flex-direction: row;align-items: center;box-sizing: border-box;">
<view
style="color: #888;font-size: 12px;margin-top: 5px;margin-left: 20px;margin-right: 2px;">
您已订购</view>
<view style="color: #FF5006;font-size: 15px;font-weight: bold; ">
{{initWeight}}
</view>
<view style="color: #888;font-size: 12px;margin-top: 5px; margin-left: 2px;">
件商品</view>
<view
style=" display: flex;flex-direction: row;align-items: center;flex: 1; padding-right: 20px;">
<view style="flex: 1;"></view>
<text style="font-size: 12px;color: #888;margin-top: 5px;">共计:</text>
<text style="color: #FF5006;font-size: 12px;margin-top: 5px;">¥</text>
<text style="font-size: 15px;color: #FF5006;height: 20px;
line-height: 20px;font-weight: bold">{{page.price}}</text>
</view>
</view>
<text
style="background: #FF9900; color: #fff;font-size: 13px; padding: 0px 15px;height: 40px;line-height: 40px;
border: 1px #FF5006 solid; border-top-right-radius: 25px; border-bottom-right-radius: 25px;flex-shrink: 0;margin-right: 20px;"
@click="settlement()">去结算</text>
</view>
<!-- <view style="display: flex;flex-direction: row;align-items: center; justify-content: center;">
<view id="bomView" style="display: flex;flex-direction: row;align-items: center;">
<view
style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
温馨提示:已订</view>
<view
style="color: #FF5006;font-size: 15px;height: 15px;line-height: 15px;font-weight: bold;">
{{initWeight}}件
</view>
<view
style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
,{{data.brandVos[selectIndex2].qssl}}斤起订。</view>
<view style="display: flex;flex-direction: row;align-items: center;"
@click="showPop2()">
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;text-decoration:underline;font-style:oblique;">
起订说明</text>
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;margin-left: 2px;">
>></text>
</view>
</view>
</view> -->
<!-- <view
style="display: flex;flex-direction: row; justify-content: center;align-items: center;margin-top: 5px;padding: 0px 10px;">
<button open-type="share">分享新人有礼</button>
<view style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 0px 5px;height: 42px;flex: 1;
display: flex;flex-direction: row;align-items: center;box-sizing: border-box;" @click="gotoCart()">
<image src="../../static/shoppCart_icon.png" mode="aspectFill"
style="height: 20px;width: 20px;flex-shrink: 0;">
</image>
<view style="display: flex;flex-direction: column;flex: 1;">
<text
style="font-size: 15px;color: #FF5006;margin-left: 5px;height: 20px;line-height: 20px;margin-top: 5px;font-weight: bold;">¥{{page.price}}</text>
<text v-if="page.remarks!=''"
style="font-size: 10px;color: #666;margin-left: 5px; height: 10px;line-height: 10px;margin-bottom: 5px;">{{page.remarks}}</text>
</view>
</view>
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 0px 15px;height: 40px;line-height: 40px;
border: 1px #FF5006 solid; border-top-right-radius: 25px; border-bottom-right-radius: 25px;flex-shrink: 0;"
@click="settlement()">结算</text>
</view> -->
</view>
</view>
</view>
</loading-state>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="more" title="订购协议" :showConfirm="true"
:beforeClose="dialogBeforeClose" @confirm="dialogInputConfirm"
:content="data.brandVos[selectIndex2].dgxy" :confirm-text="confirmText"></uni-popup-dialog>
</uni-popup>
<uni-popup ref="inputDialog2" type="dialog">
<uni-popup-dialog ref="inputClose" mode="more" title="起订说明" :showConfirm="true"
:beforeClose="dialogBeforeClose2" @confirm="dialogInputConfirm2"
:content="data.brandVos[selectIndex2].qdxy"></uni-popup-dialog>
</uni-popup>
<!-- 弹窗蒙版 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal'></view>
<view class="modalDlg" catchtouchmove='preventTouchMove' v-if='showModal'>
<view style="display: flex;flex-direction: column;justify-content: center;align-items: center;">
<image src="https://supervise.yxtsoft.com/lpk/image/newpor_gift.png" mode="aspectFill"
style="margin-left: 5vw;margin-right: 5vw;margin-top: -50px;"></image>
<image src="https://supervise.yxtsoft.com/lpk/image/newpor_btn.png" mode="aspectFill"
style="width: 180px;height: 50px;margin-top: 20px;" @click="showGift()"></image>
<image src="../../static/close.png" mode="aspectFill" style="width: 28px;height: 28px;margin-top: 10px;"
@click="colseDialog()"></image>
</view>
</view>
<!-- 礼包列表弹框 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal2'></view>
<view class="modalDlg2" catchtouchmove='preventTouchMove' v-if='showModal2'>
<view style="display: flex;flex-direction: column;
background: #fff; width: 80%; border-radius: 20px; height: 80vw;">
<image src="https://supervise.yxtsoft.com/lpk/image/newpor_top.png" mode="scaleToFill"
style="width: 100%; height: 15vw; flex-shrink: 0;"></image>
<scroll-view scroll-y="true" style="display: flex;flex-direction: column;height: calc(100% - 30vw);"
bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
<radio-group @change="radioChange" style="overflow: hidden;box-sizing: border-box;">
<view v-for="(item,index) in newPerGiftList" class="device-list" style="overflow-y: auto;">
<view style="">
<radio :value="item.sid" style="transform:scale(0.8)" color="#FF9900" />
</view>
<view
style="margin-left: 5px; margin-right: 10px; display: flex;flex-direction: row;align-items: center;flex: 1; ">
<image :src="item.iconUrl" mode="aspectFill"
style="border-radius: 8px;width: 46px;height: 46px;"></image>
<view style="display: flex;flex-direction: column; margin-left: 10px; flex: 1;">
<view
style="display: flex;flex-direction: row;align-items: center;box-sizing: border-box;">
<text style="font-size: 14px;color: #101010;margin-right: 10px;
flex: 1; ">{{item.name}}</text>
<text
style="font-size: 16px;color: #FF5006;font-weight: 600; flex-shrink:0;">¥{{item.prefPrice}}</text>
</view>
<view
style="display: flex;flex-direction: row;align-items: center;margin-top: 15px;">
<text style="font-size: 12px;color: #666;flex: 1;">{{item.weight}}斤</text>
<text
style="font-size: 12px;color: #999;text-decoration:line-through;margin-left: 10px;">¥{{item.price}}</text>
</view>
</view>
</view>
</view>
</radio-group>
</scroll-view>
<view
style=" height: 15vw; flex-shrink: 0;display: flex;flex-direction: row;align-items: center;justify-content: center;"
class="newpor_bom">
<text style="background: #FF9900;color: #fff;text-align: center;border-radius: 20px;
padding:8px 25px ;" @click="newporGift">确认结算</text>
</view>
</view>
<image src="../../static/close.png" mode="aspectFill" style="width: 28px;height: 28px;margin-top: 10px;"
@click="colseDialog2()"></image>
</view>
<!-- 输入数量 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal1' @click="colseDialog1()"></view>
<view class="modalDlg4" catchtouchmove='preventTouchMove' v-if='showModal1'>
<view
style="display: flex;flex-direction: column;background: #fff; width: 80%; border-radius: 20px;box-sizing: border-box;">
<input type="number" placeholder="请输入数量" v-model="goodsItem.goodsNumber"
style="margin: 20px;border: 1px #bbb solid; padding: 5px;line-height: 30px;height: 30px;border-radius: 6px;" />
<view
style="flex-shrink: 0;display: flex;flex-direction: row;align-items: center;justify-content: center;">
<button class="button1" @click="colseDialog1()">取消</button>
<button class="button2" @click="inCart()">确定</button>
</view>
</view>
</view>
<!-- 获取手机号弹框 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal4' @click="colseDialog4()"></view>
<view class="modalDlg4" catchtouchmove='preventTouchMove' v-if='showModal4'>
<view style="display: flex;flex-direction: column;background: #fff; width: 80%; border-radius: 20px;
">
<view
style="display: flex;flex-direction: column;align-items: center;justify-content: center;width: 100%;margin-top: 20px;">
<image src="../../static/logo_icon.png" style="width: 10vw;height: 10vw;" mode="scaleToFill">
</image>
<text
style="margin-top: 5px;color: #333;font-size: 18px;font-weight: 600;font-family: sans-serif;">云菜窖</text>
</view>
<view style="display: flex;margin-top: 10px;margin-left: 20px; margin-right: 20px;">
<text style="color: #999;text-indent:2em;">为确保您能正常体验小程序功能,云菜窖需要获取您的手机号。</text>
</view>
<view
style="flex-shrink: 0;display: flex;flex-direction: row;align-items: center;justify-content: center;margin-top: 20px;">
<button class="button1" @click="colseDialog4()">拒绝</button>
<button class="button2" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">同意</button>
</view>
</view>
</view>
<!-- 企业认证弹框 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal5'></view>
<view class="modalDlg2" catchtouchmove='preventTouchMove' v-if='showModal5'>
<view style="display: flex;flex-direction: column;justify-content: center;align-items: center;
width: 80%; border-radius: 20px; background: #fff;">
<image src="../../static/authentication_top.png"
style="width: 100%; height: 15vw;border-top-left-radius: 20px;border-top-right-radius: 20px; "
mode="scaleToFill"></image>
<image src="../../static/authentication_icon.png" style="width: 80px;height: 80px;margin-top: -40px;"
mode="scaleToFill"></image>
<text style="font-size: 18px;color: #FF9900;margin-top: 16px;">温馨提示</text>
<text
style="margin-top: 16px;font-size: 14px;color: #333;padding-left: 30px;padding-right: 30px;">您好,【企业菜窖】需要通过认证才能进行购买</text>
<view
style="display: flex;flex-direction: row;align-items: center;margin-top: 37px;margin-bottom: 34px;">
<text style="color: #FF9900;font-size: 14px;border: 1px #FF9900 solid;height: 35px;line-height: 35px;border-radius: 22px;
width: 25vw;text-align: center; margin-right: 20px;" @click="colseDialog5()">取消</text>
<text style="color: #fff;font-size: 14px;background: #FF9900; height: 35px;line-height: 35px;border-radius: 22px;
width: 25vw;text-align: center;margin-left: 20px;" @click="authentication()">立即认证</text>
</view>
</view>
</view>
<!-- 企业认证审核弹框 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal6'></view>
<view class="modalDlg2" catchtouchmove='preventTouchMove' v-if='showModal6'>
<view style="display: flex;flex-direction: column;width: 80%; border-radius: 20px; background: #fff;">
<view v-if="authenticationType=='203'" style="display: flex;flex-direction: row;align-items: center;
padding: 12px 16px;">
<view style="flex: 1;"></view>
<image src="../../static/close2.png" style="width:25px; height: 25px;" mode="scaleToFill"
@click="colseDialog6()"></image>
</view>
<view v-if="authenticationType=='202'"
style="display: flex;flex-direction: column;width: 100%;justify-content: center;align-items: center;margin-top: 20px;">
<image src="../../static/inReview.png" style="width: 80px;height: 80px;" mode="scaleToFill"></image>
<text
style="font-size: 18px;color: #333333;margin-top: 12px;font-weight: 600;font-family: sans-serif;">审核中</text>
<text
style="text-indent: 2em; margin-top: 16px;font-size: 16px;color: #666;padding-left: 30px;padding-right: 30px;">提交成功!您的认证信息正在审核中,请耐心等待</text>
<text style="color: #fff;font-size: 14px;background: #FF9900; height: 40px;line-height: 40px;border-radius: 22px;
width: 40vw;text-align: center; margin-bottom: 32px;margin-top: 32px;" @click="colseDialog6()">返回</text>
</view>
<view v-if="authenticationType=='203'"
style="display: flex;flex-direction: column;width: 100%;margin-top: -10px;">
<view
style="display: flex;flex-direction: column;width: 100%;justify-content: center;align-items: center;">
<image v-if="authenticationType=='203'" src="../../static/reject.png"
style="width: 80px;height: 80px;" mode="scaleToFill"></image>
<text
style="font-size: 18px;color: #333333;margin-top: 12px;font-weight: 600;font-family: sans-serif;">审核未通过</text>
</view>
<text
style="text-indent: 2em; margin-top: 16px;font-size: 16px;color: #666;padding-left: 30px;padding-right: 30px;">很遗憾!您的企业认证申请信息未通过</text>
<text v-if="authenticationRemarks!=''"
style="margin-top: 16px;font-size: 14px;color: #999;padding-left: 30px;padding-right: 30px;">理由:{{authenticationRemarks}}</text>
<view
style="display: flex;flex-direction: column;width: 100%;justify-content: center;align-items: center;">
<text style="color: #fff;font-size: 14px;background: #FF9900; height: 40px;line-height: 40px;border-radius: 22px;
width: 40vw;text-align: center; margin-bottom: 32px;margin-top: 32px;" @click="authentication()">修改信息</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
imgList: [],
notData: false,
notAuthentication: false,
showModal: false,
showModal1: false,
showModal4: false,
showModal5: false,
showModal6: false,
authenticationType: '',
authenticationRemarks: '',
goodsItem: {
goodsNumber: "",
},
showModal2: false,
newPerGiftList: [
],
dialogContent: "这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容这里是协议内容,这里是协议内容",
confirmText: "我知道了(5s)",
dialogBeforeClose: false,
dialogBeforeClose2: false,
countdown: 5,
searchInfo: {
sid: "0",
name: "",
affiliation: "",
customerSid: ""
},
styleObject: {
// 'position': 'fixed',
// 'top':'80vw',
'margin-top': '62vw',
'border-top-left-radius': '25px',
'border-top-right-radius': '25px',
'border-bottom-left-radius': '25px',
'border-bottom-right-radius': '25px',
'background': '#fff',
'padding-top': '10px',
'margin-bottom': "60px"
},
page: {
price: '0',
reduce: "0",
weight: "0",
count: "0",
remarks: "",
startHeight: 0,
endHeight: 0
},
data: [],
goods: [],
selectIndex: 0,
selectIndex2: 0,
initPrice: '0',
initReduce: "0",
initWeight: "0",
shareSid: "",
baseDataSuccess: false,
isPurchase: getApp().globalData.isPurchase, // 0 不显示 1显示
}
},
onShow() {
if (typeof this.$mp.page.getTabBar === 'function' && this.$mp.page.getTabBar()) {
this.$mp.page.getTabBar().setData({
selected: 0
})
}
// 状态对才获取
if (this.baseDataSuccess) {
this.getgoods()
}
console.log("isPurchase", getApp().globalData.isPurchase);
// if (getApp().globalData.isPurchase == '1'){
// this.showModal = true
// this.isPurchase = '1'
// }
if (getApp().globalData.mobile == '')
this.showModal4 = true
},
onLoad(options) {
this.shareSid = options.shareSid
console.log("shareSid>>>>", this.shareSid);
let info = uni.getSystemInfoSync();
this.page.startHeight = info.windowWidth * 0.6
this.page.endHeight = info.windowWidth * 0.8
this.request()
this.getGiftList()
this.getBannerList()
},
methods: {
newUserGift() {
this.showModal = true
// this.isPurchase = '1'
},
getGiftList() {
let _this = this
_this.$api.newUserQuota().then((resp) => {
// console.log("--------", resp);
_this.newPerGiftList = resp
if (_this.newPerGiftList.length > 0 && _this.isPurchase == "1") {
_this.showModal = true
// _this.isPurchase = getApp().globalData.isPurchase
}
// _this.showModal = false
// _this.showModal2 = true
}).catch(e => {
})
},
showGift() {
this.showModal = false
this.showModal2 = true
},
radioChange(event) {
// console.log("radioChange", event.detail.value);
this.newporGiftSid = event.detail.value
},
newporGift() {
// console.log("radioChange", this.newporGiftSid);
if (!this.newporGiftSid) {
this.shortToast('请先选择优惠礼包')
return
}
var params = {
customerSid: getApp().globalData.sid,
bagSid: this.newporGiftSid,
}
// console.log("params", params);
let _this = this
_this.$api.createNewUserBagOrder(params).then((resp) => {
// console.log("resp", resp);
_this.$pay(resp)
_this.showModal2 = false
getApp().globalData.isPurchase = '0'
_this.isPurchase = '0'
console.log("isPurchase", getApp().globalData.isPurchase);
}).catch(e => {})
},
colseDialog() {
this.showModal = false
},
colseDialog1() {
this.showModal1 = false
},
colseDialog2() {
this.showModal2 = false
},
colseDialog4() {
this.showModal4 = false
},
colseDialog5() {
this.showModal5 = false
},
colseDialog6() {
this.showModal6 = false
},
authentication() {
// 跳转认证页面
uni.navigateTo({
url: "/pages/me/authentication"
})
},
getBannerList() {
let _this = this
_this.$api.bannerList().then((resp) => {
_this.imgList = resp
console.log("======", resp);
}).catch(e => {})
},
swiperClick(item) {
console.log("swiperClick======", item);
if (item.contentUrl != '') {
uni.navigateTo({
url: "/pages/home/newUserPlay?url=" + encodeURIComponent(JSON.stringify(item
.contentUrl))
})
}
},
shareGift() {
if (this.shareSid && getApp().globalData.isNewUser) {
}
},
labelClick(index, item) {
this.selectIndex = index
this.searchInfo.sid = item.sid
this.getgoods()
},
onKeyInput(event) {
this.searchInfo.name = event.target.value
this.getgoods()
},
brandClick(val) {
this.selectIndex2 = val
this.getgoods()
},
request() {
if (this.baseDataSuccess) {
this.getgoods()
} else {
let _this = this
_this.$api.getGoodsTypeAndBrand().then((resp) => {
_this.data = resp
console.log("======", resp);
_this.baseDataSuccess = true
_this.getgoods()
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
}
},
getAllPriceOrWeight() {
let _this = this
var params = {
customerSid: getApp().globalData.sid,
brandId: this.data.brandVos[this.selectIndex2].id,
}
_this.$api.getGoodsWeight(params).then((resp) => {
console.log("getGoodsWeight", resp);
_this.page.price = resp.totalPrice
_this.page.weight = resp.totalWeight
_this.page.remarks = resp.remarks
_this.initPrice = resp.totalPrice
_this.initWeight = resp.totalWeight
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
getgoods() {
let _this = this
var params = {
customerSid: getApp().globalData.sid,
brandId: this.data.brandVos[this.selectIndex2].id
}
_this.$api.isEnterprise(params).then((resp) => {
console.log("isEnterprise>>", resp);
// 正常继续操作 不是企业菜窖类型或已经认证成功
_this.searchInfo.customerSid = getApp().globalData.sid
_this.searchInfo.brandId = _this.data.brandVos[_this.selectIndex2].id
_this.searchInfo.categoryId = _this.data.typeVos[_this.selectIndex].id
_this.$api.getGoodsByType(_this.searchInfo).then((resp) => {
_this.goods = resp
_this.notData = resp.length == 0
_this.notAuthentication = false
_this.getAllPriceOrWeight()
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
}).catch(e => {
console.log("isEnterprise>>", e);
_this.getAllPriceOrWeight()
_this.goods = []
// 错误需判断code 状态
this.authenticationType = e.code
if (e.code == '201') {
// 未认证
this.notAuthentication = true
} else if (e.code == '202' || e.code == '203') {
// 认证审核中 或 认证不通过
this.notAuthentication = false
this.showModal6 = true
this.authenticationRemarks = e.data.remarks
} else {
uni.showToast({
title: e.msg,
icon: 'none',
duration: 5000,
})
}
})
},
jian(item) {
const that = this
console.log("item》》》》", item)
// if (Number(item.goodsNumber) == 1) {
// wx.showModal({
// content: '确定不要了吗',
// cancelText: "再想想",
// confirmText: "删除",
// confirmColor: "#FF9900",
// success(res) {
// if (res.confirm) {
// console.log('用户点击确定')
// item.goodsNumber = 0
// item.subtotal = 0
// that.upDateShoppCart(item)
// } else if (res.cancel) {
// }
// }
// })
// } else {
if (Number(item.goodsNumber) > 0) {
item.goodsNumber = Number(item.goodsNumber) - 1
item.subtotal = Number(item.goodsNumber) * Number(item.jprice)
that.upDateShoppCart(item)
}
// }
},
jia(item) {
item.goodsNumber = Number(item.goodsNumber) + 1
item.subtotal = Number(item.goodsNumber) * Number(item.jprice)
this.upDateShoppCart(item)
},
numberClick(item) {
this.showModal1 = true
this.goodsItem = {
goodsSid: item.goodsSid,
goodsName: item.name,
goodsNumber: item.goodsNumber,
affiliation: this.data.brandVos[this.selectIndex2].id,
price: item.mefenPrice,
weight: item.weight,
customerSid: getApp().globalData.sid
}
},
inCart() {
let _this = this
// console.log("inCart",_this.goodsItem);
_this.$api.addShoppingCart(_this.goodsItem).then((resp) => {
_this.getgoods()
this.goodsItem = {}
this.showModal1 = false
}).catch(e => {
_this.getgoods()
this.goodsItem = {}
this.showModal1 = false
})
},
getallPrice() {
let num = 0;
for (var i = 0; i < this.goods.length; i++) {
num += Number(this.goods[i].subtotal);
}
this.page.price = num
},
getweight() {
let num = 0;
for (var i = 0; i < this.goods.length; i++) {
num += Number(this.goods[i].weight) * Number(this.goods[i].goodsNumber);
}
this.page.weight = num
},
upDateShoppCart(item) {
var good = {
goodsSid: item.goodsSid,
goodsName: item.name,
goodsNumber: item.goodsNumber,
affiliation: this.data.brandVos[this.selectIndex2].id,
price: item.jprice,
weight: item.weight,
customerSid: getApp().globalData.sid
}
let _this = this
_this.$api.addShoppingCart(good).then((resp) => {
_this.getgoods()
}).catch(e => {
_this.getgoods()
})
},
detail(item) {
// 详情
uni.navigateTo({
url: '/pages/cloud/detail_cloudCard?sid=' + item.sid + "&name=" + item.name
})
},
settlement() {
// 支付
// if (this.page.weight < parseInt(this.data.brandVos[this.selectIndex2].qssl)) {
// this.shortToast('满' + this.data.brandVos[this.selectIndex2].qssl + '斤才可定制云菜窖哦,请继续选菜吧。')
// return
// }
// this.showPop()
this.saveGoods()
},
showPop() {
this.$refs.inputDialog.open()
let timeOut = setInterval(() => {
if (this.countdown == 1) {
this.confirmText = "确定"
this.countdown = 5
this.dialogBeforeClose = false
clearInterval(timeOut)
} else {
this.dialogBeforeClose = true
this.countdown = this.countdown - 1;
this.confirmText = "我知道了" + "(" + this.countdown + "s)"
}
}, 1000)
},
dialogInputConfirm(val) {
if (this.confirmText == "确定") {
this.confirmText = "我知道了(5s)",
this.dialogBeforeClose = true,
this.countdown = 5
this.saveGoods()
}
},
dialogInputConfirm2(val) {
console.log(">>>>>>>>>>>", this.dialogBeforeClose2);
this.dialogBeforeClose2 = false
},
saveGoods() {
// var params = {
// customerSid: getApp().globalData.sid,
// brandId: this.data.brandVos[this.selectIndex2].id
// }
// // console.log("params", params);
// let _this = this
// _this.$api.saveGoods(params).then((resp) => {
// _this.request()
// }).catch(e => {})
var params = {
customerSid: getApp().globalData.sid,
// cardNumber: 1,
brandId: this.data.brandVos[this.selectIndex2].id,
totalTee: this.page.price,
// ordOrderDetailsVoList: list
}
console.log("params", params);
let _this = this
_this.$api.createVegeOrder(params).then((resp) => {
// console.log("resp", resp);
this.$pay(resp)
}).catch(e => {})
},
itemClick(goodsSid) {
uni.navigateTo({
url: '/pages/good/goodsDetail?sid=' + goodsSid
})
},
gotoCart() {
uni.navigateTo({
url: '/pages/good/shoppCart?affiliation=' + this.data.brandVos[this.selectIndex2].id +
"&weight=" + this.data.brandVos[this.selectIndex2].qssl + "&qdxy=" + this.data.brandVos[
this.selectIndex2].qdxy
})
},
showPop2() {
this.$refs.inputDialog2.open()
},
onShareAppMessage: function(res) {
// console.log("res", res)
// console.log("data", res.target.dataset)
// var data = res.target.dataset.info
// // ①
// let shareData = JSON.stringify({
// // params: {
// // code: data.code,
// // codeKey: data.codeKey,
// // customerSid: ''
// // },
// // functionName: 'bindCard',
// // url: '/pages/detail/detail_affeection?sid=' + data.sid
// url: '/pages/home/cloudCard2?shareSid=' + getApp().globalData.sid,
// functionName: 'share'
// })
// // 转码传输
// let value = encodeURIComponent(shareData)
// return {
// title: '汇融农链-云菜窖',
// // ②
// path: '/pages/login/login?data=' + value,
// imageUrl: 'https://supervise.yxtsoft.com/lpk/image/share_invite.png', //自定义图片路径,显示图片长宽比是 5:4。
// success: function(res) {
// console.log('aaaa', "分享成功")
// },
// fail: function(res) {
// // 转发失败
// console.log('aaaa', "用户点击了取消")
// }
// }
let _this = this
const promise = new Promise(resolve => {
// 模拟网络请求
setTimeout(() => {
var params = {
customerSid: getApp().globalData.sid
}
_this.$api.recommendNewUsers(params).then((resp) => {
let shareData = JSON.stringify({
// params: {
// code: resp.transferCode,
// codeKey: resp.sid
// },
// functionName: 'bindCard',
// url: '/pages/bind/bind_cloudCard?code=' + resp
// .transferCode + "&codeKey=" + resp.sid
url: '/pages/home/myCellar?shareSid=' + getApp()
.globalData.sid + "&orderSid=" + resp.sid,
functionName: 'share'
})
// 转码传输
let value = encodeURIComponent(shareData)
resolve({
title: '汇融农链-云菜窖',
// ②
path: '/pages/login/login?data=' + value,
imageUrl: 'https://supervise.yxtsoft.com/lpk/image/share_invite.png', //自定义图片路径,显示图片长宽比是 5:4。
})
}).catch(e => {
_this.shortToast('发生错误,请稍后再试.')
return
})
}, 0)
})
return promise
},
onShareTimeline() {
return {
title: '邀请您使用汇融云菜窖小程序', // 分享出的卡片标题
path: '/pages/home/cloudCard2', // 他人通过卡片进入小程序的路径,可以在后面拼接URL的形式带参数
imageUrl: '/static/logo_icon.png', // 分享出去的图片,默认为当前页面的截图。图片路径可以是本地文件路径或者网络图片路径。支持PNG及JPG。
};
},
getPhoneNumber(e) {
let _this = this
console.log(e.detail.code)
_this.$api.getPhone({
userSid: getApp().globalData.sid,
code: e.detail.code
}).then((resp) => {
_this.showModal4 = false
getApp().globalData.mobile = resp
}).catch(e => {
console.log(e);
})
},
}
}
</script>
<style>
.button1 {
background: #fff;
color: #666;
flex: 1;
border-radius: 0px;
border-bottom-left-radius: 20px;
border: 1px solid #eee;
}
.button2 {
background: #fff;
color: #FF9900;
border-radius: 0px;
border-bottom-right-radius: 20px;
flex: 1;
border: 1px solid #eee;
}
button {
background: #FF9900;
color: #fff;
height: 42px;
line-height: 40px;
font-size: 13px;
padding: 0px 15px;
border: 1px #FF5006 solid;
border-top-left-radius: 25px;
border-bottom-left-radius: 25px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
button::after {
border: 0;
}
/* 弹窗样式 */
.model {
position: absolute;
width: 100%;
height: 100%;
background: #000;
z-index: 100000;
opacity: 0.7;
top: 0;
left: 0;
}
.modalDlg {
/* 设置超出滚动 */
overflow: auto;
width: 100%;
position: fixed;
height: 100%;
top: 0;
left: 0;
z-index: 100000;
display: flex;
justify-content: center;
align-items: center;
}
.modalDlg2 {
/* 设置超出滚动 */
overflow: auto;
position: fixed;
z-index: 100000;
display: flex;
width: 100%;
height: 100%;
top: 0;
left: 0;
flex-direction: column;
justify-content: center;
align-items: center;
}
.modalDlg4 {
/* 设置超出滚动 */
overflow: auto;
position: fixed;
z-index: 100000;
display: flex;
width: 100%;
height: 100%;
top: 0;
left: 0;
flex-direction: column;
justify-content: center;
align-items: center;
}
.device-list {
box-sizing: border-box;
padding: 26rpx 6%;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #eee;
width: 100%;
}
.newpor_bom {
/* 加载背景图 */
background-image: url(https://supervise.yxtsoft.com/lpk/image/newpor_bom.png);
/* background-image: url(../../static/clound_bj1.png); */
/* 让背景图基于容器大小伸缩 */
background-size: 100% 100%;
}
.top {
width: 100vw;
/* height: 126.66vw; */
height: 50vw;
/* 加载背景图 */
background-image: url(https://supervise.yxtsoft.com/lpk/image/banner.png);
/* background-image: url(../../static/clound_bj1.png); */
/* 让背景图基于容器大小伸缩 */
background-size: 100% 100%;
}
.swiper {
width: 100vw;
height: 100%;
}
.wx-swiper-dots {
position: relative;
left: 50%;
/* 轮播图总高度 50vw-指示器点的大小12rxp-覆盖的高度15px - 覆盖的到指示器的高度5px */
top: calc(50vw - 20px - 12rpx);
}
.swiper /deep/ .wx-swiper-dot {
height: 12rpx;
width: 12rpx;
border-radius: 8rpx;
background: #98978C;
margin-right: 0;
}
.swiper /deep/ .wx-swiper-dot-active {
width: 44rpx;
height: 12rpx;
background: #FF9900;
border-radius: 8rpx;
}
.center {
display: flex;
flex-direction: row;
/* 这里注意,影响弹窗 */
height: calc(100vh - 120px - 50vw);
background-color: #f7f7f7;
border-radius: 15px;
overflow: hidden;
min-width: 0;
}
.bottom {
display: flex;
flex-direction: column;
border-top: 1px solid #F8F8F8;
padding-top: 5px;
flex-shrink: 0;
}
.label {
color: #191919;
font-size: 12px;
margin-top: 10px;
margin-bottom: 10px;
text-align: center;
padding-top: 7px;
padding-bottom: 7px;
margin-left: 5px;
margin-right: 5px;
}
.label2 {
background: #FFF;
color: #FFF;
background-color: #FF9900;
font-size: 12px;
margin-top: 10px;
margin-bottom: 10px;
padding-top: 7px;
padding-bottom: 7px;
text-align: center;
font-weight: bold;
border-radius: 20px;
margin-left: 5px;
margin-right: 5px;
}
.top_img1 {
border: 1px #FF9900 solid;
}
.top_img2 {
border: none
}
.top_text1 {
border: 1px #FF9900 solid;
background: #FF5006;
color: #fff;
font-weight: 800;
font-family: sans-serif;
padding: 5px 12px;
border-radius: 5px;
margin-top: -25px;
font-size: 13px;
word-break: keep-all;
white-space: nowrap;
}
.top_text2 {
border: 1px #FF9900 solid;
background: #fff;
color: #F6894B;
font-weight: 800;
padding: 5px 12px;
font-family: sans-serif;
border-radius: 5px;
margin-top: -25px;
font-size: 13px;
word-break: keep-all;
white-space: nowrap;
}
::-webkit-scrollbar {
width: 0;
height: 0;
background-color: transparent;
}
</style>