Commit beb84ae0 authored by 黄媛媛's avatar 黄媛媛

111

parent b9439f0f
...@@ -103,7 +103,6 @@ export default { ...@@ -103,7 +103,6 @@ export default {
methods: { methods: {
// 购物车 // 购物车
showSkuHandler(g) { showSkuHandler(g) {
console.log('g', g);
this.sku = g; this.sku = g;
this.showSku = true; this.showSku = true;
}, },
......
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
this.active=i this.active=i
}, },
clickHandler(item) { clickHandler(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.Id }); uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id });
}, },
init() { init() {
this.isover = false; this.isover = false;
......
<template> <template>
<div class="catstyle4" style="height: 100%;"> <view class="catstyle4" style="height: 100%;">
<div class="left-slider"> <div class="left-slider">
<sidebar <sidebar
:active="tid" :active="tid"
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</div> </div>
<div class="sell">{{ cx.sales }}</div> <div class="sell">{{ cx.sales }}</div>
</div> </div>
<div class="right"> <div @click.stop="showSkuHandler(cx)" class="right">
<!-- todo 点击加入购物车--> <!-- todo 点击加入购物车-->
<u-icon name="cart-circle-o" size="44" :color="mainColor" /> <u-icon name="cart-circle-o" size="44" :color="mainColor" />
</div> </div>
...@@ -67,16 +67,16 @@ ...@@ -67,16 +67,16 @@
<u-divider v-if="isover" :margin-top="20" :margin-bottom="20">没有更多商品了</u-divider> <u-divider v-if="isover" :margin-top="20" :margin-bottom="20">没有更多商品了</u-divider>
</scroll-view> </scroll-view>
</div> </div>
</div> <good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku';
import sidebar from "../sidebar/index"; import sidebar from "../sidebar/index";
export default { export default {
props: ["d", "h"], props: ["d", "h"],
components: {
sidebar,
},
data() { data() {
return { return {
mainColor: "", mainColor: "",
...@@ -98,8 +98,13 @@ export default { ...@@ -98,8 +98,13 @@ export default {
OrderBy:1, OrderBy:1,
UserId:0, UserId:0,
}, },
sku: {},
showSku: false
}; };
}, },
components: {
sidebar,goodSku
},
created() { created() {
this.mainColor = this.$uiConfig.mainColor; this.mainColor = this.$uiConfig.mainColor;
this.activeStyle = `background:${this.mainColor};`; this.activeStyle = `background:${this.mainColor};`;
...@@ -108,6 +113,11 @@ export default { ...@@ -108,6 +113,11 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
// 购物车
showSkuHandler(g) {
this.sku = g;
this.showSku = true;
},
changeHandler(i) { changeHandler(i) {
this.msg.CategoryIds= this.d[i].Id+''; this.msg.CategoryIds= this.d[i].Id+'';
this.msg.page = 1; this.msg.page = 1;
...@@ -116,7 +126,7 @@ export default { ...@@ -116,7 +126,7 @@ export default {
this.init(); this.init();
}, },
clickHandler(item) { clickHandler(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.Id }); uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id });
}, },
init() { init() {
this.isover = false; this.isover = false;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<image <image
v-if="x.IconPath && x.IconPath.length > 0" v-if="x.IconPath && x.IconPath.length > 0"
mode="aspectFit" mode="aspectFit"
:src="getIconLink(c.IconPath)" :src="getIconLink(x.IconPath)"
style="width: 100%; height: 100%;" style="width: 100%; height: 100%;"
/> />
</div> </div>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<view class="price" :style="{ color: mainColor }">{{ cx.price_content }}</view> <view class="price" :style="{ color: mainColor }">{{ cx.price_content }}</view>
<view class="sell">{{ cx.sales }}</view> <view class="sell">{{ cx.sales }}</view>
</view> </view>
<view class="right"> <view @click.stop="showSkuHandler(cx)" class="right">
<u-icon name="cart-circle-o" size="44" :color="mainColor" /> <u-icon name="cart-circle-o" size="44" :color="mainColor" />
</view> </view>
</view> </view>
...@@ -71,11 +71,13 @@ ...@@ -71,11 +71,13 @@
</scroll-view> </scroll-view>
</view> </view>
</view> </view>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</view> </view>
</template> </template>
<script> <script>
import sidebar from "../sidebar/index"; import sidebar from "../sidebar/index";
import goodSku from '../goods/goodsku';
export default { export default {
props: ["d", "h"], props: ["d", "h"],
data() { data() {
...@@ -103,10 +105,12 @@ export default { ...@@ -103,10 +105,12 @@ export default {
CategoryIdsList:[], CategoryIdsList:[],
CategoryIds1:'', CategoryIds1:'',
CategoryIds2:'', CategoryIds2:'',
sku: {},
showSku: false
}; };
}, },
components: { components: {
sidebar sidebar,goodSku
}, },
created() { created() {
this.mainColor = this.$uiConfig.mainColor; this.mainColor = this.$uiConfig.mainColor;
...@@ -123,6 +127,11 @@ export default { ...@@ -123,6 +127,11 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
// 购物车
showSkuHandler(g) {
this.sku = g;
this.showSku = true;
},
changeHandler(i) { changeHandler(i) {
this.active=i; this.active=i;
this.CategoryIds1=this.d[i].Id; this.CategoryIds1=this.d[i].Id;
...@@ -142,7 +151,7 @@ export default { ...@@ -142,7 +151,7 @@ export default {
this.init(); this.init();
}, },
clickHandler(item) { clickHandler(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.Id }); uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id });
}, },
init() { init() {
this.CategoryIdsList=[]; this.CategoryIdsList=[];
......
...@@ -101,13 +101,13 @@ export default { ...@@ -101,13 +101,13 @@ export default {
<style> <style>
.coupon { .coupon {
min-height: 70vh; max-height: 70vh;
background: #f5f5f5; background: #f5f5f5;
padding-bottom: 50px; padding-bottom: 50px;
text-align: left !important; text-align: left !important;
border-top-left-radius: 20rpx; border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx; border-top-right-radius: 20rpx;
overflow: hidden; overflow: scroll;
} }
.coupon .title { .coupon .title {
font-size: 22px; font-size: 22px;
......
...@@ -138,6 +138,7 @@ export default { ...@@ -138,6 +138,7 @@ export default {
}; };
}, },
mounted() { mounted() {
console.log("good",this.good)
this.request2( this.request2(
{ {
url: '/api/AppletGoods/GetAppletGoodsInfo', url: '/api/AppletGoods/GetAppletGoodsInfo',
......
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
<image :src="y.cover_pic" mode="aspectFill" class="image" /> <image :src="y.cover_pic" mode="aspectFill" class="image" />
<view class="goodinfo"> <view class="goodinfo">
<view class="name">{{ y.name }}</view> <view class="name">{{ y.name }}</view>
<view class="attr">已选择 {{ y.attrStr }}</view> <view class="attr">已选择
<span v-for="(item,index) in y.attr_list" :key="index">{{ item.attr_group_name}}:{{ item.attr_name}}</span>
</view>
<view class="price"> <view class="price">
<view class="left" :style="{ color: mc }"> <view class="left" :style="{ color: mc }">
<text class="small"></text> <text class="small"></text>
<text>{{ y.goods_attr.price.split(".")[0] }}</text> <text>{{ y.goods_attr.price}}</text>
<text class="small" <!-- <text class="small">.{{ y.goods_attr.price.split(".")[1] || "00" }}</text> -->
>.{{ y.goods_attr.price.split(".")[1] || "00" }}</text
>
</view> </view>
<view class="right">x{{ y.num }}</view> <view class="right">x{{ y.num }}</view>
</view> </view>
......
<template>
<view>
<u-popup
close-icon-color="red"
v-model="show"
mode="center"
:mask-close-able="false"
length="auto"
:closeable="true"
close-icon="close"
:border-radius="20"
:z-index="9999"
>
<view style="background:#fff;width:550rpx;padding:40rpx;border-radius:20px">
<u-icon @click="closePay" name="close" style="float:right;font-size:40rpx"></u-icon>
<p style="text-align: center;font-size: 26rpx;">支付方式</p>
<p style="font-size: 36rpx;font-weight: 700;text-align: center;margin:30px 0">支付金额{{ payInfo.total_price }}</p>
<p>
<img style="width:50rpx;height:50rpx;margin-right:10px" src="../../static/wx.png" alt="" />
<span style="position:relative;top:-7px">微信支付</span>
</p>
<view style="margin-top:30px"><u-button @click="Pay" type="error" shape="circle">支付</u-button></view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
props: ['payInfo'],
data() {
return {
show: true,
orderInfo: {}
};
},
created() {
this.getDataInfo();
},
methods: {
closePay() {
this.$emit('closePay');
},
getDataInfo() {
let msg = {
OpenId: 'ow_7I5XC1-RGwwk8QANBmWKYKmOc',
OrderId: '1',
OrderPayType: 1,
GoodsName: '测试商品名称'
};
this.request2(
{
url: '/api/WeChatPay/GetPayInfo',
data: msg
},
res => {
console.log('res', res);
if (res.resultCode == 1) {
this.orderInfo = JSON.parse(res.data);
}
uni.hideNavigationBarLoading();
}
);
},
Pay() {
let orderInfo = this.orderInfo;
uni.requestPayment({
provider: 'wxpay',
timeStamp: this.orderInfo.timeStamp,
nonceStr: this.orderInfo.nonceStr,
package: this.orderInfo.package,
signType: this.orderInfo.signType,
paySign: this.orderInfo.sign,
success: function(res) {
console.log('success', res);
uni.navigateTo({
url: '/pages/order-submit/pay-success'
});
},
fail: function(err) {
console.log('fail:', err);
}
});
}
}
};
</script>
<style></style>
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
:enable-flex="true" :enable-flex="true"
:style="{ height: '100%' }" :style="{ height: '100%' }"
> >
<view v-for="(item, index) in list" :key="index" class="addresbox"> <view v-for="(item, index) in list" :key="index" class="addresbox" @click="chosenHandler(item)">
<view class="addresclo"> <view class="addresclo">
<Text >收件人:{{item.Name}}</Text> <Text>收件人:{{item.Name}}</Text>
<Text>{{item.Mobile}}</Text> <Text>{{item.Mobile}}</Text>
</view> </view>
<Text style='width: 100%;'>收货地址:{{item.DistrictAddress}}{{item.Address}}</Text> <Text style='width: 100%;'>收货地址:{{item.DistrictAddress}}{{item.Address}}</Text>
...@@ -24,14 +24,14 @@ ...@@ -24,14 +24,14 @@
<view style="display: flex;flex-direction: row;align-items: center;"> <view style="display: flex;flex-direction: row;align-items: center;">
<view <view
style="display: flex;flex-direction: row;align-items: center;" style="display: flex;flex-direction: row;align-items: center;"
@click="btn_edit(item)" @click.stop="btn_edit(item)"
> >
<u-icon name="edit" color="#c8c9cc" size="40"></u-icon> <u-icon name="edit" color="#c8c9cc" size="40"></u-icon>
<Text style="color:#c8c9cc;">编辑</Text> <Text style="color:#c8c9cc;">编辑</Text>
</view> </view>
<view <view
style="display: flex;flex-direction: row;align-items: center;margin: 0 30rpx" style="display: flex;flex-direction: row;align-items: center;margin: 0 30rpx"
@click="btn_delete(item)" @click.stop="btn_delete(item)"
> >
<u-icon name="delete" color="#c8c9cc" size="40"></u-icon> <u-icon name="delete" color="#c8c9cc" size="40"></u-icon>
<Text style="color:#c8c9cc;">删除</Text> <Text style="color:#c8c9cc;">删除</Text>
...@@ -84,6 +84,11 @@ export default { ...@@ -84,6 +84,11 @@ export default {
IsDefault:0, IsDefault:0,
Mobile:'', Mobile:'',
}, },
source: "",
defaultId: 0,
currentAddress: {},
list: [],
mc:"",
}; };
}, },
...@@ -110,7 +115,7 @@ export default { ...@@ -110,7 +115,7 @@ export default {
title: this.pageTitle, title: this.pageTitle,
}); });
}, },
onLoad() { onLoad(option) {
this.u = wx.getStorageSync("userinfo"); this.u = wx.getStorageSync("userinfo");
if (!this.u) { if (!this.u) {
this.u = { this.u = {
...@@ -119,9 +124,23 @@ export default { ...@@ -119,9 +124,23 @@ export default {
}; };
this.showAuth = true; this.showAuth = true;
} }
if (option && option.form) {
(this.source = option.form), (this.defaultId = option.id);
}
this.init(); this.init();
}, },
methods: { methods: {
chosenHandler(item){
console.log("chosenHandler",item)
let pages = getCurrentPages()
let prevPage = pages[ pages.length - 2 ]
prevPage.$vm.formData.address_id = item.Id;
prevPage.$vm.formdata.AddressId = item.Id;
prevPage.$vm.adressInfo=item;
uni.navigateBack({
delta: 1
})
},
init() { init() {
this.loading = false; this.loading = false;
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
......
...@@ -5,28 +5,28 @@ ...@@ -5,28 +5,28 @@
<view class="default"> <view class="default">
<u-icon name="checked" size="44" :color="mc"></u-icon> <u-icon name="checked" size="44" :color="mc"></u-icon>
</view> </view>
<view class="address" @click="chosenHandler(currentAddress.id)"> <view class="address" @click="chosenHandler(currentAddress)">
<view class="base"> <view class="base">
<text class="name">{{currentAddress.name}}</text> <text class="name">{{currentAddress.Name}}</text>
<text class="phone">{{currentAddress.mobile}}</text> <text class="phone">{{currentAddress.Mobile}}</text>
</view> </view>
<view class="details"> <view class="details">
{{currentAddress.address}} {{currentAddress.Address}}
</view> </view>
</view> </view>
<view class="edit"> <view @click.stop="btn_edit(currentAddress)" class="edit">
<u-icon name="edit" size="44" color="#444"></u-icon> <u-icon name="edit" size="44" color="#444"></u-icon>
</view> </view>
</view> </view>
<view class="item" v-for="(x, i) in list" :key="i"> <view class="item" v-for="(x, i) in list" :key="i">
<view class="address"> <view class="address">
<view class="base" @click="chosenHandler(x.id)"> <view class="base" @click="chosenHandler(x)">
<text class="name">{{x.name}}</text> <text class="name">{{x.Name}}</text>
<text class="phone">{{x.mobile}}</text> <text class="phone">{{x.Mobile}}</text>
</view> </view>
<view class="details">{{x.address}}</view> <view class="details">{{x.Address}}</view>
</view> </view>
<view class="edit"> <view @click.stop="btn_edit(x)" class="edit">
<u-icon name="edit" size="44" color="#444"></u-icon> <u-icon name="edit" size="44" color="#444"></u-icon>
</view> </view>
</view> </view>
...@@ -59,11 +59,17 @@ export default { ...@@ -59,11 +59,17 @@ export default {
defaultId: 0, defaultId: 0,
currentAddress: {}, currentAddress: {},
list: [], list: [],
mc:"" mc:"",
msg:{
Name:'',
IsDefault:0,
Mobile:'',
},
}; };
}, },
onLoad(option) { onLoad(option) {
if (option.form) { console.log("option",option)
if (option && option.form) {
(this.source = option.form), (this.defaultId = option.id); (this.source = option.form), (this.defaultId = option.id);
} }
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
...@@ -71,48 +77,85 @@ export default { ...@@ -71,48 +77,85 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
chosenHandler(id){ btn_edit(item) {
console.log("item",item)
uni.navigateTo({
url: "/pages/address/AddAddress?AddressId="+item.Id
});
},
chosenHandler(item){
let pages = getCurrentPages() let pages = getCurrentPages()
let prevPage = pages[ pages.length - 2 ] let prevPage = pages[ pages.length - 2 ]
prevPage.$vm.formData.address_id = id prevPage.$vm.formData.address_id = item.Id;
prevPage.$vm.formdata.AddressId = item.Id;
prevPage.$vm.adressInfo=item;
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })
}, },
newAddressHandler(){ newAddressHandler(){
console.log("hhhh")
uni.navigateTo({ uni.navigateTo({
url: '/pages/address/addAddress' url: '/pages/address/AddAddress'
}); });
}, },
init() { init() {
console.log("1111")
this.loading = false; this.loading = false;
let h=this.apiheader() this.request2(
this.request( {
{ url: '/api/AppletUser/GetUserShippingAddressList',
url: "", data: this.msg
header: h, },
data: { res => {
r: "api/user/address", uni.hideNavigationBarLoading();
}, console.log("res",res)
}, if(res.resultCode==1){
this.isloading = false;
this.list = res.data;
let index = -1;
this.list.forEach((x, i) => {
x.MobileNew = x.Mobile;
x.Mobile = x.Mobile.substr(0, 3) + "****" + x.Mobile.substr(7);
if (x.Id == this.defaultId) {
this.currentAddress = x;
index = i;
}
});
if (index != -1) {
this.list.splice(index, 1);
}
}
}
);
// let h=this.apiheader()
// this.request(
// {
// url: "",
// header: h,
// data: {
// r: "api/user/address",
// },
// },
(res) => { // (res) => {
uni.hideNavigationBarLoading(); // uni.hideNavigationBarLoading();
this.isloading = false; // this.isloading = false;
this.list = res.data.list; // this.list = res.data.list;
let index = -1; // let index = -1;
this.list.forEach((x, i) => { // this.list.forEach((x, i) => {
x.mobile = x.mobile.substr(0, 3) + "****" + x.mobile.substr(7); // x.mobile = x.mobile.substr(0, 3) + "****" + x.mobile.substr(7);
if (x.id == this.defaultId) { // if (x.id == this.defaultId) {
this.currentAddress = x; // this.currentAddress = x;
index = i; // index = i;
} // }
}); // });
if (index != -1) { // if (index != -1) {
this.list.splice(index, 1); // this.list.splice(index, 1);
} // }
} // }
); // );
}, },
}, },
}; };
......
This diff is collapsed.
This diff is collapsed.
...@@ -167,7 +167,7 @@ export default { ...@@ -167,7 +167,7 @@ export default {
this.showLoading = this.msg.pageIndex != 1; this.showLoading = this.msg.pageIndex != 1;
this.request2( this.request2(
{ {
url: '/api/AppletGoods/GetAppletGoodsPageList', url: '/api/AppletGoods/GetAppletGoodsPageListForZY',
data: this.msg data: this.msg
}, },
res => { res => {
......
This diff is collapsed.
<template>
<view>
<u-button @click="Pay">支付</u-button>
</view>
</template>
<script>
export default {
data() {
return {
payInfo:{},
}
},
created(){
this.getDataInfo();
},
methods: {
getDataInfo() {
let msg={
"OpenId":"ow_7I5XC1-RGwwk8QANBmWKYKmOc",
"OrderId":"1",
"OrderPayType":1,
"GoodsName":"测试商品名称"
}
this.request2(
{
url: '/api/WeChatPay/GetPayInfo',
data: msg
},
res => {
console.log("res",res);
if(res.resultCode==1){
this.payInfo=JSON.parse(res.data);
console.log("getDataInfo",this.payInfo);
}
uni.hideNavigationBarLoading();
}
);
},
Pay(){
let payInfo=this.payInfo;
uni.requestPayment({
provider: 'wxpay',
timeStamp: this.payInfo.timeStamp,
nonceStr: this.payInfo.nonceStr,
package: this.payInfo.package,
signType: this.payInfo.signType,
paySign: this.payInfo.sign,
success: function (res) {
console.log("success",res)
},
fail: function (err) {
console.log('fail:',err);
}
});
},
}
}
</script>
<style>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment