Commit 1b37178b authored by 王建威's avatar 王建威

白条转区

parent d59f1113
<script> <script>
export default { export default {
onLaunch: function() { onLaunch: function() {
console.log('App Launch')
}, },
onShow: function() { onShow: function() {
console.log('App Show')
}, },
onHide: function() { onHide: function() {
console.log('App Hide')
} }
} }
</script> </script>
......
import Vue from 'vue' import Vue from 'vue'
import App from './App' import App from './App'
Vue.config.productionTip = false Vue.config.productionTip = false
// 加入购物车
function addCart(spec_id, quantity) {
uni.request({
url: '/uni/api//credit_goods/add_cart',
method: 'post',
dataType: 'json',
data: {
spec_id: spec_id,
quantity: quantity
},
success: (res) => {
console.log(res)
}
})
}
(function() {
uni.request({
url: '/uni/api/application/is_login',
type:'get',
success: (res) => {
Vue.prototype.$isLogin = res.data.data;
}
});
})()
Vue.prototype.$addCart = addCart;
App.mpType = 'app' App.mpType = 'app'
......
...@@ -88,11 +88,11 @@ ...@@ -88,11 +88,11 @@
"port": 8080, "port": 8080,
"disableHostCheck": true, "disableHostCheck": true,
"proxy": { "proxy": {
"/api": { "/uni/api": {
"target": "http://192.168.50.133:6564/", "target": "http://192.168.50.133:6564/",
"changeOrigin": true, "changeOrigin": true,
"secure": false, "secure": false,
"pathRewrite":{"^/api":"api"} "pathRewrite":{"^/uni/api":"api"}
} }
} }
} }
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
<text>9个月账期</text> <text>9个月账期</text>
</view> </view>
<p class="price"> <p class="price">
<text></text>{{item.price}} <text>{{isLogin ? '¥' : ''}}</text>{{isLogin ? item.price : '登录显示价格'}}
</p> </p>
</view> </view>
<i class="cart_icon"></i> <i class="cart_icon" @click="addCart(item.spec_id, 1)"></i>
</view> </view>
<view class="pageBox"> <view class="pageBox">
<uni-pagination :total="page['total']" show-icon="true" @change="changePage"></uni-pagination> <uni-pagination :total="page['total']" show-icon="true" @change="changePage"></uni-pagination>
...@@ -46,10 +46,12 @@ ...@@ -46,10 +46,12 @@
firsr_cate_id: '', firsr_cate_id: '',
tabIndex: -1, tabIndex: -1,
params: {}, params: {},
keyword: '' keyword: '',
isLogin: 0
} }
}, },
onLoad(option) { onLoad(option) {
this.isLogin = this.$isLogin;
this.firsr_cate_id = option.cate_id_1; this.firsr_cate_id = option.cate_id_1;
option.current = Number(option.current); option.current = Number(option.current);
option.pageSize = Number(option.pageSize); option.pageSize = Number(option.pageSize);
...@@ -140,6 +142,9 @@ ...@@ -140,6 +142,9 @@
this.page = page; this.page = page;
} }
}); });
},
addCart(spec_id, quantity) {
this.$addCart(spec_id, quantity)
} }
} }
} }
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
<i class="search_icon" @click="search"></i> <i class="search_icon" @click="search"></i>
<input type="text" class="search_input" v-model="keyword" @confirm="search"> <input type="text" class="search_input" v-model="keyword" @confirm="search">
</view> </view>
<text class="login_btn" @click="jumpPhpPage('app=member&act=login')">登录</text> <text class="login_btn" @click="jumpPhpPage('app=member&act=login')" v-if="!isLogin">登录</text>
<uni-icons v-else type="person" size="30" @click="jumpPhpPage('app=member')"></uni-icons>
</view> </view>
<view class="flex tab_bar"> <view class="flex tab_bar">
<text :class="{act: tabIndex === 1}" @click="jumpPhpPage()">首页</text> <text :class="{act: tabIndex === 1}" @click="jumpPhpPage()">首页</text>
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
<view> <view>
<text class="text">白条商品</text> <text class="text">白条商品</text>
<i></i> <i></i>
<text class="text">信用支付 期无忧</text> <text class="text">信用支付 期无忧</text>
</view> </view>
<view class="flex classbox"> <view class="flex classbox">
<view class="class_item" v-for="(item, index) in credit_cates_list" :key="index" @click="jumpSecondPage(item.cate_id, 1, 10)"> <view class="class_item" v-for="(item, index) in credit_cates_list" :key="index" @click="jumpSecondPage(item.cate_id, 1, 10)">
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
<view class="part_three"> <view class="part_three">
<view class="part_three_top"> <view class="part_three_top">
<view> <view>
<p>谛宝多多 期无忧</p> <p>谛宝多多 期无忧</p>
<p>最高可享12期免息</p> <p>最高可享12期免息</p>
</view> </view>
<text class="go_detail" @click="jumpGoPage('/introduce')">查看详情<i class="go_credit_icon"></i></text> <text class="go_detail" @click="jumpGoPage('/introduce')">查看详情<i class="go_credit_icon"></i></text>
...@@ -72,8 +73,8 @@ ...@@ -72,8 +73,8 @@
</view> </view>
<text class="goods_des">{{val.goods_subname}}</text> <text class="goods_des">{{val.goods_subname}}</text>
<view class="price_view"> <view class="price_view">
<text>{{val.price}}</text> <text>{{isLogin ? `¥${val.price}` : '登录显示价格'}}</text>
<i></i> <i @click="addCart(val.spec_id, 1)"></i>
</view> </view>
</view> </view>
</view> </view>
...@@ -85,19 +86,27 @@ ...@@ -85,19 +86,27 @@
</template> </template>
<script> <script>
import { php, go } from '../../common/host.js'; import { php, go } from '../../common/host.js';
import uniIcons from "@/components/uni-icons/uni-icons.vue";
export default { export default {
data() { data() {
return { return {
tabIndex: 3, // 1:首页 2:精彩活动 3:谛宝白条 4:采购分期 tabIndex: 3, // 1:首页 2:精彩活动 3:谛宝白条 4:采购分期
credit_cates_list: [], // 分类 credit_cates_list: [], // 分类
credit_goods_list: [], // 商品 credit_goods_list: [], // 商品
user_name: '',
portrait: '',
current: 0, current: 0,
keyword: '' keyword: '',
isLogin: 0
} }
}, },
onLoad() { onLoad() {
this.isLogin = this.$isLogin;
this.getData(); this.getData();
},
components: {
uniIcons
}, },
methods: { methods: {
// changeTab(index) { // changeTab(index) {
...@@ -132,6 +141,9 @@ ...@@ -132,6 +141,9 @@
jumpGoPage(url) { jumpGoPage(url) {
let link = url ? `${go}${url}` : go; let link = url ? `${go}${url}` : go;
window.location.href = link; window.location.href = link;
},
addCart(spec_id, quantity) {
this.$addCart(spec_id, quantity)
} }
} }
}; };
......
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