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

白条转区

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