对接订单提交接口、完善添加微信接口、调取宫格接口、优化订单提交完成后的操作、优化分类选择

static-project
chen 2022-05-27 19:59:47 +08:00
parent d722273096
commit c037848d0f
13 changed files with 127 additions and 32 deletions

View File

@ -5,7 +5,7 @@
projectname:'', //
lat:'', //
lng:'' ,//
hostapi:'http://caimall.scdxtc.cn' //
hostapi:'https://caimall.scdxtc.cn' //
},
// show
onLaunch: function() {

View File

@ -78,8 +78,11 @@
//
maxHeight() {
let arr = [];
let max = '';
this.list.forEach(item=>{arr.push(item.iconHeight);})
let max = arr.reduce((a,b)=>{return b > a ? b : a})
if(arr.length) {
max = arr.reduce((a,b)=>{return b > a ? b : a})
}
return max;
},
},

View File

@ -178,6 +178,7 @@
id: item.id,
spuId:item.spu.id,
skuId:item.sku_id,
coding:item.sku.coding,
image: item.spu.spu_cover,
title: item.spu.spu_name,
content: item.spu.unit,
@ -220,12 +221,19 @@
} else {
//
console.log('去结算');
this.$requst.post('/api/order/create').then(res=>{
if(res.code==0) {
// uni.navigateTo({
// url:'/pagesB/settlement/settlement'
// })
let buyList = [];
this.listData.forEach(item=>{
if(item.ifcheck) {
let obj = {
sku_coding: item.coding,
num: item.num
}
buyList.push(obj);
}
})
uni.setStorageSync('buyList',buyList);
uni.navigateTo({
url:'/pagesB/settlement/settlement'
})
}
},

View File

@ -132,7 +132,14 @@
},
//
backEv(){
uni.navigateBack({delta:1})
uni.navigateBack({
delta:1,
fail: () => {
uni.reLaunch({
url:'/pages/tabbar/pagehome/pagehome'
})
}
})
}
}
}

View File

@ -9,7 +9,7 @@ export function themeEv(){
return requst.get('/api/index/mini-program-setting').then(res=>{
if(res.code==0){
let list = [];
if(res.data.footBar.length!=0){//底部导航
if(res.data.footBar.length){//底部导航
res.data.footBar.forEach(item=>{
let obj = {
iconPath: item.icon,
@ -20,6 +20,20 @@ export function themeEv(){
})
store.commit('updateState', {list})
}
let geList = [];
if(res.data.recommend.length){//底部导航
res.data.recommend.forEach((item,index)=>{
let obj = {
url:item.link,
iconsrc:item.icon,
iconWidth:[48,56,64,48,56,58,48,44,54,52][index],
iconHeight:[50,54,46,48,58,52,54,56,50,52][index],
title:item.name
}
geList.push(obj);
})
store.commit('setGe', {geList})
}
}
})
}
@ -27,7 +41,7 @@ export function themeEv(){
export function getCartNum(){
return requst.get('/api/order/shopping-cart-count').then(res=>{
if(res.code==0){
store.commit('setNum', 9)
store.commit('setNum', res.data.count)
}
})
}

View File

@ -27,6 +27,9 @@
onReachBottom() {
this.$refs.cart.getList();
},
onShow() {
uni.removeStorageSync('buyList');
},
onLoad(op) {
if(op.skuId) this.skuId = op.skuId;
},

View File

@ -77,6 +77,7 @@
// {id:1,title:''},
// {id:1,title:''},
],
activeIndex:0,
secendCateList:[
{title:'标题一'},
{title:'标题二标题二'},
@ -88,7 +89,6 @@
{title:'标题八'},
{title:'标题九'},
],
activeIndex:0,
dataList:[
// {imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg', title:'',price:199},
// {imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg', title:'',price:20000},
@ -117,7 +117,6 @@
}),
},
onLoad(op) {
console.log(this.footHeight);
this.scrollHeight = this.scrollHeight - this.footHeight;
if(op.index) {
this.current = op.index;
@ -155,7 +154,7 @@
},
//
checkShopCate(){
this.$requst.post('/api/spu/category').then(res=>{
this.$requst.post('/api/spu/category',{hasChildren:1}).then(res=>{
if(res.code==0) {
this.cateList = res.data;
setTimeout(()=>{
@ -166,6 +165,9 @@
}).exec()
},200)
this.pid = this.cateList[0].id;
if(this.cateList[0].child) {
this.secendCateList = this.cateList[0].child;
}
this.checkShopList(this.cateList[0].id);
}
})
@ -182,6 +184,24 @@
this.current = index;
this.page = 1;
this.pid = id;
// if(this.activeIndex>this.cateList[index].child.length-1) {
// this.activeIndex = this.cateList[index].child.length-1;
// }
if(this.cateList[index].child) {
this.secendCateList = this.cateList[index].child;
} else {
this.secendCateList = [
{title:'标题一'},
{title:'标题二标题二'},
{title:'标题三'},
{title:'标题四'},
{title:'标题五'},
{title:'标题六标题六标题六'},
{title:'标题七'},
{title:'标题八'},
{title:'标题九'},
]
}
this.checkShopList(id);
},
goDetail(id) {

View File

@ -24,9 +24,9 @@
<view class="addwxpop" v-if="ifWx" :style="{top: padt+'px'}" @tap="ifWx=false">
<view class="pad-s80 pad-zy50">
<view class="bacf pad20 disjcac" style="width: 420rpx;height: 420rpx;margin: 0 auto;">
<image :src="imgsrc" style="width: 380rpx;height: 380rpx;" mode="aspectFill"></image>
<image :src="imgsrc" style="" mode="aspectFill"></image>
</view>
<view class="colf line-h56 mar30">
<view class="colf line-h56 mar-sx30">
<!-- <view class="fon36">请扫描二维码添加微信告知您的订单号并支付定金 发货前请支付尾款</view>
<view class="fon24 tcenter">支付定金后我们才会开始制作哦如您有特别的要求可以在微信上提出哦</view>
<view class="fon36 tcenter">祝您幸福美满</view> -->
@ -75,7 +75,7 @@
{url:'/pagesB/business-profile/business-profile',iconsrc:'/static/public/icon-aboutus.png',iconWidth:34,iconHeight:32,title:'商家简介',content:'',contentColor:'#999999',ifNext:true},
],
ifWx:false,
imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',
imgsrc:'',
userImg:'',
userName:'',
addwxcontent:''
@ -99,7 +99,7 @@
this.$requst.get('/api/index/add-wechat').then(res=>{
if(res.code==0) {
this.addwxcontent = this.$toolAll.tools.escape2Html(res.data.content);
this.imgsrc = getApp().globalData.hostapi + res.data.wechat;
this.imgsrc = res.data.wechat;
}
})
},
@ -109,8 +109,8 @@
if(res.code==0) {
this.userImg = res.data.headimgurl;
this.userName = res.data.nickname;
this.list[0].num = res.data.order_count.paid;
this.list[1].num = res.data.order_count.waiting;
this.list[0].num = res.data.order_count.order_placed;
this.list[1].num = res.data.order_count.makeing;
this.list[2].num = res.data.order_count.shipped;
}
@ -131,7 +131,6 @@
uni.navigateTo({
url:`/pagesA/order-list/order-list?index=${[1,2,3,4][obj.index]}`
})
console.log(obj);
},
//
saveImg(){

View File

@ -13,7 +13,7 @@
</view>
<view class="pad-sx20">
<!-- 分类宫格 -->
<gong-ge-function itemTop="40rpx" @chooseGe="chooseGe" :list="list"></gong-ge-function>
<gong-ge-function itemTop="40rpx" @chooseGe="chooseGe" :list="geList"></gong-ge-function>
</view>
<view class="pad-zy20">
<list-one ref="listhome" :ifTitle="true"></list-one>
@ -32,6 +32,7 @@
import listOne from '@/components/list/list-one';
import customerOne from '@/components/customer/customer-one';
import {slidePosition} from '@/jsFile/public-api.js';
import { mapState } from 'vuex'//mapState
export default {
components:{
'foot-tab' :footTab,
@ -62,6 +63,14 @@
playTimer:null,
bannerList:[]
}
},
computed:{
...mapState({
geList: state => state.moduleA.geList,
}),
},
onShareAppMessage() {
},
onReachBottom(e) {
this.$refs.listhome.moreEv();

View File

@ -8,10 +8,11 @@
</view>
<view class="tcenter" style="color: #0c0c0c;">已完成提交</view>
<view class="col9 tcenter mar-sx50 line-h50">
请扫描二维码添加微信告知您的订单<br />
<rich-text :nodes="richText"></rich-text>
<!-- 请扫描二维码添加微信告知您的订单<br />
号并支付定金 发货前请支付尾款<br />
支付定金后我们才会开始制作哦如您有特<br />
别的要求可以在微信上提出哦<br /> 祝您幸福美满
别的要求可以在微信上提出哦<br /> 祝您幸福美满 -->
</view>
<view @tap="saveImg" class="navigate-to-where radius30 colf fon36 tcenter">保存二维码</view>
<view @tap="goShop" class="navigate-to-where radius30 colf fon36 tcenter mar-s50" style="background: #e00c34;">继续购物</view>
@ -25,11 +26,17 @@
export default {
data() {
return {
imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg'
imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',
richText:''
}
},
onLoad() {
onLoad(op) {
this.$requst.get('/api/order/orderQrCode',{id:op.id}).then(res=>{
if(res.code==0) {
this.imgsrc = res.data.path;
this.richText = this.$toolAll.tools.escape2Html(res.data.content);
}
})
},
methods: {
//

View File

@ -17,15 +17,15 @@
</picker>
</view>
<view class="posir fon30 mar-x50">
<text class="col9 posia pad-zy10 input-title">收货地址</text>
<text class="col9 posia pad-zy10 input-title">收货地址(必填)</text>
<input type="text" v-model="address" @tap="chooseEv(2)" class="input-box width100 radius20 pad-zy30" :class="current==2 ? 'focusc' : ''" placeholder="请填写收货地址" placeholder-style="color:#000000">
</view>
<view class="posir fon30 mar-x50">
<text class="col9 posia pad-zy10 input-title">收货联系人</text>
<text class="col9 posia pad-zy10 input-title">收货联系人(必填)</text>
<input type="text" v-model="name" @tap="chooseEv(3)" class="input-box width100 radius20 pad-zy30" :class="current==3 ? 'focusc' : ''" placeholder="请填写联系人" placeholder-style="color:#000000">
</view>
<view class="posir fon30 mar-x50">
<text class="col9 posia pad-zy10 input-title">收货电话</text>
<text class="col9 posia pad-zy10 input-title">收货电话(必填)</text>
<input type="number" v-model="phone" maxlength="11" @tap="chooseEv(4)" class="input-box width100 radius20 pad-zy30" :class="current==4 ? 'focusc' : ''" placeholder="请填写联系电话" placeholder-style="color:#000000">
</view>
<view @tap="submit" class="navigate-to-where radius30 colf fon36 tcenter">提交完成</view>
@ -56,8 +56,22 @@
submit(){
if(this.checkEmpty() && this.flag){
this.flag = false;
uni.navigateTo({
url:'/pagesB/finish/finish'
let params = {
sku_list: uni.getStorageSync('buyList'),
phone: this.phone,
contacts: this.name,
address: this.address,
expected_delivery_date: this.totime,
wedding_date: this.lasttime,
}
this.$requst.post('/api/order/create',params).then(res=>{
if(res.code==0) {
uni.reLaunch({
url:`/pagesB/finish/finish?id=${res.data.id}`
})
} else {
this.$toolAll.tools.showToast(res.msg);
}
})
}
},

View File

@ -45,6 +45,13 @@
onHide() {
clearTimeout(this.playTimer);
},
onShareAppMessage() {
return {
title:'',
path:`/pagesB/shop-detail/shop-detail?id=${this.shopObj.id}`,
imageUrl:''
}
},
onShow() {
this.playTimer = setTimeout(()=>{
this.isplay = true;

View File

@ -25,13 +25,17 @@ export default {
titleList:[],
imgList:[],
onLineList:[],
cartNum:0
cartNum:0,
geList:[]
},
// Vuex中store数据改变的唯一方法就是mutations 不适合异步方法
mutations: {
setNum(state,num){
state.cartNum = num;
},
setGe(state,payload){
state.geList = payload.geList;
},
footHeightEv(state,str){
state.footHeight = str;
},