| src/utils/axios.ts | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/jifenShangCheng/components/dizhi.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/jifenShangCheng/components/gouwuche.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/jifenShangCheng/components/myOrder.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/jifenShangCheng/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/login/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/utils/axios.ts
@@ -69,16 +69,14 @@ instance.interceptors.response.use( (response: AxiosResponse) => { const { data, status } = response const { message } = data console.log(status) const { message,code } = data // 请求正常时,仅返回需要用到的 data 信息即可 if (message==='SUCCESS') return data.data if (code===200) return data.data // 1、对于一些请求正常,但后台处理失败的内容进行拦截,返回对应错误信息 alert(message || '请求异常,请刷新重试') return { code: status, message: message || '请求异常,请刷新重试', result: data } return Promise.reject(data.data) }, (error: AxiosError) => { return error.response ? errorHandle(error) : Promise.reject(error) src/views/jifenShangCheng/components/dizhi.vue
@@ -81,6 +81,7 @@ console.log('默认地址') console.log(re) if (re.list.length===0){ list.value=[] onAdd() } else { list.value=[] src/views/jifenShangCheng/components/gouwuche.vue
@@ -215,7 +215,33 @@ } const jieshuan=()=>{ alert('结算') console.log(gwcList.value,defaultDizhi.value) const listCode: any[]=[] gwcList.value.forEach((el:any)=>{ if (el.checked){ listCode.push(el.code) } }) if (listCode.length===0){ Toast('没有选中要结算的商品') return false } const pasm=`cartCodes=${listCode.toString()}&addressCode=${defaultDizhi.value.code}` console.log(pasm) ajaxPost('/eshop/order/checkout',pasm) .then((re:any)=>{ console.log(re) if (re==='OK'){ Toast.success('您已经兑换成功') } else { Toast('兑换失败') } }).catch((error)=>{ console.log(error) Toast('兑换失败') }) } const getDefDizhi=()=>{ const pasm=`page=0&size=0&wherecondition=patient_is_default=1 and patient_code="${userInfo.patient.patientInfo.code}"` src/views/jifenShangCheng/components/myOrder.vue
New file @@ -0,0 +1,133 @@ <template> <div> <van-popup v-model:show="show" position="bottom" :style="{ height: '100%' }"> <van-nav-bar title="我的订单" left-text="返回" left-arrow @click-left="show = false" /> <div style="padding: 10px;"> <van-tabs v-model:active="active"> <van-tab :name="0" title="待发货"></van-tab> <van-tab :name="1" title="已发货"></van-tab> <van-tab :name="2" title="已签收"></van-tab> <van-tab :name="-1" title="已取消"></van-tab> </van-tabs> <div class="parent " v-for="(order,index) in orderList" :key="index"> <div class="parentzi" v-for="(item) in order.items" :key="item.id"> <div> <van-image fit="contain" width="100%" height="3.5rem" :src="item.itemPhoto" /> </div> <div style="padding-left: 10px;"> <div style="height: 2rem; line-height: 2rem; color: #409eff;">{{item.itemName}}x{{item.itemCount}}</div> <div style="height: 2rem;"> <van-row> <van-col :span="12" style="color: #f56c6c;">¥{{Number(item.itemPrice) * Number(item.itemCount)}}</van-col> </van-row> </div> </div> </div> <div> <div style="height: 2rem; padding-left: 10px;"> <van-row style="color: #e6a23c;"> <van-icon size="20px" color="#E6A23C" name="free-postage" />{{order.recvName}}-{{order.recvMobile}}-{{ order.recvAddress}} </van-row> </div> <div style="height: 2rem; padding-left: 10px;"> <van-row> <van-col :span="12" style="padding-left: 10px; color: #f56c6c;"> 合计:{{funheji(order)}} </van-col> <van-col :span="12" v-if="order.orderStatus === 0" style="text-align: right;padding-right: 20px; color: #909399;"> <span @click="quxiao(order)">取消</span> </van-col> </van-row> </div> </div> </div> </div> </van-popup> </div> </template> <script setup lang="ts"> import { ref } from 'vue' import { ajaxPost } from '@/utils/axios' import { userInfoStore } from '@/stores/userInfo' import { watch } from 'vue' import { Dialog, Toast } from 'vant' const userInfo = userInfoStore() const show=ref(false) const active=ref(0) const orderList=ref(<any>[]) const openShow=()=>{ show.value=true getOrders() } const quxiao=(item:any)=>{ Dialog.confirm({ title: '提示', message: '您确认要取消该条订单', }) .then(() => { const pasm={ code:item.code, id:item.id, orderStatus:-1 } ajaxPost('/eshop/order/update',pasm).then((re:any)=>{ console.log(re) Toast.success('订单取消成功') getOrders() }) }) .catch(() => { Toast('已取消操作') }) } const getOrders=()=>{ const pasm=`page=0&size=0&wherecondition=patient_code=\'${userInfo.patient.patientInfo.code}\' and order_status=${active.value}` ajaxPost('/eshop/order/list',pasm).then((re:any)=>{ console.log(re) orderList.value=re.list }) } watch(()=>active.value,()=>{ getOrders() }) const funheji=(row:any)=>{ let numb=0 row.items.forEach((e:any)=>{ numb+= Number(e.itemPrice)*Number(e.itemCount) }) return numb } defineExpose({ openShow }) </script> <style> .parent { border: 1px solid #cdd0d6; border-radius: 10px; margin-top: 10px; } .parentzi { padding-top: 10px; padding-left: 5px; height: 4rem; display: grid; grid-template-columns: minmax(30%, 30%) 1fr; } </style> src/views/jifenShangCheng/index.vue
@@ -11,8 +11,15 @@ :items="items" > <template #content> <div style="text-align: right; padding-right: 15px; height: 50px; line-height: 30px; color: #409eff; font-size: 16px;"> <van-icon @click="openGwc" size="26px" name="cart-circle-o" style="margin-top: 20px;" /> <div style="border-bottom: #e6e8eb solid 1px; text-align: right; padding-right: 15px; height: 50px; line-height: 30px; color: #409eff; font-size: 16px;"> <!-- 订单 --> <van-icon @click="openOrder" size="26px" name="balance-list-o" color="#67C23A" style="margin-top: 10px; margin-right: 20px;" /> <!-- 购物车 --> <van-icon @click="openGwc" size="26px" name="cart-circle-o" color="#F56C6C" style="margin-top: 10px;" /> </div> <div v-if="items.length > 0" style="border-left: 1px solid rgb(229, 226, 225); background: #f7f8fa;"> <van-card @@ -54,8 +61,11 @@ <van-icon size="40px" color="#E6A23C" name="location-o" /> </van-col> <van-col :span="20" style="font-size: 16px; padding-left: 10px; height: 60px; line-height: 30px;"> <div>{{defaultDizhi.patientAddress}} </div> <div>联系电话:{{defaultDizhi.receivePersonMobile}} </div> <div v-if="defaultDizhi.patientAddress !== ''">{{defaultDizhi.patientAddress}} </div> <div v-if="defaultDizhi.patientAddress !== ''">联系电话:{{defaultDizhi.receivePersonMobile}} </div> <div @click="openDizhi" v-else style="margin-top: 18px; color: #e6a23c;"> 请设置你的收货地址 </div> </van-col> <van-col :span="2" style="height: 60px; line-height: 60px;"> <van-icon size="20px" @click="openDizhi" name="arrow" /> @@ -73,7 +83,7 @@ <template #thumb> <van-image style="border: 1px solid #ebedf0;" fit="cover" fit="contain" width="100%" height="100%" :src="setItem.itemPhoto" @@ -105,7 +115,7 @@ <van-action-bar-icon icon="revoke" @click="show = false" text="返回" dot /> <van-action-bar-icon icon="cart-o" text="购物车" :badge="gwcBadge" /> <van-action-bar-button @click="AddGwc" type="warning" text="加入购物车" /> <van-action-bar-button type="danger" text="立即购买" /> <van-action-bar-button type="danger" @click="liJiGouMai" text="立即购买" /> </van-action-bar> </van-popup> </div> @@ -115,6 +125,9 @@ </div> <div> <gouwuche ref="gouwucheRef"></gouwuche> </div> <div> <myOrder ref="myOrderRef"></myOrder> </div> <van-tabbar v-model="active" @change="tabChang"> <van-tabbar-item name="home" icon="like">首页</van-tabbar-item> @@ -129,6 +142,7 @@ import { useWindowSize } from '@vant/use' import dizhi from '../jifenShangCheng/components/dizhi.vue' import gouwuche from './components/gouwuche.vue' import myOrder from './components/myOrder.vue' import { userInfoStore } from '@/stores/userInfo' const userInfo = userInfoStore() import { ajaxPost} from '@/utils/axios' @@ -137,6 +151,7 @@ const router=useRouter() const { height } = useWindowSize() const dizhiRef=ref() const myOrderRef=ref() const gouwucheRef=ref() const show=ref(false) const loading=ref(true) @@ -172,6 +187,9 @@ const openGwc=()=>{ gouwucheRef.value.openShow() } const openOrder=()=>{ myOrderRef.value.openShow() } const tabChang=(index:any)=>{ if (index==='home'){ router.push('/') @@ -199,7 +217,7 @@ }) } // 购买 // 打开购买 const goumai=(item:any)=>{ console.log(item) setItem.value={ @@ -210,7 +228,35 @@ itemPhoto:item.itemPhoto, id:item.id } show.value=true AddGwc() // show.value=true } // 立即购买 const liJiGouMai=()=>{ if (defaultDizhi.value.id>0){ console.log(setItem.value,defaultDizhi.value) const pasm={ addressCode:defaultDizhi.value.code, cartCodes:setItem.value.code } console.log(pasm) ajaxPost('/eshop/order/checkout',`addressCode=${defaultDizhi.value.code}&cartCodes=${setItem.value.code}`) .then(re=>{ console.log(re) if (re.data==='OK'){ Toast.success('您已经兑换成功') } else { Toast('兑换失败') } }).catch((error)=>{ console.log(error) Toast('兑换失败') }) } else { Toast('请先选择您的收货地址') } } // 编辑地址 const openDizhi=()=>{ src/views/login/index.vue
@@ -11,7 +11,7 @@ const config={ headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, } } const userInfo = userInfoStore() const route = useRoute() @@ -123,6 +123,7 @@ return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === 'micromessenger' } onMounted(()=>{ Session.remove('token') if (isWechat()){ console.log('初始化',route) const queryInfo=route.query @@ -206,7 +207,7 @@ </van-field> </van-cell-group> <div style="margin: 16px;text-align:center;"> <div class="tss"><van-icon name="circle" /> 登录即视为已经阅读并同意<b style="color: #769AFF;">网站服务条款、法律声明及隐私权政策</b></div> <div class="tss"><van-icon name="circle" /> 登录即视为已经阅读并同意<b style="color: #769aff;">网站服务条款、法律声明及隐私权政策</b></div> <van-button :loading="loadingBUt" round block type="primary" native-type="submit"> 登 录 </van-button> @@ -234,13 +235,13 @@ </van-field> </van-cell-group> <div style="margin: 16px;text-align:center;"> <div class="tss"><van-icon name="circle" /> 登录即视为已经阅读并同意<b style="color: #769AFF;">网站服务条款、法律声明及隐私权政策</b></div> <div class="tss"><van-icon name="circle" /> 登录即视为已经阅读并同意<b style="color: #769aff;">网站服务条款、法律声明及隐私权政策</b></div> <van-button :loading="loadingBUt" round block type="primary" native-type="submit"> 登 录 </van-button> </div> </van-form> <van-row class="loginType"> <van-row class="logintype"> <div class="toptype"> <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa', padding: '0 16px' }" @@ -330,39 +331,47 @@ width: 100%; min-height: 900px; } .logintt{ text-align: center; } .loginwenz{ font-size: 12px; font-weight: 400; color: #AAAAAA; color: #aaa; } .loginType{ .logintype { width: 100%; margin-top: 120px; text-align: center; font-size: 11px; font-weight: 400; color: #AAAAAA; color: #aaa; // background: black; .toptype{ width: 100%; } } .titlebiaoti{ padding-top: 70px; text-align:center; padding-left: 30px; // border: 1px solid black; font-size: 15px; padding-bottom: 70px; } .tss{ font-size: 10px; font-weight: 400; color: #AAAAAA; color: #aaa; height: 50px; // line-height: 50px; } </style>