修复内容

1. 会员等级背景图去掉校验
	2. 当查询不到会员等级是,按无会员等级展示
	3. 删除商城首页冗余配置在index中的引用
	4. 换绑推广人时,计算上一个推广人的推广人数
	5. pc后台清除推广人时,更新推广人数量
	6. 保证砍价金额最小为0.01
	7. 修复商品删除时购物车关联删除
	8. 删除商品问题修复
	9. 运费模板——指定包邮,包邮数量类型修改
	10. 签到错误修复
	11. 修复我的优惠券只查询20条的问题
	12. 文章列表修复
	13. 拼团商品详情页数据统计显示问题修复
	14. PC后台,账户详情,持有优惠券列表修复
	15. 支付查询参数修复
	16. 修复过期优惠券可以重复领取
	17. 订单邮费切换地址重复计算修复
	18. 判断是否在指定包邮区域内 必须满足件数 + 金额 才能包邮
	19. 支付页面,切换tab,金额计算问题修复
	20. 物流模板新增、编辑——修复
	21. 去除线下邮费的影响
	22. 订单运费计算重写
	23. 下单页面到店自提合计金额不应该计算商品邮费
	24. 新人券领取后,部分使用时间为空——修复
This commit is contained in:
stivepeim
2021-03-19 18:26:43 +08:00
parent e289857849
commit f44c0ade12
292 changed files with 5985 additions and 41476 deletions

View File

@@ -3,8 +3,7 @@ ENV = 'development'
# base api
# VUE_APP_BASE_API = '/dev-api'
# VUE_APP_BASE_API = 'http://127.0.0.1:8080'
VUE_APP_BASE_API = 'http://127.0.0.1:8080'
VUE_APP_BASE_API = 'http://localhost:8080'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.

View File

@@ -3,5 +3,5 @@ ENV = 'production'
# base api
# VUE_APP_BASE_API = '/prod-api'
VUE_APP_BASE_API = 'http://127.0.0.1:8080'
VUE_APP_BASE_API = 'http://localhost:8080'

View File

@@ -1,5 +1,10 @@
module.exports = {
presets: [
'@vue/app'
['@vue/app',
{
'useBuiltIns': 'entry',
polyfills: ['es6.promise', 'es6.symbol']
}
]
]
}

View File

@@ -46,6 +46,7 @@
"@babel/parser": "^7.9.6",
"async-validator": "^1.11.2",
"axios": "0.18.1",
"babel-polyfill": "^6.26.0",
"clipboard": "2.0.4",
"codemirror": "5.45.0",
"core-js": "^2.6.11",

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -14,7 +14,6 @@ couponFrom.install = function(Vue, options) {
instance.$mount(document.createElement('div'))
document.body.appendChild(instance.$el)
Vue.prototype.$modalCoupon = function(handle, keyNum, coupons=[], callback, userIds='') {
console.log( userIds)
instance.visible = true
instance.handle = handle
instance.keyNum = keyNum

View File

@@ -1,5 +1,6 @@
import Vue from 'vue'
import '@babel/polyfill'
// import 'babel-polyfill'
import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
@@ -105,6 +106,10 @@ if (vconsole !== undefined && vconsole === md5Crmeb) {
new Module.default();
});
}
// 自定义实现String 类型的replaceAll方法
String.prototype.replaceAll = function(s1, s2) {
return this.replace(new RegExp(s1, "gm"), s2);
}
// Vue.prototype.$modalCoupon = modalCoupon
/**
* If you don't want to use mock-server
@@ -185,6 +190,10 @@ function newVue(attrs, main, html) {
}).$mount('#app')
}
String.prototype.replaceAll = function(s1, s2) {
return this.replace(new RegExp(s1, "gm"), s2);
}
new Vue({
el: '#app',
router,

View File

@@ -83,7 +83,19 @@ export function Mul(arg1, arg2) {
//替换安全域名
export function setDomain(url) {
url = url ? url.toString() : '';
//本地调试打开,生产请注销
if (url.indexOf("https://") > -1) return url;
else return url.replace('http://', 'https://');
// 正则替换存在的转义符
url = url.replace(/\\/g,'');
url = url.replace('http://','https://');
if(url.startsWith('src="')){
url = url.replaceAll('src="','');
}
if(url.startsWith('//img')){
url = url.replace('//img','https://img');
}
return url;
}
// 过滤富文本中的 img 相对路径访问
export function replaceImgSrcHttps(content) {
return content.replaceAll('src="//','src="https://');
}

View File

@@ -4,22 +4,17 @@ import store from '@/store'
import { getToken } from '@/utils/auth'
import SettingMer from '@/utils/settingMer'
import { isPhone } from "@/libs/wechat";
// create an axios instance
const service = axios.create({
baseURL: SettingMer.apiBaseURL, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
timeout: 20000 // request timeout
baseURL: SettingMer.apiBaseURL,
timeout: 20000 // 过期时间
})
// request interceptor
service.interceptors.request.use(
config => {
// do something before request is sent
// 发送请求之前做的
const token = !store.getters.token?sessionStorage.getItem('token'):store.getters.token;
if (token) {
// let each request carry token
// ['X-Token'] is a custom headers key
// please modify it according to the actual situationf
config.headers['Authori-zation'] = token
}
if(/get/i.test(config.method)){
@@ -29,7 +24,6 @@ service.interceptors.request.use(
return config
},
error => {
// do something with request error
return Promise.reject(error)
}
)

View File

@@ -7,7 +7,6 @@ export default {// 设置选中的方法
// 如果总记忆中还没有选择的数据,那么就直接取当前页选中的数据,不需要后面一系列计算
if (multipleSelectionAll.length <= 0) {
multipleSelectionAll=multipleSelection
console.log(multipleSelectionAll)
successFn(multipleSelectionAll)
return
}
@@ -23,8 +22,6 @@ export default {// 设置选中的方法
// 如果总选择里面不包含当前页选中的数据,那么就加入到总选择集合里
if (selectAllIds.indexOf(row[idKey]) < 0) {
multipleSelectionAll.push(row)
console.log(multipleSelectionAll)
// successFn(multipleSelectionAll)
}
})
const noSelectIds = []
@@ -40,8 +37,6 @@ export default {// 设置选中的方法
if (multipleSelectionAll[i][idKey] == uid) {
// 如果总选择中有未被选中的,那么就删除这条
multipleSelectionAll.splice(i, 1)
console.log(multipleSelectionAll)
//successFn(multipleSelectionAll)
break
}
}

View File

@@ -26,6 +26,7 @@
:visible.sync="editDataConfig.visible"
append-to-body
destroy-on-close
width="700px"
>
<edit
v-if="editDataConfig.visible"

View File

@@ -1,6 +1,6 @@
<template>
<div>
<el-form ref="selfForm" :model="selfForm" label-width="100px">
<el-form ref="selfForm" :model="selfForm" label-width="120px">
<el-form-item label="排序" prop="sort" :rules="[{ required: true, message:'排序不能为空', trigger:['blur','change'] }]">
<el-input-number v-model="selfForm.sort" />
</el-form-item>
@@ -11,8 +11,7 @@
>
<el-switch
v-model="selfForm.status"
active-color="#13ce66"
inactive-color="#ff4949"
/>
</el-form-item>
</el-form>

View File

@@ -1,869 +0,0 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-steps :active="currentTab" align-center finish-status="success">
<el-step title="选择秒杀商品" />
<el-step title="填写基础信息" />
<el-step title="修改商品详情" />
</el-steps>
</div>
<el-form
ref="formValidate"
v-loading="fullscreenLoading"
class="formValidate mt20"
:rules="ruleValidate"
:model="formValidate"
label-width="150px"
@submit.native.prevent
>
<!-- 砍价商品-->
<div v-show="currentTab === 0">
<el-form-item label="选择商品:" prop="image">
<div class="upLoadPicBox" @click="changeGood">
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont"/>
</div>
</div>
</el-form-item>
</div>
<!-- 商品信息-->
<div v-show="currentTab === 1">
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="商品主图:" prop="image">
<div class="upLoadPicBox" @click="modalPicTap('1')">
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品轮播图:" prop="images">
<div class="acea-row">
<div
v-for="(item,index) in formValidate.imagess"
:key="index"
class="pictrue"
draggable="true"
@dragstart="handleDragStart($event, item)"
@dragover.prevent="handleDragOver($event, item)"
@dragenter="handleDragEnter($event, item)"
@dragend="handleDragEnd($event, item)"
>
<img :src="item">
<i class="el-icon-error btndel" @click="handleRemove(index)" />
</div>
<div v-if="formValidate.imagess.length<10" class="upLoadPicBox" @click="modalPicTap('2')">
<div class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="砍价活动名称:" prop="title">
<el-input v-model="formValidate.title" placeholder="请输入商品名称" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="砍价活动简介:">
<el-input v-model="formValidate.info" maxlength="250" type="textarea" :rows="3" placeholder="请输入商品简介" />
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="单位:" prop="unitName">
<el-input v-model="formValidate.unitName" placeholder="请输入单位" class="selWidthd"/>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="排序:" prop="sort">
<el-input v-model="formValidate.sort" placeholder="请输入排序" class="selWidthd"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动时间:">
<el-date-picker
class="mr20"
v-model="timeVal"
type="daterange"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="onchangeTime">
</el-date-picker>
<span>设置活动开启结束时间用户可以在设置时间内发起参与砍价</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="砍价人数:" prop="peopleNum">
<el-input-number v-model="formValidate.peopleNum" :min="1" :step="1" step-strictly step-strictly placeholder="请输入砍价人数" class="selWidthd mr20"/>
<span>需邀请多少人砍价成功</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="帮砍次数:" prop="bargainNum">
<el-input-number v-model="formValidate.bargainNum" :min="1" :step="1" step-strictly placeholder="请输入帮砍次数" class="selWidthd mr20"/>
<span>单个商品用户可以帮砍的次数次数设置为1甲和乙同时将商品A的砍价链接发给丙丙只能帮甲或乙其中一个人砍价</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="购买数量限制:" prop="num">
<el-input-number v-model="formValidate.num" :min="1" :step="1" step-strictly placeholder="请输入购买数量限制" class="selWidthd mr20"/>
<span>单个活动每个用户发起砍价次数限制</span>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="运费模板:" prop="tempId">
<div class="acea-row">
<el-select v-model="formValidate.tempId" placeholder="请选择" class="selWidthd">
<el-option
v-for="item in shippingList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<!--<el-button class="mr15" @click="addTem">添加运费模板</el-button>-->
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动状态:" required>
<el-radio-group v-model="formValidate.status">
<el-radio :label="0" class="radio">关闭</el-radio>
<el-radio :label="1">开启</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- 规格表格-->
<el-col :span="24">
<el-form-item label="商品属性:" class="labeltop" required>
<el-table
ref="multipleTable"
:data="formValidate.ManyAttrValue"
tooltip-effect="dark"
style="width: 100%">
<el-table-column label="选择" min-width="60">
<template slot-scope="scope">
<el-radio v-model="radio" :label="scope.row"
@change.native="changeType(scope.row)"
>&nbsp;
</el-radio>
</template>
</el-table-column>
<template v-if="manyTabDate && formValidate.specType">
<el-table-column v-for="(item,iii) in manyTabDate" :key="iii" align="center" :label="manyTabTit[iii].title" min-width="80">
<template slot-scope="scope">
<span class="priceBox" v-text="scope.row[iii]" />
</template>
</el-table-column>
</template>
<el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope">
<div class="upLoadPicBox" @click="modalPicTap('1','duo',scope.$index)">
<div v-if="scope.row.image" class="pictrue tabPic"><img :src="scope.row.image"></div>
<div v-else class="upLoad tabPic">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</template>
</el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="140">
<template slot-scope="{row,$index}">
<template v-if="formThead[iii].title === '砍价起始金额'">
<el-form-item
:prop="`multipleSelection.${$index}.price`"
:rules="ruleValidate.price"
class="inpBox"
>
<el-input-number
size="small"
v-model="row[iii]"
:min="0"
:precision="2" :step="0.1"
class="priceBox"
/>
</el-form-item>
</template>
<template v-else-if="formThead[iii].title === '砍价最低价'">
<el-form-item
:prop="`ManyAttrValue.${$index}.minPrice`"
:rules="ruleValidate.minPrice"
class="inpBox"
>
<el-input-number
size="small"
v-model="row[iii]"
:min="0"
:max="parseFloat(row.price)"
:precision="2" :step="0.1"
class="priceBox"
/>
</el-form-item>
</template>
<template v-else-if="formThead[iii].title === '限量'">
<el-form-item
:prop="`ManyAttrValue.${$index}.quota`"
:rules="ruleValidate.quota"
class="inpBox"
>
<el-input-number
size="small"
v-model="row[iii]"
type="number"
:min="1"
:max="row.stock"
:step="1" step-strictly
class="priceBox"
@change="inpChange(row[iii], row.id)"
/>
</el-form-item>
</template>
<span v-else v-text="row[iii]" class="priceBox" />
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
</el-row>
</div>
<!-- 商品详情-->
<div v-show="currentTab === 2">
<el-form-item label="商品详情:">
<ueditor-from v-model="formValidate.content" :content="formValidate.content" />
</el-form-item>
<el-form-item label="商品规则:">
<ueditor-from v-model="formValidate.rule" :content="formValidate.rule" />
</el-form-item>
</div>
<el-form-item style="margin-top:30px;">
<el-button
v-show="(!$route.params.id && currentTab > 0) || ($route.params.id && currentTab===2)"
type="primary"
class="submission"
size="small"
@click="handleSubmitUp"
>上一步</el-button>
<el-button
v-show="currentTab == 0"
type="primary"
class="submission"
size="small"
@click="handleSubmitNest1('formValidate')"
>下一步</el-button>
<el-button
v-show="currentTab == 1"
type="primary"
class="submission"
size="small"
@click="handleSubmitNest2('formValidate')"
>下一步</el-button>
<el-button
v-show="currentTab===2"
:loading="loading"
type="primary"
class="submission"
size="small"
@click="handleSubmit('formValidate')"
>提交</el-button>
</el-form-item>
</el-form>
</el-card>
<CreatTemplates ref="addTemplates" @getList="getShippingList" />
</div>
</template>
<script>
import { productDetailApi, categoryApi } from '@/api/store'
import { shippingTemplatesList } from '@/api/logistics'
import { getSeckillList } from '@/libs/public'
import { bargainSaveApi, bargainUpdateApi, bargainInfoApi } from '@/api/marketing'
import CreatTemplates from '@/views/systemSetting/logistics/shippingTemplates/creatTemplates'
const defaultObj = {
image: '',
images: '',
imagess: [],
title: '',
info: '',
num: 1,
unitName: '',
sort: 0,
giveIntegral: 0,
ficti: 0,
isShow: false,
tempId: '',
attrValue: [{
image: '',
price: 0,
minPrice: 0,
cost: 0,
otPrice: 0,
stock: 0,
quota: 1,
weight: 0,
volume: 0,
barCode: ''
}],
attr: [],
selectRule: '',
content: '',
specType: false,
id: 0,
// productId: 0,
timeId: '',
startTime: '',
stopTime: '',
timeVal: [],
status: 0,
rule: '',
ManyAttrValue: [{
image: '',
price: 0,
minPrice: 0,
cost: 0,
otPrice: 0,
stock: 0,
quota: 1,
weight: 0,
volume: 0,
barCode: ''
}], // 多规格
multipleSelection: [{
image: '',
price: 0,
minPrice: 0,
cost: 0,
otPrice: 0,
stock: 0,
quota: 1,
weight: 0,
volume: 0,
barCode: ''
}]
}
const objTitle = {
price: {
title: '砍价起始金额'
},
minPrice: {
title: '砍价最低价'
},
cost: {
title: '成本价'
},
otPrice: {
title: '原价'
},
stock: {
title: '库存'
},
quota: {
title: "限量",
},
weight: {
title: '重量KG'
},
volume: {
title: '体积(m³)'
},
barCode: {
title: '商品编号'
}
}
export default {
name: "creatSeckill",
components: { CreatTemplates },
data() {
return {
props2: {
children: 'child',
label: 'name',
value: 'id',
multiple: true,
emitPath: false
},
grid2: {
xl: 8,
lg: 10,
md: 12,
sm: 24,
xs: 24
},
currentTab: 0,
formThead: Object.assign({}, objTitle),
formValidate: {},
loading: false,
fullscreenLoading: false,
merCateList: [], // 商户分类筛选
shippingList: [], // 运费模板
seckillTime: [],
ruleValidate: {
productId: [
{ required: true, message: '请选择商品', trigger: 'change' }
],
title: [
{ required: true, message: '请输入商品标题', trigger: 'blur' }
],
attrValue: [
{ required: true, message: '请选择商品属相', trigger: 'change', type: 'array', min: '1' }
],
num: [
{ required: true, message: '请输入购买数量限制', trigger: 'blur' }
],
unitName: [
{ required: true, message: '请输入单位', trigger: 'blur' }
],
info: [
{ required: true, message: '请输入秒杀商品简介', trigger: 'blur' }
],
tempId: [
{ required: true, message: '请选择运费模板', trigger: 'change' }
],
timeId: [
{ required: true, message: '请选择活动时间', trigger: 'change' }
],
image: [
{ required: true, message: '请上传商品图', trigger: 'change' }
],
imagess: [
{ required: true, message: '请上传商品轮播图', type: 'array', trigger: 'change' }
],
specType: [
{ required: true, message: '请选择商品规格', trigger: 'change' }
],
timeVal:[
{ required: true, message: '请选择活动日期', trigger: 'change', type: 'array'}
],
bargainNum:[
{ required: true, message: '请输入帮砍次数', trigger: 'blur'}
],
peopleNum: [
{ required: true, message: '请输入砍价人数', trigger: 'blur'}
],
price: [
{ required: true, message: '请输入砍价起始金额', trigger: 'blur'}
],
minPrice: [
{ required: true, message: '请输入砍价最低金额', trigger: 'blur'}
],
quota: [
{ required: true, message: '请输入限量', trigger: 'blur'}
]
},
manyTabDate: {},
manyTabTit: {},
attrInfo: {},
tempRoute: {},
multipleSelection: [Object.assign({}, defaultObj.attrValue[0])],
productId: 0,
timeVal: [],
radio: '',
ManyAttrValue: [Object.assign({}, defaultObj.attrValue[0])], // 多规格
}
},
computed: {
attrValue() {
const obj = Object.assign({}, defaultObj.attrValue[0])
delete obj.image
return obj
}
},
created() {
this.$watch('formValidate.attr', this.watCh)
this.tempRoute = Object.assign({}, this.$route)
},
mounted() {
getSeckillList(1).then((res) => {
this.seckillTime = res.list
})
this.formValidate.imagess = []
if ( this.$route.params.id ) {
this.setTagsViewTitle()
this.getInfo()
this.currentTab = 1
}
this.getShippingList()
this.getCategorySelect()
},
methods: {
changeType(row, index){
row.checked = true;
this.formValidate.multipleSelection = [row];
},
inpChange(currentValue, id){
// this.ManyAttrValue.map(item => {
// if(!currentValue && item.id ===id){
// item.quota = 1
// this.$set(item, 'quota', 1)
// this.ManyAttrValue = Object.assign([], this.ManyAttrValue)
// }
// })
console.log(this.ManyAttrValue)
// if(!currentValue) item.quota = 1
},
watCh(val) {
const tmp = {}
const tmpTab = {}
this.formValidate.attr.forEach((o, i) => {
tmp['value' + i] = { title: o.attrName }
tmpTab['value' + i] = ''
})
this.manyTabTit = tmp
this.manyTabDate = tmpTab
this.formThead = Object.assign({}, this.formThead, tmp)
},
handleRemove (i) {
this.formValidate.imagess.splice(i, 1)
},
// 点击商品图
modalPicTap (tit, num, i) {
const _this = this
this.$modalUpload(function(img) {
if(tit==='1'&& !num){
_this.formValidate.image = img[0].sattDir
_this.formValidate.ManyAttrValue[0].image = img[0].sattDir
}
if(tit==='2'&& !num){
if(img.length>10) return this.$message.warning("最多选择10张图片");
if(img.length + _this.formValidate.imagess.length > 10) return this.$message.warning("最多选择10张图片");
img.map((item) => {
_this.formValidate.imagess.push(item.sattDir)
});
}
if(tit==='1'&& num === 'duo' ){
_this.specType ? _this.formValidate.ManyAttrValue[i].image = img[0].sattDir : _this.formValidate.ManyAttrValue[0].image = img[0].sattDir
}
},tit, 'content')
},
// 具体日期
onchangeTime(e) {
this.formValidate.timeVal = e;
this.formValidate.startTime = e ? e[0] : "";
this.formValidate.stopTime = e ? e[1] : "";
},
changeGood(){
const _this = this
this.$modalGoodList(function(row) {
_this.formValidate.image = row.image
_this.productId = row.id
// _this.formValidate.productId = row.id
})
},
handleSubmitNest1() {
if (!this.formValidate.image) {
this.$message.warning("请选择商品!");
return;
} else {
this.currentTab++;
if (!this.$route.params.id) this.getProdect(this.productId);
}
},
// 商品分类;
getCategorySelect() {
categoryApi({ status: -1, type: 1 }).then(res => {
this.merCateList = this.filerMerCateList(res)
})
},
filerMerCateList(treeData) {
return treeData.map((item) => {
if(!item.child){
item.disabled = true
}
item.label = item.name
return item
})
},
// 运费模板;
getShippingList() {
shippingTemplatesList(this.tempData).then(res => {
this.shippingList = res.list
})
},
// 运费模板
addTem() {
this.$refs.addTemplates.dialogVisible = true
this.$refs.addTemplates.getCityList()
},
// 商品详情
getInfo () {
if(!this.$route.params.id){
this.getProdect(this.productId)
}else{
this.getSekllProdect(this.$route.params.id)
}
},
getProdect(id) {
this.fullscreenLoading = true
productDetailApi(id).then(async res => {
let info = res
this.formValidate = info;
this.formValidate.imagess = JSON.parse(info.sliderImage);
this.formValidate.title = info.storeName;
this.formValidate.proName = info.storeName;
this.formValidate.info = info.storeInfo;
this.formValidate.productId = info.id;
this.formValidate.timeId = this.$route.params.id ? Number(info.timeId) : this.$route.params.timeId ? Number(this.$route.params.timeId) : '';
this.formValidate.startTime = info.startTime || '';
this.formValidate.stopTime = info.stopTime || '';
this.formValidate.timeVal = [];
this.formValidate.status = 0;
this.formValidate.num = 1;
this.formValidate.rule = '';
this.formValidate.peopleNum = 1;
this.formValidate.bargainNum = 1;
if(info.specType){
info.attrValues.forEach((row) => {
row.quota = row.stock;
});
this.formValidate.ManyAttrValue = info.attrValues
this.multipleSelection = info.attrValues
}else{
info.attrValue.forEach((row) => {
row.quota = row.stock;
});
this.formValidate.ManyAttrValue = info.attrValue
this.radio = info.attrValue[0]
this.formValidate.attr = []
}
this.fullscreenLoading = false
}).catch(res => {
this.fullscreenLoading = false
})
},
getSekllProdect(id) {
this.fullscreenLoading = true
bargainInfoApi({id:id}).then(async res => {
let info = res;
this.formValidate = info;
this.formValidate.proName = info.title;
this.formValidate.imagess = JSON.parse(info.sliderImage);
this.formValidate.timeId = Number(info.timeId);
this.timeVal = info.startTime && info.stopTime ? [info.startTime, info.stopTime] : []
if(info.specType){
this.formValidate.ManyAttrValue = info.attrValues;
this.$nextTick(() => {
this.formValidate.ManyAttrValue.forEach((item, index) => {
if (item.checked) {
this.$set(item, 'price', item.price)
this.$set(item, 'quota', item.quota)
this.radio = item
}
})
});
}else{
this.formValidate.ManyAttrValue = info.attrValue;
this.formValidate.attr = [];
this.radio = info.attrValue[0];
}
this.fullscreenLoading = false
}).catch(res => {
this.fullscreenLoading = false
})
},
handleSubmitNest2(name) {
this.$refs[name].validate((valid) => {
if (valid) {
if(this.formValidate.specType && this.multipleSelection.length ===0 ) return this.$message.warning("请选择至少一个商品属性!");
return this.$message.warning("请填写完整信息!");
this.currentTab++;
// this.multipleSelection.every((value, index) => {
// if(!value.quota){
// this.$message.warning("请填选择至少一个商品属性!");
// return false;
// }else{
// this.currentTab++;
// return true;
// }
// });
// for(i = 0; i < this.multipleSelection.length; i++){
// if(!this.multipleSelection[i].quota){
// break;
// }else{
// this.currentTab++;
// }
// }
} else {
return false;
}
});
},
// 提交
handleSubmit(name) {
if(!this.formValidate.specType){
this.formValidate.attr = []
this.formValidate.attrValue = this.formValidate.ManyAttrValue
}else{
this.formValidate.attrValue = this.multipleSelection
}
this.formValidate.images = JSON.stringify(this.formValidate.imagess)
this.$refs[name].validate((valid) => {
if (valid) {
this.fullscreenLoading = true;
this.loading = true;
this.$route.params.id
? bargainUpdateApi({id: this.$route.params.id}, this.formValidate)
.then(async () => {
this.fullscreenLoading = false;
this.$message.success('编辑成功');
this.$router.push({
path: "/marketing/bargain/bargainGoods",
});
this.$refs[name].resetFields();
this.formValidate.images = [];
this.loading = false;
})
.catch(() => {
this.fullscreenLoading = false;
this.loading = false;
})
: bargainSaveApi(this.formValidate)
.then(async (res) => {
this.fullscreenLoading = false;
this.$message.success('新增成功');
this.$router.push({
path: "/marketing/bargain/bargainGoods",
});
this.$refs[name].resetFields();
this.formValidate.images = [];
this.loading = false;
})
.catch(() => {
this.fullscreenLoading = false;
this.loading = false;
});
} else {
if (
!this.formValidate.storeName ||
!this.formValidate.unitName ||
!this.formValidate.store_info ||
!this.formValidate.image ||
!this.formValidate.images
) {
this.$message.warning("请填写完整商品信息!");
}
}
});
},
handleSubmitUp() {
if (this.currentTab-- < 0) this.currentTab = 0;
},
setTagsViewTitle() {
const title = '编辑秒杀商品'
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.$route.params.id}` })
this.$store.dispatch('tagsView/updateVisitedView', route)
},
}
}
</script>
<style scoped lang="scss">
.inpBox{
/deep/.el-form-item__error {
line-height: 20px !important;
position: static !important;
}
}
.labeltop{
/deep/.el-input-number--small{
/*width: 172px !important;*/
min-width: 132px !important;
}
}
.proCoupon{
/deep/.el-form-item__content{
margin-top: 5px;
}
}
.tabPic{
width: 40px !important;
height: 40px !important;
img{
width: 100%;
height: 100%;
}
}
.noLeft{
/deep/.el-form-item__content{
margin-left: 0 !important;
}
}
.tabNumWidth{
/deep/.el-input-number--medium{
width: 121px !important;
}
/deep/.el-input-number__increase{
width: 20px !important;
font-size: 12px !important;
}
/deep/.el-input-number__decrease{
width: 20px !important;
font-size: 12px !important;
}
/deep/.el-input-number--medium .el-input__inner {
padding-left: 25px !important;
padding-right: 25px !important;
}
/deep/ thead{
line-height: normal !important;
}
/deep/ .el-table .cell{
line-height: normal !important;
}
}
.selWidth{
width: 80%;
}
.selWidthd{
width: 350px;
}
.button-new-tag {
height: 28px;
line-height: 26px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.pictrue{
width: 60px;
height: 60px;
border: 1px dotted rgba(0,0,0,0.1);
margin-right: 10px;
position: relative;
cursor: pointer;
img{
width: 100%;
height: 100%;
}
}
.btndel{
position: absolute;
z-index: 1;
width :20px !important;
height: 20px !important;
left: 46px;
top: -4px;
}
.labeltop{
/deep/.el-form-item__label{
/*float: none !important;*/
/*display: inline-block !important;*/
/*margin-left: 120px !important;*/
/*width: auto !important;*/
}
}
</style>

View File

@@ -204,7 +204,6 @@
:max="row.stock"
:step="1" step-strictly
class="priceBox"
@change="inpChange(row[iii], row.id)"
/>
<span v-else v-text="row[iii]" class="priceBox" />
</template>
@@ -451,18 +450,6 @@
row.checked = true;
this.multipleSelection = [row];
},
inpChange(currentValue, id){
// this.ManyAttrValue.map(item => {
// if(!currentValue && item.id ===id){
// item.quota = 1
// this.$set(item, 'quota', 1)
// this.ManyAttrValue = Object.assign([], this.ManyAttrValue)
// }
// })
console.log(this.ManyAttrValue)
// if(!currentValue) item.quota = 1
},
watCh(val) {
const tmp = {}
const tmpTab = {}
@@ -508,7 +495,6 @@
this.$modalGoodList(function(row) {
_this.formValidate.image = row.image
_this.productId = row.id
// _this.formValidate.productId = row.id
})
},
handleSubmitNest1() {
@@ -516,8 +502,8 @@
this.$message.warning("请选择商品!");
return;
} else {
this.currentTab++;
if (!this.$route.params.id) this.getProdect(this.productId);
this.currentTab++;
if (!this.$route.params.id) this.getProdect(this.productId);
}
},
// 商品分类;
@@ -664,6 +650,9 @@
if(!this.radio.price) return this.$message.warning("请填写砍价起始金额!");
if(!this.radio.minPrice && this.radio.minPrice!=0) return this.$message.warning("请填写砍价最低价!");
if(!this.radio.quota) return this.$message.warning("请填写限量!");
// 砍价起始金额 >= 砍价人数*0.01 + 砍价最低价
let nums = this.formValidate.peopleNum * 0.01 + this.radio.minPrice
if(this.radio.price < nums) return this.$message.warning(`砍价起始金额不能小于${nums}`);
}
this.currentTab++;
} else {

View File

@@ -468,7 +468,6 @@
},
handleRemove (i) {
this.formValidate.imagelist.splice(i, 1)
// this.imagelist=[...this.imagelist];
},
// 点击商品图
modalPicTap (tit, num, i) {
@@ -502,7 +501,6 @@
this.$modalGoodList(function(row) {
_this.formValidate.image = row.image
_this.productId = row.id
// _this.formValidate.productId = row.id
})
},
handleSubmitNest1() {
@@ -550,7 +548,6 @@
getProdect(id) {
this.fullscreenLoading = true
productDetailApi(id).then(async res => {
//this.formValidate = res;
this.formValidate = {
image: this.$selfUtil.setDomain(res.image),
imagelist: JSON.parse(res.sliderImage),
@@ -608,7 +605,6 @@
getSekllProdect(id) {
this.fullscreenLoading = true
combinationInfoApi({id:id}).then(async res => {
//this.formValidate = res;
this.formValidate = {
image: this.$selfUtil.setDomain(res.image),
imagelist: JSON.parse(res.sliderImage),
@@ -665,23 +661,6 @@
if (valid) {
if(this.formValidate.specType && this.multipleSelection.length ===0 ) return this.$message.warning("请选择至少一个商品属性!");
this.currentTab++;
// this.multipleSelection.every((value, index) => {
// if(!value.quota){
// this.$message.warning("请填选择至少一个商品属性!");
// return false;
// }else{
// this.currentTab++;
// return true;
// }
// });
// for(i = 0; i < this.multipleSelection.length; i++){
// if(!this.multipleSelection[i].quota){
// break;
// }else{
// this.currentTab++;
// }
// }
} else {
return false;
}

View File

@@ -34,7 +34,7 @@
label="ID"
min-width="50"
/>
<el-table-column label="拼图片" min-width="80">
<el-table-column label="拼图片" min-width="80">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image

View File

@@ -280,7 +280,6 @@
content: '',
specType: false,
id: 0,
// productId: 0,
timeId: '',
startTime: '',
stopTime: '',
@@ -620,23 +619,6 @@
if (valid) {
if(this.formValidate.specType && this.multipleSelection.length ===0 ) return this.$message.warning("请填选择至少一个商品属性!");
this.currentTab++;
// this.multipleSelection.every((value, index) => {
// if(!value.quota){
// this.$message.warning("请填选择至少一个商品属性!");
// return false;
// }else{
// this.currentTab++;
// return true;
// }
// });
// for(i = 0; i < this.multipleSelection.length; i++){
// if(!this.multipleSelection[i].quota){
// break;
// }else{
// this.currentTab++;
// }
// }
} else {
return false;
}

View File

@@ -85,14 +85,12 @@
scanType: ["qrCode", "barCode"]
})
.then(res => {
console.log('openQRCode',res)
if (res.resultStr) {
that.verify_code = res.resultStr;
that.storeCancellation();
} else that.$dialog.error("没有扫描到什么!");
})
.catch(res => {
console.log('catch', res)
if (res.is_ready) {
res.wx.scanQRCode({
needResult: 1,

View File

@@ -226,7 +226,7 @@ export default {
tableFrom: {
page: 1,
limit: 20,
status: '',
status: '3',
type: 'sms'
},
columns2: [],
@@ -299,13 +299,10 @@ export default {
},
watch: {
sms (n) {
console.log(n)
if (n.open === 1) this.getList();
}
},
mounted() {
console.log(this.isChecked)
console.log(this.sms.open)
if (this.sms.open === 1) this.getList();
// if (this.isChecked === '1' && this.sms.open === 1) this.getList();
},

View File

@@ -254,12 +254,12 @@
<template v-if="formValidate.isSub">
<el-table-column align="center" label="一级返佣(元)" min-width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.brokerage" type="number" :min="0" class="priceBox" />
<el-input v-model="scope.row.brokerage" type="number" :min="0" :max="scope.row.price" class="priceBox" />
</template>
</el-table-column>
<el-table-column align="center" label="二级返佣(元)" min-width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.brokerageTwo" type="number" :min="0" class="priceBox" />
<el-input v-model="scope.row.brokerageTwo" type="number" :min="0" :max="scope.row.price" class="priceBox" />
</template>
</el-table-column>
</template>
@@ -331,12 +331,12 @@
</el-table-column>
<el-table-column align="center" label="一级返佣(元)" min-width="120" v-if="formValidate.isSub">
<template slot-scope="scope">
<el-input v-model="scope.row.brokerage" type="number" :min="0" class="priceBox" />
<el-input v-model="scope.row.brokerage" type="number" :min="0" :max="scope.row.price" class="priceBox" />
</template>
</el-table-column>
<el-table-column align="center" label="二级返佣(元)" min-width="120" v-if="formValidate.isSub">
<template slot-scope="scope">
<el-input v-model="scope.row.brokerageTwo" type="number" :min="0" class="priceBox" />
<el-input v-model="scope.row.brokerageTwo" type="number" :min="0" :max="scope.row.price" class="priceBox" />
</template>
</el-table-column>
<el-table-column key="3" align="center" label="操作" min-width="80">
@@ -880,11 +880,10 @@
isHot: info.isHot,
isBest: info.isBest,
tempId: info.tempId,
// attrValue: info.attrValue,
attr: info.attr,
selectRule: info.selectRule,
isSub: info.isSub,
content: info.content,
content: this.$selfUtil.replaceImgSrcHttps(info.content),
specType: info.specType,
id: info.id,
giveIntegral: info.giveIntegral,
@@ -909,8 +908,7 @@
this.formValidate.attr = info.attr.map(item => {
return {
attrName : item.attrName,
attrValue: item.attrValues.split(','),
// inputVisible: false
attrValue: item.attrValues.split(',')
}
})
this.ManyAttrValue = info.attrValues;

View File

@@ -119,7 +119,7 @@
<el-table-column label="操作" min-width="150" fixed="right" align="center">
<template slot-scope="scope">
<router-link :to="{path: '/store/list/creatProduct/' + scope.row.id}">
<el-button type="text" size="small" class="mr10">编辑</el-button>
<el-button type="text" size="small" class="mr10" v-if="tableFrom.type !== '5'">编辑</el-button>
</router-link>
<el-button v-if="tableFrom.type === '5'" type="text" size="small" @click="handleRestore(scope.row.id, scope.$index)">恢复商品</el-button>
<el-button type="text" size="small" @click="handleDelete(scope.row.id, tableFrom.type)">{{ tableFrom.type === '5' ? '删除' : '加入回收站' }}</el-button>

View File

@@ -7,7 +7,6 @@
<script>
import categoryList from '@/components/Category/list'
export default {
// name: "list",
components: { categoryList },
data() {
return {

View File

@@ -156,10 +156,10 @@
this.pics.splice(i, 1)
},
submitForm(formName) {
this.loadingbtn = true;
this.formValidate.pics = this.pics.length>0 ? JSON.stringify(this.pics) : ''
this.$refs[formName].validate((valid) => {
if (valid) {
this.loadingbtn = true;
replyCreatApi(this.formValidate).then(() => {
this.$message.success("新增成功")
setTimeout(() => {

View File

@@ -484,7 +484,7 @@
attr: info.attr || [],
selectRule: info.selectRule,
isSub: false,
content: info.content,
content: this.$selfUtil.replaceImgSrcHttps(info.content),
specType: info.attr.length ? true : false,
id: info.id,
giveIntegral: info.giveIntegral,

View File

@@ -20,9 +20,6 @@ export default {
mounted() {
},
methods: {
handleTreeCheckChange(data, checked, indateminate) {
console.log(data, checked, indateminate)
},
categoryAdd(pram) {
const _pram = {
extra: pram.extra,

View File

@@ -35,24 +35,32 @@
/>
</template>
</el-table-column>
<el-table-column min-width="130px" align="center" :label="columns.title">
<template slot-scope="{row}">
<el-input-number v-model="row.first" controls-position="right" :min="1" />
<el-table-column min-width="130px" align="center" :label="columns.title" prop="first">
<template scope="scope">
<el-form-item :rules="rules.first" :prop="'region.'+scope.$index+'.first'">
<el-input-number v-model="scope.row.first" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
</el-form-item>
</template>
</el-table-column>
<el-table-column min-width="120px" align="center" label="运费(元)">
<template slot-scope="{row}">
<el-input-number v-model="row.firstPrice" controls-position="right" />
<el-table-column min-width="120px" align="center" label="运费(元)" prop="firstPrice">
<template scope="scope">
<el-form-item :rules="rules.firstPrice" :prop="'region.'+scope.$index+'.firstPrice'">
<el-input-number v-model="scope.row.firstPrice" controls-position="right" />
</el-form-item>
</template>
</el-table-column>
<el-table-column min-width="120px" align="center" :label="columns.title2">
<template slot-scope="{row}">
<el-input-number v-model="row.renewal" controls-position="right" />
<el-table-column min-width="120px" align="center" :label="columns.title2" prop="renewal">
<template scope="scope">
<el-form-item :rules="rules.renewal" :prop="'region.'+scope.$index+'.renewal'">
<el-input-number v-model="scope.row.renewal" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
</el-form-item>
</template>
</el-table-column>
<el-table-column class-name="status-col" align="center" label="续费(元)" min-width="120">
<template slot-scope="{row}">
<el-input-number v-model="row.renewalPrice" controls-position="right" />
<el-table-column class-name="status-col" align="center" label="续费(元)" min-width="120" prop="renewalPrice">
<template scope="scope">
<el-form-item :rules="rules.renewalPrice" :prop="'region.'+scope.$index+'.renewalPrice'">
<el-input-number v-model="scope.row.renewalPrice" controls-position="right" />
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="操作" min-width="80">
@@ -96,7 +104,7 @@
</el-table-column>
<el-table-column min-width="180px" align="center" :label="columns.title3">
<template slot-scope="{row}">
<el-input-number v-model="row.number" controls-position="right" />
<el-input-number v-model="row.number" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
</template>
</el-table-column>
<el-table-column min-width="120px" align="center" label="包邮金额(元)">
@@ -151,7 +159,7 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="onClose('ruleForm')"> </el-button>
<el-button type="primary" @click="onsubmit('ruleForm')"> </el-button>
<el-button type="primary" :loading="loading" @click="onsubmit('ruleForm')"> </el-button>
</span>
</el-dialog>
</template>
@@ -165,10 +173,10 @@ const defaultRole = {
appoint: false,
sort: 0,
region: [{
first: 1,
firstPrice: 1,
renewal: 1,
renewalPrice: 1,
first: 0,
firstPrice: 0,
renewal: 0,
renewalPrice: 0,
city_ids: []
}],
undelivery: 0,
@@ -201,6 +209,7 @@ export default {
},
data() {
return {
loading : false,
rules: {
name: [
{ required: true, message: '请输入模板名称', trigger: 'blur' }
@@ -222,6 +231,18 @@ export default {
],
city_id3: [
{ type: 'array', required: true, message: '请至少选择一个地区', trigger: 'change' }
],
first: [
{ required: true, message: '请输入', trigger: 'blur' }
],
renewal: [
{ required: true, message: '请输入', trigger: 'blur' }
],
firstPrice: [
{ required: true, message: '请输入运费', trigger: 'blur' }
],
renewalPrice: [
{ required: true, message: '请输入续费', trigger: 'blur' }
]
},
nodeKey: 'city_id',
@@ -259,7 +280,7 @@ export default {
},
popoverHide() {},
handleClose() {
this.$refs['ruleForm'].resetFields()
// this.$refs['ruleForm'].resetFields()
this.dialogVisible = false
this.ruleForm={
name: '',
@@ -267,10 +288,10 @@ export default {
appoint: false,
sort: 0,
region: [{
first: 1,
firstPrice: 1,
renewal: 1,
renewalPrice: 1,
first: 0,
firstPrice: 0,
renewal: 0,
renewalPrice: 0,
city_ids: []
}],
undelivery: 0,
@@ -281,7 +302,6 @@ export default {
},
changeRegion(value) {
console.log(value)
// console.integralLog(value)
},
changeRadio(num) {
this.columns = Object.assign({}, statusMap[num - 1])
@@ -289,10 +309,10 @@ export default {
// 添加配送区域
addRegion(region) {
region.push(Object.assign({}, {
first: 1,
firstPrice: 1,
renewal: 1,
renewalPrice: 1,
first: 0,
firstPrice: 0,
renewal: 0,
renewalPrice: 0,
city_ids: []
}))
},
@@ -322,6 +342,7 @@ export default {
appoint: info.appoint,
sort: info.sort
})
this.columns = Object.assign({}, statusMap[this.ruleForm.type - 1])
this.$nextTick(() => {
loadingInstance.close()
})
@@ -395,6 +416,7 @@ export default {
onsubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.loading = true;
const param = {
appoint: this.ruleForm.appoint,
name: this.ruleForm.name,
@@ -434,28 +456,26 @@ export default {
if (this.type === 0) {
logistics.shippingSave(param).then(res => {
this.$message.success('操作成功')
this.handleClose()
this.$nextTick(() => {
this.dialogVisible = false
this.$refs[formName].resetFields()
this.clear()
})
setTimeout(() => {
this.$emit('getList')
}, 600)
this.loading = false;
})
} else {
logistics.shippingUpdate(param, { id: this.tempId }).then(res => {
this.$message.success('操作成功')
setTimeout(() => {
this.$emit('getList')
this.$refs[formName].resetFields()
this.clear()
this.handleClose()
}, 600)
this.$nextTick(() => {
this.dialogVisible = false
this.$refs[formName].resetFields()
})
this.loading = false;
})
}
} else {

View File

@@ -25,14 +25,14 @@
</div>
</div>
</el-form-item>
<el-form-item label="用户背景" required prop="image">
<div class="upLoadPicBox" @click="modalPicTap('1', 'image')">
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</el-form-item>
<!--<el-form-item label="用户背景" required prop="image">-->
<!--<div class="upLoadPicBox" @click="modalPicTap('1', 'image')">-->
<!--<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>-->
<!--<div v-else class="upLoad">-->
<!--<i class="el-icon-camera cameraIconfont" />-->
<!--</div>-->
<!--</div>-->
<!--</el-form-item>-->
<el-form-item label="是否显示" required>
<el-radio-group v-model="formValidate.isShow">
<el-radio :label="true" class="radio">显示</el-radio>

View File

@@ -164,7 +164,7 @@
</el-form>
</div>
<el-button class="mr10" size="small" @click="onSend">发送优惠券</el-button>
<el-button v-show="loginType === 'wechat'" size="mini" class="mr10" @click="sendNews">发送文章</el-button>
<!--<el-button v-show="loginType === 'wechat'" size="mini" class="mr10" @click="sendNews">发送文章</el-button>-->
<el-button class="mr10" size="small" @click="setBatch('group')">批量设置分组</el-button>
<el-button class="mr10" size="small" @click="setBatch('label')">批量设置标签</el-button>
</div>

View File

@@ -25,6 +25,7 @@ module.exports = {
* In most cases please use '/' !!!
* Detail: https://cli.vuejs.org/config/#publicpath
*/
transpileDependencies: ['element-ui', 'vuex', 'js-cookie', '@babel', 'resize-detector'],
publicPath: '/',
outputDir: 'dist',
assetsDir: 'static',

24
app/.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
build.sh
.idea
unpackage

View File

@@ -0,0 +1,11 @@
{ // launch.json 配置了启动调试时相关设置configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数remote代表前端连云端云函数
"version": "0.0",
"configurations": [{
"type": "uniCloud",
"default": {
"launchtype": "remote"
}
}
]
}

View File

@@ -1,13 +1,8 @@
<!-- <template>
<view>
<iframe ref="geoPage" width="0" height="0" frameborder="0" style="display:none;"
scrolling="no" src="https://java.crmeb.net">
</iframe>
</view>
</template> -->
<script>
import { checkLogin } from "./libs/login";
import { HTTP_REQUEST_URL } from './config/app';
import Auth from './libs/wechat.js';
import Routine from './libs/routine.js';
export default {
globalData: {
@@ -28,16 +23,16 @@
switch (option.scene) {
//扫描小程序码
case 1047:
let val = that.$util.getUrlParams(decodeURIComponent(option.query.scene));
that.globalData.code = val.pid;
// let val = that.$util.getUrlParams(decodeURIComponent(option.query.scene));
that.globalData.spid = option.query.scene;
break;
//长按图片识别小程序码
case 1048:
that.globalData.code = option.query.scene;
that.globalData.spid = option.query.scene;
break;
//手机相册选取小程序码
case 1049:
that.globalData.code = option.query.scene;
that.globalData.spid = option.query.scene;
break;
//直接进入小程序
case 1001:
@@ -52,9 +47,100 @@
that.globalData.navHeight = res.statusBarHeight * (750 / res.windowWidth) + 91;
}
});
// #ifdef H5
let snsapiBase = 'snsapi_base';
let urlData = location.pathname + location.search;
if (!that.$store.getters.isLogin && Auth.isWeixin()) {
const { code, state, scope } = option.query;
if (code && location.pathname.indexOf('/pages/users/wechat_login/index') === -1) {
// 存储静默授权code
uni.setStorageSync('snsapiCode', code);
let spread = that.globalData.spid ? that.globalData.spid : 0;
Auth.auth(code, that.$Cache.get('spread'))
.then(res => {
uni.setStorageSync('snRouter', decodeURIComponent(decodeURIComponent(option.query.back_url)));
if (res.type === 'register') {
this.$Cache.set('snsapiKey', res.key);
}
if(res.type === 'login'){
// let time = res.data.expires_time - this.$Cache.time();
this.$store.commit('LOGIN', {
token: res.token,
// time: time
});
// this.$store.commit('SETUID', res.data.userInfo.uid);
// this.$store.commit('UPDATE_USERINFO', res.data.userInfo);
//location.replace(decodeURIComponent(decodeURIComponent(option.query.back_url)));
}
})
.catch(error => {
this.$util.Tips({
title: error
});
});
} else {
if (!this.$Cache.has('snsapiKey')) {
console.log('app.vue页面中',location.pathname.indexOf('/pages/users/wechat_login/index') === -1)
//Auth.oAuth(snsapiBase, urlData);
if (location.pathname.indexOf('/pages/users/wechat_login/index') === -1) {
Auth.oAuth(snsapiBase, urlData);
}
}
}
} else {
if (option.query.back_url) {
location.replace(uni.getStorageSync('snRouter'));
}
}
// #endif
// #ifdef MP
// 小程序静默授权
if (!this.$store.getters.isLogin) {
let spread = that.globalData.spid ? that.globalData.spid : 0;
Routine.getCode()
.then(code => {
Routine.authUserInfo(code,{'spread_spid': spread}).then(res => {
that.$store.commit('AuthorizeType', res.data.type);
})
})
.catch(res => {
uni.hideLoading();
});
}
// #endif
},
mounted() {
},
methods: {
// 小程序静默授权
silenceAuth(code) {
let that = this;
let spread = that.globalData.spid ? that.globalData.spid : 0;
silenceAuth({
code: code,
spread_spid: spread,
spread_code: that.globalData.code
})
.then(res => {
if (res.data.token !== undefined && res.data.token) {
uni.hideLoading();
let time = res.data.expires_time - this.$Cache.time();
that.$store.commit('LOGIN', {
token: res.data.token,
time: time
});
that.$store.commit('SETUID', res.data.userInfo.uid);
that.$store.commit('UPDATE_USERINFO', res.data.userInfo);
}
})
.catch(res => {
console.log(res);
});
}
},
onShow: function() {
// #ifdef H5
uni.getSystemInfo({

View File

@@ -171,11 +171,19 @@ export function switchH5Login() {
// #endif
/**
* 绑手机号
* 绑手机号
*
*/
export function bindingPhone(data){
return request.post('binding',data);
return request.post('update/binding',data);
}
/**
* 换绑手机号校验
*
*/
export function bindingVerify(data){
return request.post('update/binding/verify',data);
}
/**

View File

@@ -1,6 +1,9 @@
import request from "@/utils/request.js";
import wechat from "@/libs/wechat.js";
import {
toLogin,
checkLogin
} from '../libs/login';
/**
* 获取微信公众号js配置
* @returns {*}
@@ -84,4 +87,25 @@ export function copyWords() {
*/
export function kefuConfig() {
return request.get("config", {}, { noAuth: true });
}
/**
* 微信(公众号,小程序)绑定手机号
* @param {Object} data
*/
export function getUserPhone(data){
return request.post('wechat/register/binding/phone',data,{noAuth : true});
}
/**
* 静默授权
* @param {Object} data
*/
export function silenceAuth(data) {
//#ifdef MP
return request.get("wechat/authorize/program/login", data, { noAuth : true });
//#endif
//#ifdef H5
return request.get("wechat/authorize/login", data, { noAuth : true });
//#endif
}

View File

@@ -365,7 +365,7 @@ export function getChatRecord(to_uid, data) {
*/
export function spread(puid)
{
return request.post("user/spread",{puid:puid});
return request.get("user/bindSpread?spreadPid=" + puid);
}
/**

View File

@@ -112,7 +112,7 @@
return;
}
getLogo().then(res=>{
that.logoUrl = res.data.logo_url
that.logoUrl = res.data.logoUrl
Cache.set(LOGO_URL,that.logoUrl);
})
},

View File

@@ -3,11 +3,11 @@
<text class="red" v-if="tipText">{{ tipText }}</text>
<text class="styleAll" v-if="isDay === true">{{ day }}</text>
<text class="timeTxt red" v-if="dayText">{{ dayText }}</text>
<text class="styleAll">{{ hour }}</text>
<text class="styleAll" :class='isCol?"timeCol":""'>{{ hour }}</text>
<text class="timeTxt red" v-if="hourText">{{ hourText }}</text>
<text class="styleAll">{{ minute }}</text>
<text class="styleAll" :class='isCol?"timeCol":""'>{{ minute }}</text>
<text class="timeTxt red" v-if="minuteText">{{ minuteText }}</text>
<text class="styleAll">{{ second }}</text>
<text class="styleAll" :class='isCol?"timeCol":""'>{{ second }}</text>
<text class="timeTxt red" v-if="secondText">{{ secondText }}</text>
</view>
</template>
@@ -48,6 +48,10 @@
isDay: {
type: Boolean,
default: true
},
isCol: {
type: Boolean,
default: false
}
},
data: function() {
@@ -68,7 +72,7 @@
function runTime() {
//时间函数
let intDiff = that.datatime - Date.parse(new Date())/1000; //获取数据中的时间戳的时间差;
let intDiff = that.datatime - Date.parse(new Date()) / 1000; //获取数据中的时间戳的时间差;
let day = 0,
hour = 0,
minute = 0,
@@ -109,12 +113,24 @@
</script>
<style>
.time{
.time {
display: flex;
justify-content: center;
}
.red{
}
.red {
color: #fc4141;
margin: 0 4rpx;
}
.timeCol {
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
text-align:center;
border-radius: 6px;
background: #fff;
font-size: 24rpx;
color: #E93323;
}
</style>

View File

@@ -5,7 +5,7 @@
<view class='coupon-list' v-if="coupon.list.length">
<view class='item acea-row row-center-wrapper' v-for="(item,index) in coupon.list" @click="getCouponUser(index,item.id)" :key='index'>
<view class='money acea-row row-column row-center-wrapper' :class='item.isUse?"moneyGray":""'>
<view><text class='num'>{{item.money}}</text></view>
<view><text class='num'>{{item.money?Number(item.money):''}}</text></view>
<view class="pic-num">{{item.minPrice}}元可用</view>
</view>
<view class='text'>

View File

@@ -3,7 +3,7 @@
<view class='coupon-window' :class='window==true?"on":""'>
<view class='couponWinList'>
<view class='item acea-row row-between-wrapper' v-for="(item,index) in couponList" :key="index">
<view class='money font-color'><text class='num'>{{item.money}}</text></view>
<view class='money font-color'><text class='num'>{{ item.money?Number(item.money):'' }}</text></view>
<view class='text'>
<view class='name'>购物买{{item.minPrice}}{{item.money}}</view>
<view v-if="item.day>0">领取后{{item.day}}天内可用</view>

View File

@@ -0,0 +1,239 @@
<template>
<view v-if="isUp">
<view class="mobile-bg" @click="close"></view>
<view class="mobile-mask animated" :class="{slideInUp:isUp}">
<view class="input-item">
<input type="text" v-model="account" placeholder="输入手机号" />
</view>
<view class="input-item">
<input type="text" v-model="codeNum" placeholder="输入验证码" />
<button class="code" :disabled="disabled" @click="code">{{text}}</button>
</view>
<view class="sub_btn" @click="loginBtn">立即登录</view>
</view>
</view>
</template>
<script>
const app = getApp();
import sendVerifyCode from "@/mixins/SendVerifyCode";
import Routine from '@/libs/routine';
import {
loginMobile,
registerVerify,
getCodeApi,
getUserInfo,
phoneSilenceAuth,
phoneWxSilenceAuth
} from "@/api/user";
import { bindingPhone } from '@/api/api.js'
import { getUserPhone } from '@/api/public';
export default{
name:'login_mobile',
props:{
isUp:{
type:Boolean,
default:false,
},
authKey:{
type:String,
default:'',
}
},
data(){
return {
keyCode:'',
account:'',
codeNum:''
}
},
mixins: [sendVerifyCode],
mounted() {
//this.getCode();
},
methods:{
// 获取验证码
async code() {
let that = this;
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
await registerVerify(that.account).then(res=>{
that.$util.Tips({title:res.msg});
that.sendCode();
}).catch(err=>{
return that.$util.Tips({
title:err
})
})
},
// 获取验证码api
getCode() {
let that = this
getCodeApi().then(res => {
that.keyCode = res.data.key;
}).catch(res => {
that.$util.Tips({
title: res
});
});
},
close(){
this.$emit('close',false)
},
// 登录
loginBtn(){
let that = this
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (!that.codeNum) return that.$util.Tips({
title: '请填写验证码'
});
if (!/^[\w\d]+$/i.test(that.codeNum)) return that.$util.Tips({
title: '请输入正确的验证码'
});
uni.showLoading({ title: '正在登录中' });
getUserPhone({
captcha: that.codeNum,
phone: that.account,
spid: app.globalData.spid,
spread: app.globalData.code,
type: 'public',
key: this.authKey
}).then(res=>{
let time = res.data.expires_time - this.$Cache.time();
this.$store.commit('LOGIN', {
token: res.data.token,
time: time
});
this.getUserInfo();
}).catch(error=>{
uni.hideLoading()
this.$util.Tips({
title:error
})
})
},
// #ifdef MP
phoneSilenceAuth(code){
let self = this
phoneSilenceAuth({
code:code,
spid: app.globalData.spid,
spread: app.globalData.code,
phone:this.account,
captcha:this.codeNum
}).then(res=>{
let time = res.data.expires_time - this.$Cache.time();
this.$store.commit('LOGIN', {
token: res.data.token,
time: time
});
this.getUserInfo();
}).catch(error=>{
self.$util.Tips({
title:error
})
})
},
// #endif
/**
* 获取个人用户信息
*/
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
uni.hideLoading();
that.userInfo = res.data
that.$store.commit("SETUID", res.data.uid);
that.$store.commit("UPDATE_USERINFO", res.data);
// #ifdef MP
that.$util.Tips({
title:'登录成功',
icon:'success'
},{
tab:3
})
that.close()
// #endif
// #ifdef H5
that.$emit('wechatPhone',true)
// #endif
});
},
}
}
</script>
<style lang="stylus">
.mobile-bg{
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
}
.mobile-mask {
z-index: 20;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
padding: 67rpx 30rpx;
background: #fff;
.input-item{
display: flex;
justify-content: space-between;
width: 100%;
height: 86rpx;
margin-bottom: 38rpx;
input{
flex: 1;
display: block;
height: 100%;
padding-left: 40rpx;
border-radius: 43rpx;
border: 1px solid #DCDCDC;
}
.code{
display: flex;
align-items: center;
justify-content: center;
width: 220rpx;
height: 86rpx;
margin-left: 30rpx;
background: rgba(233, 51, 35, 0.05);
font-size: 28rpx;
color: #E93323;
border-radius: 43rpx;
&[disabled]{
background: rgba(0, 0, 0, 0.05);
color: #999;
}
}
}
.sub_btn{
width: 690rpx;
height: 86rpx;
line-height: 86rpx;
margin-top: 60rpx;
background: #E93323;
border-radius: 43rpx;
color: #fff;
font-size: 28rpx;
text-align: center;
}
}
.animated{
animation-duration:.4s
}
</style>

View File

@@ -0,0 +1,163 @@
<template>
<view v-if="isPhoneBox">
<view class="mobile-bg" @click="close"></view>
<view class="mobile-mask animated" :class="{slideInUp:isUp}">
<view class="info-box">
<image :src="logoUrl"></image>
<view class="title">获取授权</view>
<view class="txt">获取微信的手机号授权</view>
</view>
<button class="sub_btn" open-type="getPhoneNumber" @getphonenumber="getphonenumber">获取微信手机号</button>
</view>
</view>
</template>
<script>
const app = getApp();
import Routine from '@/libs/routine';
import {
loginMobile,
registerVerify,
getCodeApi,
getUserInfo
} from "@/api/user";
import { getLogo, silenceAuth, getUserPhone } from '@/api/public';
export default{
name:'routine_phone',
props:{
isPhoneBox:{
type:Boolean,
default:false,
},
logoUrl:{
type:String,
default:'',
},
authKey:{
type:String,
default:'',
}
},
data(){
return {
keyCode:'',
account:'',
codeNum:'',
isStatus:false
}
},
mounted() {
},
methods:{
// #ifdef MP
// 小程序获取手机号码
getphonenumber(e){
console.log(e)
uni.showLoading({ title: '加载中' });
Routine.getCode()
.then(code => {
this.getUserPhoneNumber(e.detail.encryptedData, e.detail.iv, code);
})
.catch(error => {
uni.hideLoading();
});
},
// 小程序获取手机号码回调
getUserPhoneNumber(encryptedData, iv, code) {
getUserPhone({
encryptedData: encryptedData,
iv: iv,
code: code,
spid: app.globalData.spid,
spread: app.globalData.code,
key:this.authKey,
type: 'routine'
})
.then(res => {
let time = res.data.expires_time - this.$Cache.time();
this.$store.commit('LOGIN', {
token: res.data.token,
time: time
});
this.getUserInfo();
})
.catch(res => {
console.log(res);
uni.hideLoading();
});
},
/**
* 获取个人用户信息
*/
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
uni.hideLoading();
that.userInfo = res.data
that.$store.commit("SETUID", res.data.uid);
that.$store.commit("UPDATE_USERINFO", res.data);
that.isStatus = true
this.close()
});
},
// #endif
close(){
this.$emit('close',{isStatus:this.isStatus})
}
}
}
</script>
<style lang="scss">
.mobile-bg{
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
}
.mobile-mask {
z-index: 20;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
padding: 67rpx 30rpx;
background: #fff;
.info-box{
display:flex;
flex-direction: column;
align-items: center;
justify-content: center;
image{
width: 150rpx;
height: 150rpx;
border-radius: 10rpx;
}
.title{
margin-top: 30rpx;
margin-bottom: 20rpx;
font-size: 36rpx;
}
.txt{
font-size: 30rpx;
color: #868686;
}
}
.sub_btn{
width: 690rpx;
height: 86rpx;
line-height: 86rpx;
margin-top: 60rpx;
background: #E93323;
border-radius: 43rpx;
color: #fff;
font-size: 28rpx;
text-align: center;
}
}
.animated{
animation-duration:.4s
}
</style>

View File

@@ -83,7 +83,7 @@
index:index
}
this.parentEmit(obj)
// this.$parent.currentTab = index //设置swiper的第几页
this.$parent.currentTab = index //设置swiper的第几页
},
// 导航子类点击
childTab(tabClick,index){

View File

@@ -1,5 +1,6 @@
import store from "../store";
import Cache from '../utils/cache';
import { Debounce } from '@/utils/validate.js'
// #ifdef H5 || APP-PLUS
import { isWeixin } from "../utils";
import auth from './wechat';
@@ -10,31 +11,74 @@ import { LOGIN_STATUS, USER_INFO, EXPIRES_TIME, STATE_R_KEY} from './../config/c
function prePage(){
let pages = getCurrentPages();
let prePage = pages[pages.length - 1];
// #ifndef APP-PLUS
return prePage.route;
// #endif
// #ifdef APP-PLUS
return prePage.$page.fullPath;
// #endif
}
export function toLogin(push, pathLogin) {
export const toLogin = Debounce(_toLogin,800)
export function _toLogin(push, pathLogin) {
store.commit("LOGOUT");
let path = prePage();
// #ifdef H5
path = location.href;
// path = location.href;
path = location.pathname + location.search;
// #endif
if(!pathLogin)
pathLogin = '/page/users/login/index'
Cache.set('login_back_url',path);
// #ifdef H5 || APP-PLUS
// #ifdef H5
if (isWeixin()) {
auth.oAuth();
} else {
if (path !== pathLogin) {
push ? uni.navigateTo({
url:'/pages/users/login/index'
}) : uni.reLaunch({
url: '/pages/users/login/index'
});
// auth.oAuth();
let urlData = location.pathname + location.search
if (urlData.indexOf('?') !== -1) {
urlData += '&go_longin=1';
} else {
urlData += '?go_longin=1';
}
console.log('ppppp',Cache.has('snsapiKey'))
if (Cache.has('snsapiKey')) {
uni.navigateTo({
url: '/pages/users/wechat_login/index',
});
}
// if (!Cache.has('snsapiKey')) {
// auth.oAuth('snsapi_base', urlData);
// } else {
// uni.navigateTo({
// url: '/pages/users/wechat_login/index',
// });
// }
} else {
uni.navigateTo({
url: '/pages/users/login/index'
})
// if (path !== pathLogin) {
// push ? uni.navigateTo({
// url:'/pages/users/login/index'
// }) : uni.reLaunch({
// url: '/pages/users/login/index'
// });
// }
}
// #endif
// #ifdef MP
uni.navigateTo({
url: '/pages/users/wechat_login/index'
})
// #endif
// #ifdef APP-PLUS
uni.navigateTo({
url: '/pages/users/login/index'
})
// #endif
}

View File

@@ -3,7 +3,6 @@ import { checkLogin } from './login';
import { login } from '../api/public';
import Cache from '../utils/cache';
import { STATE_R_KEY, USER_INFO, EXPIRES_TIME, LOGIN_STATUS} from './../config/cache';
class Routine
{
@@ -65,9 +64,6 @@ class Routine
async getCode(){
let provider = await this.getProvider();
return new Promise((resolve,reject)=>{
if(Cache.has(STATE_R_KEY)){
return resolve(Cache.get(STATE_R_KEY));
}
uni.login({
provider:provider,
success(res) {
@@ -122,14 +118,18 @@ class Routine
authUserInfo(code,data)
{
console.log('code:',code);
console.log('data:',data);
return new Promise((resolve, reject)=>{
login(code,data).then(res=>{
// let time = res.data.expiresTime - Cache.time();
store.commit('UPDATE_USERINFO', res.data.user);
store.commit('LOGIN', {token:res.data.token});
store.commit('SETUID', res.data.user.uid);
// Cache.set(EXPIRES_TIME,res.data.expiresTime,time);
Cache.set(USER_INFO,res.data.user);
if(res.data.type==='login'){
// let time = res.data.expiresTime - Cache.time();
store.commit('UPDATE_USERINFO', res.data.user);
store.commit('LOGIN', {token:res.data.token});
store.commit('SETUID', res.data.user.uid);
// Cache.set(EXPIRES_TIME,res.data.expiresTime,time);
Cache.set(USER_INFO,res.data.user);
}
return resolve(res);
}).catch(res=>{
return reject(res);

View File

@@ -153,12 +153,37 @@ class AuthWechat {
/**
* 自动去授权
*/
oAuth() {
if (uni.getStorageSync(WX_AUTH) && store.state.app.token) return;
oAuth(snsapiBase,url) {
if (uni.getStorageSync(WX_AUTH) && store.state.app.token && snsapiBase == 'snsapi_base') return;
const {
code
} = parseQuery();
if (!code) return this.toAuth();
if (!code || code == uni.getStorageSync('snsapiCode')){
return this.toAuth(snsapiBase,url);
}else{
if(Cache.has('snsapiKey'))
return this.auth(code).catch(error=>{
uni.showToast({
title:error,
icon:'none'
})
})
}
// if (uni.getStorageSync(WX_AUTH) && store.state.app.token) return;
// const {
// code
// } = parseQuery();
// if (!code){
// return this.toAuth(snsapiBase,url);
// }else{
// if(Cache.has('snsapiKey'))
// return this.auth(code).catch(error=>{
// uni.showToast({
// title:error,
// icon:'none'
// })
// })
// }
}
clearAuthStatus() {
@@ -188,7 +213,7 @@ class AuthWechat {
Cache.clear(STATE_KEY);
// Cache.clear('spread');
loginType && Cache.clear(LOGINTYPE);
resolve();
resolve(data);
})
.catch(reject);
});
@@ -198,32 +223,42 @@ class AuthWechat {
* 获取跳转授权后的地址
* @param {Object} appId
*/
getAuthUrl(appId) {
const redirect_uri = encodeURIComponent(
`${location.origin}/pages/auth/index?back_url=` +
encodeURIComponent(
encodeURIComponent(
uni.getStorageSync(BACK_URL) ?
uni.getStorageSync(BACK_URL) :
location.pathname + location.search
)
)
);
uni.removeStorageSync(BACK_URL);
const state = encodeURIComponent(
("" + Math.random()).split(".")[1] + "authorizestate"
);
uni.setStorageSync(STATE_KEY, state);
return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
}
getAuthUrl(appId,snsapiBase,backUrl) {
let url = `${location.origin}${backUrl}`
if(url.indexOf('?') == -1){
url = url+'?'
}else{
url = url+'&'
}
const redirect_uri = encodeURIComponent(
`${url}scope=${snsapiBase}&back_url=` +
encodeURIComponent(
encodeURIComponent(
uni.getStorageSync(BACK_URL) ?
uni.getStorageSync(BACK_URL) :
location.pathname + location.search
)
)
);
uni.removeStorageSync(BACK_URL);
const state = encodeURIComponent(
("" + Math.random()).split(".")[1] + "authorizestate"
);
uni.setStorageSync(STATE_KEY, state);
if(snsapiBase==='snsapi_base'){
return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=${state}#wechat_redirect`;
}else{
return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
}
}
/**
* 跳转自动登录
*/
toAuth() {
toAuth(snsapiBase,backUrl) {
let that = this;
this.wechat().then(wx => {
location.href = this.getAuthUrl(that.initConfig.appId);
location.href = this.getAuthUrl(that.initConfig.appId,snsapiBase,backUrl);
})
}

View File

@@ -46,7 +46,7 @@ if (vconsole !== undefined && vconsole === md5Crmeb) {
let vConsole = new VConsole();
}
Auth.isWeixin() && Auth.oAuth();
// Auth.isWeixin() && Auth.oAuth();
// #endif

View File

@@ -360,6 +360,13 @@
"style": {
"navigationBarTitleText": "商品评价"
}
},
{
"path": "wechat_login/index",
"style": {
"navigationBarTitleText": "账户登录",
"navigationStyle": "custom"
}
}
]
},

View File

@@ -1,7 +1,9 @@
<template>
<view>
<view class='bargain-list'>
<!-- #ifndef APP-PLUS -->
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow"></view>
<!-- #endif -->
<view class='header'></view>
<view class='list'>
<block v-for="(item,index) in bargainList" :key="index">
@@ -23,7 +25,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -72,6 +74,17 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserInfo();
this.getBargainList();
}
},
deep:true
}
},
onLoad: function(options) {
var pages = getCurrentPages();
this.returnShow = pages.length===1?false:true;
@@ -83,13 +96,7 @@
this.getUserInfo();
this.getBargainList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@@ -2,7 +2,10 @@
<view>
<view :style="'height:'+systemH+'px'"></view>
<view class='bargain'>
<!-- #ifndef APP-PLUS -->
<view class='iconfont icon-xiangzuo' v-if='retunTop' @tap='goBack' :style="'top:'+navH+'px'"></view>
<!-- #endif -->
<view class="header" :class="bargainUid != userInfo.uid ? 'on' : ''">
<view class='people' >
<!-- :style="'top:'+navH/2+'rpx'" -->
@@ -202,12 +205,26 @@
</view>
<view class='mask' catchtouchmove="true" v-show='active==true' @tap='close'></view>
</view>
<!-- 分享按钮 -->
<view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
<!-- #ifdef APP-PLUS -->
<view class="item" @click="appShare('WXSceneSession')">
<view class="iconfont icon-weixin3"></view>
<view class="">微信好友</view>
</view>
<view class="item" @click="appShare('WXSenceTimeline')">
<view class="iconfont icon-pengyouquan"></view>
<view class="">微信朋友圈</view>
</view>
<!-- #endif -->
</view>
<!-- 发送给朋友图片 -->
<view class="share-box" v-if="H5ShareBox">
<image src="/static/images/share-info.png" @click="H5ShareBox = false"></image>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -243,6 +260,12 @@
import home from '@/components/home';
import parser from "@/components/jyf-parser/jyf-parser";
import { silenceBindingSpread } from "@/utils";
// #ifdef APP-PLUS
import {
TOKENNAME,
HTTP_REQUEST_URL
} from '@/config/app.js';
// #endif
const app = getApp();
export default {
@@ -307,6 +330,17 @@
},
computed: mapGetters(['isLogin']),
watch: {
isLogin: {
handler: function(newV, oldV) {
if (newV) {
this.getBargainDetails();
this.addShareBargain();
}
},
deep: true
}
},
/**
* 生命周期函数--监听页面加载
*/
@@ -357,13 +391,7 @@
// '&spid=' + e.detail.uid;
// this.$set(that, 'bargainPartake', e.detail.uid);
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
@@ -373,6 +401,39 @@
})
},
methods: {
// app分享
// #ifdef APP-PLUS
appShare(scene) {
let that = this
console.log(HTTP_REQUEST_URL)
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
let curRoute = routes[routes.length - 1].$page.fullPath // 获取当前页面路由,也就是最后一个打开的页面路由
uni.share({
provider: "weixin",
scene: scene,
type: 0,
href: `${HTTP_REQUEST_URL}${curRoute}`,
title: that.bargainInfo.title,
imageUrl: that.bargainInfo.image,
success: function(res) {
uni.showToast({
title: '分享成功',
icon: 'success'
})
that.posters = false;
},
fail: function(err) {
uni.showToast({
title: '分享失败',
icon: 'none',
duration: 2000
})
that.posters = false;
}
});
},
// #endif
openTap() {
this.$set(this,'couponsHidden',!this.couponsHidden);
},
@@ -485,6 +546,7 @@
},
currentBargainUser: function() { //当前用户砍价
this.$set(this, 'bargainUid', this.userInfo.uid);
this.page = 1;
this.setBargain();
},
setBargain: function() { //参与砍价
@@ -557,14 +619,6 @@
that.$set(that, 'bargainUserHelpList', bargainUserHelpList);
that.$set(that, 'limitStatus', datas.limit > len);
that.$set(that, 'page', that.page + 1);
// var bargainUserHelpListNew = [];
// var bargainUserHelpList = that.bargainUserHelpList;
// var len = res.data.list.length;
// bargainUserHelpListNew = bargainUserHelpList.concat(res.data.list);
// that.$set(that, 'bargainUserHelpList', res.data.list);
// that.$set(that, 'limitStatus', datas.limit > len);
// that.$set(that, 'page', (Number(datas.page) + Number(datas.limit)));
});
},
getBargainUserBargainPricePoster: function() {
@@ -641,7 +695,6 @@
configTimeline
)
.then(res => {
console.log(res);
})
.catch(res => {
if (res.is_ready) {
@@ -718,6 +771,38 @@
page {
background-color: #e93323 !important;
}
.generate-posters {
width: 100%;
height: 170rpx;
background-color: #fff;
position: fixed;
left: 0;
bottom: 0;
z-index: 300;
transform: translate3d(0, 100%, 0);
transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
border-top: 1rpx solid #eee;
}
.generate-posters.on {
transform: translate3d(0, 0, 0);
}
.generate-posters .item {
flex: 1;
text-align: center;
font-size: 30rpx;
}
.generate-posters .item .iconfont {
font-size: 80rpx;
color: #5eae72;
}
.generate-posters .item .iconfont.icon-haibao {
color: #5391f1;
}
.bargain .bargainGang .open {
font-size: 24rpx;
color: #999;
@@ -797,7 +882,7 @@
font-size: 20rpx;
position: absolute;
width: 85%;
/* #ifdef MP */
/* #ifdef MP || APP-PLUS */
height: 44px;
line-height: 44px;
/* #endif */

View File

File diff suppressed because one or more lines are too long

View File

@@ -39,22 +39,24 @@
</div>
<!-- #ifdef H5 -->
<div v-if="userBool === 1 && isOk == 0 && pinkBool === 0">
<div class="teamBnt bg-color-red" v-if="$wechat.isWeixin()" @click="H5ShareBox = true">邀请好友参团</div>
<div class="teamBnt bg-color-red" v-else @click="goPoster">邀请好友参团</div>
<div class="teamBnt bg-color-red" v-if="$wechat.isWeixin() && pinkT.stopTime>timestamp" @click="H5ShareBox = true">邀请好友参团</div>
<div class="teamBnt bg-color-red" v-if='!$wechat.isWeixin() && pinkT.stopTime>timestamp' @click="goPoster">邀请好友参团</div>
</div>
<!-- <div class="teamBnt bg-color-red" v-if="userBool === 1 && isOk == 0 && pinkBool === 0" @click="goPoster">
邀请好友参团
</div> -->
<!-- #endif -->
<!-- #ifdef MP -->
<button open-type="share" class="teamBnt bg-color-red" v-if="userBool === 1 && isOk == 0 && pinkBool === 0">邀请好友参团</button>
<button open-type="share" class="teamBnt bg-color-red" v-if="userBool === 1 && isOk == 0 && pinkBool === 0 && pinkT.stopTime>timestamp">邀请好友参团</button>
<!-- #endif -->
<div class="teamBnt bg-color-red" v-else-if="userBool === 0 && pinkBool === 0 && count > 0" @click="pay">我要参团</div>
<div class="teamBnt bg-color-hui" v-if="pinkT.stopTime<timestamp && isOk == 0 && pinkBool === 0">拼团已过期</div>
<div class="teamBnt bg-color-red" v-else-if="userBool === 0 && pinkBool === 0 && count > 0 && pinkT.stopTime>timestamp" @click="pay">我要参团</div>
<div class="teamBnt bg-color-red" v-if="pinkBool === 1 || pinkBool === -1" @click="goDetail(storeCombination.id)">再次开团</div>
<div class="cancel" @click="getCombinationRemove" v-if="pinkBool === 0 && userBool === 1">
<span class="iconfont icon-guanbi3"></span>
取消开团
</div>
<div class="lookOrder" v-if="pinkBool === 1" @click="goOrder">
查看订单信息
<span class="iconfont icon-xiangyou"></span>
@@ -93,10 +95,10 @@
<!-- 发送给朋友图片 -->
<view class="share-box" v-if="H5ShareBox"><image src="/static/images/share-info.png" @click="H5ShareBox = false"></image></view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<!-- <Product-window v-on:changeFun="changeFun" :attr="attr" :limitNum='1' :iSbnt='1'></Product-window> -->
<home></home>
<!-- <Product-window v-on:changeFun="changeFun" :attr="attr" :limitNum='1' :iSbnt='1'></Product-window> -->
</div>
</template>
<script>
@@ -162,9 +164,29 @@ export default {
H5ShareBox: false, //公众号分享图片
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
onceNum: 0 //一次可以购买几个
onceNum: 0 ,//一次可以购买几个,
timestamp: 0 // 当前时间戳
};
},
watch: {
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getCombinationPink();
}
},
deep:true
},
userData:{
handler:function(newV,oldV){
if(newV){
this.userInfo = newV;
app.globalData.openPages = '/pages/activity/goods_combination_status/index?id=' + this.pinkId;
}
},
deep:true
}
},
computed: mapGetters({
'isLogin':'isLogin',
'userData':'userInfo'
@@ -173,14 +195,9 @@ export default {
var that = this;
that.pinkId = options.id;
if (that.isLogin == false) {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
that.isAuto = true;
that.$set(that, 'isShowAuth', true);
// #endif
} else {
this.timestamp = (new Date()).getTime();
// #ifdef H5
this.getCombinationPink();
// #endif
@@ -196,8 +213,6 @@ export default {
*/
onShareAppMessage: function() {
let that = this;
that.close();
that.addShareBargain();
return {
title: '您的好友' + that.userInfo.nickname + '邀请您参团' + that.storeCombination.title,
path: app.globalData.openPages,
@@ -505,17 +520,13 @@ export default {
if (that.attr.productAttr != 0) that.DefaultSelect();
})
.catch(err => {
this.$util.Tips({
title: err
});
uni.redirectTo({
success(){},
fail() {
uni.navigateTo({
url: '/pages/index/index',
})
}
})
if(that.isLogin){
that.$util.Tips({
title: err
}, {
url: '/pages/index/index'
});
}
});
},
//#ifdef H5

View File

@@ -3,22 +3,19 @@
<view class='flash-sale'>
<view class="saleBox"></view>
<!-- banner -->
<!-- <navigator :url='item.url' class='slide-navigator acea-row row-between-wrapper' hover-class='none'>
<image :src="item.pic" class="slide-image" lazy-load></image>
</navigator> -->
<view class="header" v-if="timeList.length">
<swiper indicator-dots="true" autoplay="true" :circular="circular" interval="3000" duration="1500"
indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
<block v-for="(item,index) in JSON.parse(timeList[active].slide)" :key="index">
<block v-for="(item,index) in timeList[active].slide" :key="index">
<swiper-item>
<image :src="item.sattDir" class="slide-image" lazy-load></image>
<!-- <navigator :url='item.url' class='slide-navigator acea-row row-between-wrapper' hover-class='none'>
<image :src="item.pic" class="slide-image" lazy-load></image>
</navigator> -->
</swiper-item>
</block>
</swiper>
</view>
<!-- <view class='header' v-if="timeList.length>0">
<image :src='timeList[active].slide'></image>
</view> -->
<view class="seckillList acea-row row-between-wrapper">
<view class="priceTag">
<image src="/static/images/priceTag.png"></image>
@@ -99,7 +96,7 @@
loading: false,
loadend: false,
pageloading: false,
seckillHeader: [],
seckillHeader: []
}
},
onLoad() {
@@ -109,10 +106,12 @@
getSeckillConfig: function() {
let that = this;
getSeckillHeaderApi().then(res => {
res.data.seckillTime.map(item => {
item.slide = JSON.parse(item.slide)
})
that.timeList = res.data.seckillTime;
that.active = res.data.seckillTimeIndex;
if (that.timeList.length) {
// wxh.time(that.data.timeList[that.data.active].stop, that);
that.scrollLeft = (that.active - 1.37) * 100
setTimeout(function() {
that.loading = true

View File

@@ -110,7 +110,7 @@
<product-window :attr='attribute' :limitNum='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNum"
@attrVal="attrVal" @iptCartNum="iptCartNum"></product-window>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth"></authorize> -->
<!-- #endif -->
<home></home>
<!-- 分享按钮 -->
@@ -272,7 +272,8 @@
sharePacket: {
isState: true, //默认不显示
},
buyNum: 1
buyNum: 1,
errT: ''
}
},
components: {
@@ -288,6 +289,18 @@
// #endif
},
computed: mapGetters(['isLogin','uid','chatUrl']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getSeckillDetail();
this.getProductReplyList();
this.getProductReplyCount();
}
},
deep:true
}
},
onLoad(options) {
let that = this
@@ -337,13 +350,7 @@
this.getProductReplyList();
this.getProductReplyCount();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.isShowAuth = true
// #endif
}
},
methods: {
@@ -828,9 +835,20 @@
*/
goPoster: function() {
let that = this;
uni.showLoading({
title: '海报生成中',
mask: true
});
that.posters = false;
let arrImagesUrl = '';
let arrImagesUrlTop = '';
if(!that.PromotionCode){
uni.hideLoading();
that.$util.Tips({
title: that.errT
});
return
}
uni.downloadFile({
url: that.imgTop, //仅为示例,并非真实的资源
success: (res) => {
@@ -842,10 +860,11 @@
that.$util.PosterCanvas(arrImages, storeName, price, that.storeInfo.otPrice,function(tempFilePath) {
that.posterImage = tempFilePath;
that.canvasStatus = true;
uni.hideLoading();
});
}, 200);
}, 500);
}
});
});
},
// 小程序二维码
getQrcode(){
@@ -859,7 +878,9 @@
base64src(res.data.code, res => {
that.PromotionCode = res;
});
})
}).catch(err => {
that.errT = err;
});
},
// 生成二维码;
make() {

View File

@@ -34,7 +34,6 @@
});
})
.catch((err) => {
// location.replace("/");
console.log('auth错误='+err);
});
}

View File

@@ -1,5 +1,9 @@
<template>
<view class='productSort copy-data'>
<!-- #ifdef APP-PLUS -->
<view class="sys-head" :style="{height:sysHeight}"></view>
<!-- #endif -->
<view class='header acea-row row-center-wrapper'>
<view class='acea-row row-between-wrapper input'>
<text class='iconfont icon-sousuo'></text>
@@ -44,6 +48,7 @@
</template>
<script>
let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
import {
getCategoryList
} from '@/api/store.js';
@@ -58,7 +63,8 @@
height: 0,
hightArr: [],
toView: "",
tabbarH: 0
tabbarH: 0,
sysHeight: sysHeight,
}
},
onLoad(options) {
@@ -133,6 +139,9 @@
</script>
<style scoped lang="scss">
.sys-head{
background-color: #fff;
}
.productSort .header {
width: 100%;
height: 96rpx;

View File

@@ -198,7 +198,7 @@
<view class="mask" v-if="posters" @click="closePosters"></view>
<view class="mask" v-if="canvasStatus" @click="listenerActionClose"></view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<!-- 海报展示 -->
<view class='poster-pop' v-if="canvasStatus">
@@ -356,10 +356,29 @@
qrcodeSize: 600,
canvasStatus: false,//是否显示海报
imagePath:'',//海报路径
imgTop:''
imgTop:'',
errT: ''
};
},
computed: mapGetters(['isLogin', 'uid', 'chatUrl']),
watch: {
isLogin: {
handler: function(newV, oldV) {
if (newV == true) {
this.getCouponList();
this.getCartCount();
this.downloadFilePromotionCode();
}
},
deep: true
},
storeInfo: {
handler: function() {
this.$nextTick(() => {});
},
immediate: true
}
},
onLoad(options) {
// this.getChat(this.uid || '');
let that = this
@@ -885,13 +904,7 @@
*/
setCollect: function() {
let that = this;
if (this.isLogin === false) {
if (this.isLogin === false) {
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
toLogin();
} else {
if (this.storeInfo.userCollect) {
@@ -917,13 +930,7 @@
*/
couponTap: function() {
let that = this;
if (that.isLogin === false) {
if (that.isLogin === false) {
toLogin();
// #endif
// #ifdef MP
that.$set(that, 'isAuto', true);
that.$set(that, 'isShowAuth', true);
toLogin();
} else {
that.getCouponList();
@@ -940,13 +947,7 @@
*/
joinCart: function(e) {
//是否登录
if (this.isLogin === false) {
if (this.isLogin === false) {
toLogin();
// #endif
// #ifdef MP
this.$set(this, 'isAuto', true);
this.$set(this, 'isShowAuth', true)
toLogin();
} else {
this.goCat();
@@ -1035,13 +1036,7 @@
* 立即购买
*/
goBuy: function(e) {
if (this.isLogin === false) {
if (this.isLogin === false) {
toLogin();
// #endif
// #ifdef MP
this.$set(this, 'isAuto', true);
this.$set(this, 'isShowAuth', true);
toLogin();
} else {
this.goCat(true);
@@ -1056,13 +1051,7 @@
*
*/
listenerActionSheet: function() {
if (this.isLogin === false) {
if (this.isLogin === false) {
toLogin();
// #endif
// #ifdef MP
this.$set(this, 'isAuto', true);
this.$set(this, 'isShowAuth', true);
toLogin();
} else {
// #ifdef H5
@@ -1120,14 +1109,12 @@
id: that.id,
path: 'pages/goods_details/index'
}
getQrcode(data).then(res=>{
getQrcode(data).then(res=>{
base64src(res.data.code, res => {
that.PromotionCode = res;
});
}).catch(err => {
that.$util.Tips({
title: err
}).catch(err => {
that.errT = err;
});
},
@@ -1191,9 +1178,20 @@
* 生成海报
*/
goPoster: function() {
let that = this;
uni.showLoading({
title: '海报生成中',
mask: true
});
that.posters = false;
let arrImagesUrl = '';
let arrImagesUrlTop = '';
if(!that.PromotionCode){
uni.hideLoading();
that.$util.Tips({
title: that.errT
});
return
}
uni.downloadFile({
url: that.imgTop, //仅为示例,并非真实的资源
@@ -1205,8 +1203,9 @@
setTimeout(() => {
that.$util.PosterCanvas(arrImages, storeName, price, that.storeInfo.otPrice,function(tempFilePath) {
that.imagePath = tempFilePath;
that.canvasStatus = true;
uni.hideLoading();
});
});
}, 500);
}
});

View File

@@ -2,6 +2,7 @@
<view>
<view class='productList'>
<view class='search bg-color acea-row row-between-wrapper'>
<view class="iconfont icon-xiangzuo" @click="goback()"></view>
<view class='input acea-row row-between-wrapper'><text class='iconfont icon-sousuo'></text>
<input placeholder='搜索商品名称' placeholder-class='placeholder' confirm-type='search' name="search" :value='where.keyword'
@confirm="searchSubmit"></input>
@@ -105,6 +106,16 @@
this.get_host_product();
},
methods: {
goback(){
// #ifdef H5
return history.back();
// #endif
// #ifndef H5
return uni.navigateBack({
delta: 1,
})
// #endif
},
// 去详情页
godDetail(item){
goShopDetail(item,this.uid).then(res=>{
@@ -144,14 +155,7 @@
set_where: function(e) {
switch (e) {
case 1:
// #ifdef H5
return history.back();
// #endif
// #ifndef H5
return uni.navigateBack({
delta: 1,
})
// #endif
return;
break;
case 2:
if (this.price == 0) this.price = 1;
@@ -176,11 +180,11 @@
//设置where条件
setWhere: function() {
if (this.price == 0) this.where.priceOrder = '';
else if (this.price == 1) this.where.priceOrder = 'desc';
else if (this.price == 2) this.where.priceOrder = 'asc';
else if (this.price == 1) this.where.priceOrder = 'asc';
else if (this.price == 2) this.where.priceOrder = 'desc';
if (this.stock == 0) this.where.salesOrder = '';
else if (this.stock == 1) this.where.salesOrder = 'desc';
else if (this.stock == 2) this.where.salesOrder = 'asc';
else if (this.stock == 1) this.where.salesOrder = 'asc';
else if (this.stock == 2) this.where.salesOrder = 'desc';
this.where.news = this.nows ? 1 : 0;
},
//查找产品
@@ -222,6 +226,9 @@
</script>
<style scoped lang="scss">
.iconfont{
color: #fff;
}
.productList .search {
width: 100%;
height: 86rpx;
@@ -234,7 +241,7 @@
}
.productList .search .input {
width: 640rpx;
// width: 640rpx;
height: 60rpx;
background-color: #fff;
border-radius: 50rpx;
@@ -243,7 +250,7 @@
}
.productList .search .input input {
width: 548rpx;
width: 528rpx;
height: 100%;
font-size: 26rpx;
}

View File

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +1,14 @@
<template>
<view :class="{borderShow:isBorader}">
<view class="combination" v-if="combinationList.length">
<view class="title acea-row row-between-wrapper">
<view class="acea-row row-middle">
<view class="title acea-row row-right">
<!-- <view class="acea-row row-middle">
<view class="sign">
<image src="../../../static/images/sign02.png"></image>
</view>
<view class="name">拼团惠<text>享超值开团价</text></view>
</view>
<navigator url="/pages/activity/goods_combination/index" hover-class="none" class="more acea-row row-center-wrapper">超值精选<text class="iconfont icon-xiangyou"></text></navigator>
</view> -->
<navigator url="/pages/activity/goods_combination/index" hover-class="none" class="more acea-row row-center-wrapper">更多<text class="iconfont icon-xiangyou"></text></navigator>
</view>
<view class="conter acea-row">
<scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
@@ -18,8 +18,9 @@
<image :src="item.image"></image>
</view>
<view class="text lines1">
<text class="money">¥<text class="num">{{item.price}}</text></text>
<!-- <text class="y_money">¥{{item.otPrice}}</text> -->
<view class="name line1">{{item.title}}</view>
<view class="money">¥<text class="num">{{item.price}}</text></view>
<view class="y_money">¥{{item.otPrice}}</view>
</view>
</view>
</view>
@@ -81,7 +82,7 @@
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.default{
width: 690rpx;
height: 300rpx;
@@ -95,12 +96,14 @@
}
}
.combination{
width: 690rpx;
width: 700rpx;
background-color: #fff;
border-radius: 14rpx;
margin: 26rpx auto 0 auto;
padding: 25rpx 20rpx 21rpx 20rpx;
background-image: url(../../../static/images/pth.png);
background-repeat: no-repeat;
background-size: 100%;
.title {
.sign {
width: 40rpx;
@@ -127,12 +130,9 @@
}
.more {
width: 122rpx;
height: 37rpx;
background: linear-gradient(270deg, #1DB0FC 0%, #22CAFD 100%);
border-radius: 21rpx;
font-size: 22rpx;
color: #fff;
color: #666666;
padding-left: 2rpx;
.iconfont {
@@ -141,7 +141,7 @@
}
}
.conter{
margin-top: 18rpx;
margin-top: 28rpx;
.itemCon {
display: inline-block;
width: 174rpx;
@@ -161,20 +161,26 @@
}
.text{
margin-top: 4rpx;
.money{
.y_money {
font-size: 20rpx;
color: #999999;
text-decoration: line-through;
}
.name {
font-size: 24rpx;
color: #000;
margin-top: 14rpx;
}
.money {
color: #FD502F;
font-size: 28rpx;
height: 100%;
font-weight: bold;
.num{
margin: 2rpx 0;
.num {
font-size: 28rpx;
}
}
.y_money{
color: #959595;
text-decoration: line-through;
font-size: 20rpx;
margin-left: 8rpx;
}
}
}
}

View File

@@ -1,14 +1,14 @@
<template>
<view :class="{borderShow:isBorader}">
<view class="combination" v-if="bargList.length">
<view class="title acea-row row-between-wrapper">
<view class="acea-row row-middle">
<view class="title acea-row row-between">
<view class="acea-row row-column">
<view class="sign">
<image src="../../../static/images/sign03.png"></image>
Hi{{userData.nickname || '亲爱的顾客'}}
</view>
<view class="name">砍价活动<text>呼朋唤友来砍价</text></view>
<view class="name"><text>你的好友正在邀请你参与砍价</text></view>
</view>
<navigator url="/pages/activity/goods_bargain/index" hover-class="none" class="more acea-row row-center-wrapper">品质好货<text class="iconfont icon-xiangyou"></text></navigator>
<navigator url="/pages/activity/goods_bargain/index" hover-class="none" class="more acea-row row-center-wrapper">更多<text class="iconfont icon-xiangyou"></text></navigator>
</view>
<view class="conter acea-row">
<scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
@@ -18,8 +18,10 @@
<image :src="item.image"></image>
</view>
<view class="text lines1">
<text class="money">¥<text class="num">{{item.minPrice}}</text></text>
<text class="y_money">¥{{item.price}}</text>
<view class="name line1">{{item.title}}</view>
<view class="money">¥<text class="num">{{item.minPrice}}</text></view>
<view class="btn">参与砍价</view>
<!-- <view class="y_money">¥{{item.price}}</view> -->
</view>
</view>
</view>
@@ -40,7 +42,10 @@
import { mapGetters } from 'vuex';
export default {
name: 'c_bargain',
computed: mapGetters(['uid']),
computed: mapGetters({
'userData': 'userInfo',
'uid': 'uid'
}),
data() {
return {
bargList: [],
@@ -72,7 +77,7 @@
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.default{
width: 690rpx;
height: 300rpx;
@@ -87,44 +92,37 @@
}
.combination{
width: 690rpx;
background-image: url(../../../static/images/kjbj.png);
background-repeat: no-repeat;
background-size: 100%;
// height: 288rpx;
background-color: #fff;
border-radius: 14rpx;
margin: 26rpx auto 0 auto;
padding: 25rpx 20rpx 21rpx 20rpx;
padding: 25rpx 20rpx 25rpx 20rpx;
.title {
.sign {
width: 40rpx;
height: 40rpx;
image {
width: 100%;
height: 100%;
}
font-size: 32rpx;
color: #E93323;
margin-bottom: 2rpx;
font-weight: bold;
margin-bottom: 10rpx;
}
.name {
font-size: 32rpx;
color: #282828;
margin-left: 12rpx;
font-weight: bold;
text {
color: #797979;
font-size: 24rpx;
color: #333333;
font-size: 26rpx;
font-weight: 400;
margin-left: 14rpx;
}
}
.more {
width: 122rpx;
height: 37rpx;
background: linear-gradient(135deg, #FF9F6C 0%, #FD502F 100%);
border-radius: 21rpx;
font-size: 22rpx;
color: #fff;
color: #666666;
padding-left: 2rpx;
.iconfont {
@@ -133,7 +131,7 @@
}
}
.conter{
margin-top: 18rpx;
margin-top: 28rpx;
.itemCon {
display: inline-block;
width: 174rpx;
@@ -153,19 +151,37 @@
}
.text{
margin-top: 4rpx;
.money{
.y_money {
font-size: 20rpx;
color: #999999;
text-decoration: line-through;
}
.name {
font-size: 24rpx;
color: #000;
margin-top: 14rpx;
}
.money {
color: #FD502F;
font-size: 28rpx;
height: 100%;
font-weight: bold;
.num{
margin: 2rpx 0;
.num {
font-size: 28rpx;
}
}
.y_money{
color: #959595;
text-decoration: line-through;
font-size: 20rpx;
margin-left: 8rpx;
.btn{
width: 174rpx;
height: 48rpx;
line-height: 48rpx;
text-align: center;
background: linear-gradient(129deg, #FF5555 0%, #FF0000 100%);
opacity: 1;
border-radius: 0px 0px 14rpx 14rpx;
color: #FFFFFF;
font-size: 26rpx;
margin-top: 6rpx;
}
}
}

View File

File diff suppressed because it is too large Load Diff

View File

@@ -113,13 +113,19 @@
<productWindow :attr="attr" :isShow='1' :iSplus='1' :iScart='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
@ChangeCartNum="ChangeCartNum" @attrVal="attrVal" @iptCartNum="iptCartNum" @goCat="reGoCat" id='product-window'></productWindow>
<!-- #ifdef MP -->
<authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
<script>
// #ifdef APP-PLUS
let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
// #endif
// #ifndef APP-PLUS
let sysHeight = 0
// #endif
import {
getCartList,
getCartCounts,
@@ -189,20 +195,15 @@
attrValue: '', //已选属性
attrTxt: '请选择', //属性页面提示
cartId: 0,
product_id: 0
product_id: 0,
sysHeight:sysHeight
};
},
computed: mapGetters(['isLogin']),
onLoad: function(options) {
let that = this;
if (that.isLogin == false) {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
that.isAuto = true;
that.$set(that, 'isShowAuth', true);
// #endif
}
},
onShow: function() {
@@ -593,30 +594,8 @@
// let newArr = that.cartList.valid.filter(item => item.attrStatus);
that.isAllSelect = newValid.length === arr1.length + arr3.length;
that.selectValue = value;
console.log(that.selectValue)
that.switchSelect();
},
// checkboxChange: function(event) {
// let that = this;
// let value = event.detail.value;
// let valid = that.cartList.valid;
// for (let index in valid) {
// if (that.inArray(valid[index].id, value)){
// if(valid[index].attrStatus){
// valid[index].checked = true;
// }else{
// valid[index].checked = false;
// }
// } else {
// valid[index].checked = false;
// }
// }
// that.$set(that.cartList, 'valid', valid);
// let newArr = that.cartList.valid.filter(item => item.attrStatus);
// that.isAllSelect = value.length == newArr.length;
// that.selectValue = value;
// that.switchSelect();
// },
inArray: function(search, array) {
for (let i in array) {
if (array[i] == search) {
@@ -677,6 +656,7 @@
that.setCartNum(item.id, item.cartNum, function(data) {
that.cartList.valid[index] = item;
that.switchSelect();
that.getCartNum();
});
}
},
@@ -696,6 +676,7 @@
that.setCartNum(item.id, item.cartNum, function(data) {
that.cartList.valid[index] = item;
that.switchSelect();
that.getCartNum();
});
},
setCartNum(cartId, cartNum, successCallback) {
@@ -872,8 +853,8 @@
} else {
that.getCartList();
}
if (that.cartList.valid.length == 0 && that.cartList.invalid.length == 0) {
// that.getHostProduct();
if (that.cartList.valid.length == 0 && that.cartList.invalid.length == 0 && this.hotPage != 1) {
that.getHostProduct();
}
}
}

View File

@@ -1,804 +0,0 @@
<template>
<view>
<view class='shoppingCart'>
<view class='labelNav acea-row row-around row-middle'>
<view class='item'><text class='iconfont icon-xuanzhong'></text>100%正品保证</view>
<view class='item'><text class='iconfont icon-xuanzhong'></text>所有商品精挑细选</view>
<view class='item'><text class='iconfont icon-xuanzhong'></text>售后无忧</view>
</view>
<view class='nav acea-row row-between-wrapper'>
<view>购物数量 <text class='num font-color'>{{cartCount}}</text></view>
<view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0" class='administrate acea-row row-center-wrapper'
@click='manage'>{{ footerswitch ? '管理' : '取消'}}</view>
</view>
<view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0">
<view class='list'>
<checkbox-group @change="checkboxChange">
<block v-for="(item,index) in cartList.valid" :key="index">
<view class='item acea-row row-between-wrapper'>
<!-- #ifndef MP -->
<checkbox :value="(item.id).toString()" :checked="item.checked" :disabled="!item.attrStatus && footerswitch" />
<!-- <checkbox :value="(item.id).toString()" :checked="item.checked" /> -->
<!-- #endif -->
<!-- #ifdef MP -->
<checkbox :value="item.id" :checked="item.checked" :disabled="!item.attrStatus && footerswitch" />
<!-- <checkbox :value="item.id" :checked="item.checked" /> -->
<!-- #endif -->
<navigator :url='"/pages/goods_details/index?id="+item.product_id' hover-class='none' class='picTxt acea-row row-between-wrapper'>
<view class='pictrue'>
<image v-if="item.productInfo.attrInfo" :src='item.productInfo.attrInfo.image'></image>
<image v-else :src='item.productInfo.image'></image>
</view>
<view class='text'>
<view class='line1' :class="item.attrStatus?'':'reColor'">{{item.productInfo.store_name}}</view>
<view class='infor line1' v-if="item.productInfo.attrInfo">属性{{item.productInfo.attrInfo.suk}}</view>
<view class='money' v-if="item.attrStatus">{{item.truePrice}}</view>
<view class="reElection acea-row row-between-wrapper" v-else>
<view class="title">请重新选择商品规格</view>
<view class="reBnt cart-color acea-row row-center-wrapper" @click.stop="reElection(item)">重选</view>
</view>
</view>
<view class='carnum acea-row row-center-wrapper' v-if="item.attrStatus">
<view class="reduce" :class="item.numSub ? 'on' : ''" @click.stop='subCart(index)'>-</view>
<view class='num'>{{item.cart_num}}</view>
<!-- <view class="num">
<input type="number" v-model="item.cart_num" @click.stop @input="iptCartNum(index)" @blur="blurInput(index)"/>
</view> -->
<view class="plus" :class="item.numAdd ? 'on' : ''" @click.stop='addCart(index)'>+</view>
</view>
</navigator>
<!-- <navigator :url='"/pages/goods_details/index?id="+item.product_id' hover-class='none' class='picTxt acea-row row-between-wrapper'>
<view class='pictrue'>
<image v-if="item.productInfo.attrInfo" :src='item.productInfo.attrInfo.image'></image>
<image v-else :src='item.productInfo.image'></image>
</view>
<view class='text'>
<view class='line1'>{{item.productInfo.store_name}}</view>
<view class='infor line1' v-if="item.productInfo.attrInfo">属性{{item.productInfo.attrInfo.suk}}</view>
<view class='money'>{{item.truePrice}}</view>
</view>
<view class='carnum acea-row row-center-wrapper'>
<view class="reduce" :class="item.numSub ? 'on' : ''" @click.stop='subCart(index)'>-</view>
<view class='num'>{{item.cart_num}}</view>
<view class="plus" :class="item.numAdd ? 'on' : ''" @click.stop='addCart(index)'>+</view>
</view>
</navigator> -->
</view>
</block>
</checkbox-group>
</view>
<view class='invalidGoods' v-if="cartList.invalid.length > 0">
<view class='goodsNav acea-row row-between-wrapper'>
<view @click='goodsOpen'><text class='iconfont' :class='goodsHidden==true?"icon-xiangxia":"icon-xiangshang"'></text>失效商品</view>
<view class='del' @click='unsetCart'><text class='iconfont icon-shanchu1'></text>清空</view>
</view>
<view class='goodsList' :hidden='goodsHidden'>
<block v-for="(item,index) in cartList.invalid" :key='index'>
<view class='item acea-row row-between-wrapper'>
<view class='invalid'>失效</view>
<view class='pictrue'>
<image v-if="item.productInfo.attrInfo" :src='item.productInfo.attrInfo.image'></image>
<image v-else :src='item.productInfo.image'></image>
</view>
<view class='text acea-row row-column-between'>
<view class='line1 name'>{{item.productInfo.store_name}}</view>
<view class='infor line1' v-if="item.productInfo.attrInfo">属性{{item.productInfo.attrInfo.suk}}</view>
<view class='acea-row row-between-wrapper'>
<!-- <view>{{item.truePrice}}</view> -->
<view class='end'>该商品已失效</view>
</view>
</view>
</view>
</block>
</view>
</view>
<view class='loadingicon acea-row row-center-wrapper' v-if="cartList.valid.length&&!loadend">
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
<view class='loadingicon acea-row row-center-wrapper' v-if="cartList.invalid.length&&loadend">
<text class='loading iconfont icon-jiazai' :hidden='loadingInvalid==false'></text>{{loadTitleInvalid}}
</view>
</view>
<view class='noCart' v-if="cartList.valid.length == 0 && cartList.invalid.length == 0">
<view class='pictrue'>
<image src='../../static/images/noCart.png'></image>
</view>
<recommend :hostProduct='hostProduct'></recommend>
</view>
<view style='height:120rpx;'></view>
<view class='footer acea-row row-between-wrapper' v-if="cartList.valid.length > 0">
<view>
<checkbox-group @change="checkboxAllChange">
<checkbox value="all" :checked="!!isAllSelect" /><text class='checkAll'>全选 ({{selectValue.length}})</text>
</checkbox-group>
</view>
<view class='money acea-row row-middle' v-if="footerswitch==true">
<text class='font-color'>{{selectCountPrice}}</text>
<form @submit="subOrder" report-submit='true'>
<button class='placeOrder bg-color' formType="submit">立即下单</button>
</form>
</view>
<view class='button acea-row row-middle' v-else>
<form @submit="subCollect" report-submit='true'>
<button class='bnt cart-color' formType="submit">收藏</button>
</form>
<form @submit="subDel" report-submit='true'>
<button class='bnt' formType="submit">删除</button>
</form>
</view>
</view>
</view>
<!-- #ifdef MP -->
<authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
<script>
import {
getCartList,
getCartCounts,
changeCartNum,
cartDel
} from '@/api/order.js';
import {
getProductHot,
collectAll
} from '@/api/store.js';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
import recommend from '@/components/recommend';
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
export default {
components: {
recommend,
// #ifdef MP
authorize
// #endif
},
data() {
return {
cartCount: 0,
goodsHidden: true,
footerswitch: true,
hostProduct: [],
cartList: {
valid: [],
invalid: []
},
isAllSelect: false, //全选
selectValue: [], //选中的数据
selectCountPrice: 0.00,
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
hotScroll:false,
hotPage:1,
hotLimit:10,
loading: false,
loadend: false,
loadTitle: '加载更多', //提示语
page: 1,
limit: 20,
loadingInvalid: false,
loadendInvalid: false,
loadTitleInvalid: '加载更多', //提示语
pageInvalid: 1,
limitInvalid: 20,
attr: {
cartAttr: false,
productAttr: [],
productSelect: {}
},
productValue: [], //系统属性
storeInfo: {},
attrValue: '', //已选属性
attrTxt: '请选择', //属性页面提示
cartId: 0,
product_id: 0
};
},
computed: mapGetters(['isLogin']),
onLoad: function(options) {
let that = this;
if (that.isLogin == false) {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
that.isAuto = true;
that.$set(that, 'isShowAuth', true);
// #endif
}
},
onShow: function() {
if (this.isLogin == true) {
this.getHostProduct();
this.getCartList();
this.getCartNum();
this.goodsHidden = true;
this.footerswitch = true;
this.hostProduct = [];
this.hotScroll = false;
this.hotPage = 1;
this.hotLimit = 10;
this.cartList = {
valid: [],
invalid: []
},
this.isAllSelect = false; //全选
this.selectValue = []; //选中的数据
this.selectCountPrice = 0.00;
this.cartCount = 0;
this.isShowAuth = false;
};
},
methods: {
/**
* 手动输入数量失焦事件
*/
// inputBlur(index,val) {
// if (val <= 1) {
// // let index = e.currentTarget.dataset.index;
// let item = this.cartList.valid[index];
// item.cart_num = 1;
// if (item.cart_num) this.setCartNum(item.id, item.cart_num);
// this.cartList.valid[index] = item;
// this.$set(this.cartList,'valid',this.cartList.valid);
// this.switchSelect();
// }
// },
// 授权关闭
authColse: function(e) {
this.isShowAuth = e;
},
subDel: function(event) {
let that = this,
selectValue = that.selectValue;
if (selectValue.length > 0)
cartDel(selectValue).then(res => {
that.getCartList();
that.getCartNum();
});
else
return that.$util.Tips({
title: '请选择产品'
});
},
getSelectValueProductId: function() {
let that = this;
let validList = that.cartList.valid;
let selectValue = that.selectValue;
let productId = [];
if (selectValue.length > 0) {
for (let index in validList) {
if (that.inArray(validList[index].id, selectValue)) {
productId.push(validList[index].product_id);
}
}
};
return productId;
},
subCollect: function(event) {
let that = this,
selectValue = that.selectValue;
if (selectValue.length > 0) {
let selectValueProductId = that.getSelectValueProductId();
collectAll(that.getSelectValueProductId().join(',')).then(res => {
return that.$util.Tips({
title: res.msg,
icon: 'success'
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
} else {
return that.$util.Tips({
title: '请选择产品'
});
}
},
subOrder: function(event) {
let that = this,
selectValue = that.selectValue;
if (selectValue.length > 0) {
uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + selectValue.join(',')
});
} else {
return that.$util.Tips({
title: '请选择产品'
});
}
},
checkboxAllChange: function(event) {
let value = event.detail.value;
if (value.length > 0) {
this.setAllSelectValue(1)
} else {
this.setAllSelectValue(0)
}
},
setAllSelectValue: function(status) {
let that = this;
let selectValue = [];
let valid = that.cartList.valid;
if (valid.length > 0) {
for (let index in valid) {
if (status == 1) {
valid[index].checked = true;
selectValue.push(valid[index].id);
} else valid[index].checked = false;
}
that.$set(that.cartList, 'valid', valid);
that.selectValue = selectValue;
that.switchSelect();
}
},
checkboxChange: function(event) {
let that = this;
let value = event.detail.value;
let valid = that.cartList.valid;
for (let index in valid) {
if (that.inArray(valid[index].id, value)) valid[index].checked = true;
else valid[index].checked = false;
}
that.$set(that.cartList, 'valid', valid);
that.isAllSelect = value.length == that.cartList.valid.length;
that.selectValue = value;
that.switchSelect();
},
inArray: function(search, array) {
for (let i in array) {
if (array[i] == search) {
return true;
}
}
return false;
},
switchSelect: function() {
let that = this;
let validList = that.cartList.valid;
let selectValue = that.selectValue;
let selectCountPrice = 0.00;
if (selectValue.length < 1) {
that.selectCountPrice = selectCountPrice;
} else {
for (let index in validList) {
if (that.inArray(validList[index].id, selectValue)) {
selectCountPrice = that.$util.$h.Add(selectCountPrice, that.$util.$h.Mul(validList[index].cart_num, validList[
index].truePrice))
}
}
that.selectCountPrice = selectCountPrice;
}
},
/**
* 购物车手动填写
*
*/
iptCartNum: function (index) {
let item = this.cartList.valid[index];
if(item.cart_num){
this.setCartNum(item.id, item.cart_num);
}
this.switchSelect();
},
blurInput:function (index) {
let item = this.cartList.valid[index];
if(!item.cart_num){
item.cart_num = 1;
this.$set(this.cartList,'valid',this.cartList.valid)
}
},
subCart: function(index) {
let that = this;
let status = false;
let item = that.cartList.valid[index];
item.cart_num = Number(item.cart_num) - 1;
if (item.cart_num < 1) status = true;
if (item.cart_num <= 1) {
item.cart_num = 1;
item.numSub = true;
} else {
item.numSub = false;
item.numAdd = false;
}
if (false == status) {
that.setCartNum(item.id, item.cart_num, function(data) {
that.cartList.valid[index] = item;
that.switchSelect();
});
}
},
addCart: function(index) {
let that = this;
let item = that.cartList.valid[index];
item.cart_num = Number(item.cart_num) + 1;
let productInfo = item.productInfo;
if (productInfo.hasOwnProperty('attrInfo') && item.cart_num >= item.productInfo.attrInfo.stock) {
item.cart_num = item.productInfo.attrInfo.stock;
item.numAdd = true;
item.numSub = false;
}else {
item.numAdd = false;
item.numSub = false;
}
that.setCartNum(item.id, item.cart_num, function(data) {
that.cartList.valid[index] = item;
that.switchSelect();
});
},
setCartNum(cartId, cartNum, successCallback) {
let that = this;
changeCartNum(cartId, cartNum).then(res => {
successCallback && successCallback(res.data);
});
},
getCartNum: function() {
let that = this;
getCartCounts().then(res => {
that.cartCount = res.data.count;
});
},
getCartList: function() {
let that = this;
getCartList().then(res => {
let cartList = res.data;
let valid = cartList.valid;
let numSub = [{
numSub: true
}, {
numSub: false
}];
let numAdd = [{
numAdd: true
}, {
numAdd: false
}],
selectValue = [];
if (valid.length > 0) {
for (let index in valid) {
if (valid[index].cart_num == 1) {
valid[index].numSub = true;
} else {
valid[index].numSub = false;
}
let productInfo = valid[index].productInfo;
if (productInfo.hasOwnProperty('attrInfo') && valid[index].cart_num == valid[index].productInfo.attrInfo.stock) {
valid[index].numAdd = true;
} else if (valid[index].cart_num == valid[index].productInfo.stock) {
valid[index].numAdd = true;
} else {
valid[index].numAdd = false;
}
valid[index].checked = true;
selectValue.push(valid[index].id);
}
}
that.$set(that, 'cartList', cartList);
that.goodsHidden = cartList.valid.length <= 0 ? false : true;
that.selectValue = selectValue;
that.isAllSelect = valid.length == selectValue.length && valid.length;
that.switchSelect();
});
},
getHostProduct: function() {
let that = this;
if(that.hotScroll) return
getProductHot(
that.hotPage,
that.hotLimit,
).then(res => {
that.hotPage++
that.hotScroll = res.data.list.length<that.hotLimit
that.hostProduct = that.hostProduct.concat(res.data.list)
});
},
goodsOpen: function() {
let that = this;
that.goodsHidden = !that.goodsHidden;
},
manage: function() {
let that = this;
that.footerswitch = !that.footerswitch;
},
unsetCart: function() {
let that = this,
ids = [];
for (let i = 0, len = that.cartList.invalid.length; i < len; i++) {
ids.push(that.cartList.invalid[i].id);
}
cartDel(ids).then(res => {
that.$util.Tips({
title: '清除成功'
});
that.$set(that.cartList, 'invalid', []);
}).catch(res => {
});
}
},
onReachBottom() {
this.getHostProduct();
}
}
</script>
<style scoped lang="scss">
.shoppingCart .labelNav {
height: 76rpx;
padding: 0 30rpx;
font-size: 22rpx;
color: #8c8c8c;
position: fixed;
left: 0;
width: 100%;
box-sizing: border-box;
background-color: #f5f5f5;
z-index: 5;
top: 0;
}
.shoppingCart .labelNav .item .iconfont {
font-size: 25rpx;
margin-right: 10rpx;
}
.shoppingCart .nav {
width: 100%;
height: 80rpx;
background-color: #fff;
padding: 0 30rpx;
box-sizing: border-box;
font-size: 28rpx;
color: #282828;
position: fixed;
left: 0;
z-index: 5;
top: 76rpx;
}
.shoppingCart .nav .administrate {
font-size: 26rpx;
color: #282828;
width: 110rpx;
height: 46rpx;
border-radius: 6rpx;
border: 1px solid #868686;
}
.shoppingCart .noCart {
margin-top: 171rpx;
background-color: #fff;
padding-top: 0.1rpx;
}
.shoppingCart .noCart .pictrue {
width: 414rpx;
height: 336rpx;
margin: 78rpx auto 56rpx auto;
}
.shoppingCart .noCart .pictrue image {
width: 100%;
height: 100%;
}
.shoppingCart .list {
margin-top: 171rpx;
}
.shoppingCart .list .item {
padding: 25rpx 30rpx;
background-color: #fff;
margin-bottom: 15rpx;
}
.shoppingCart .list .item .picTxt {
width: 627rpx;
position: relative;
}
.shoppingCart .list .item .picTxt .pictrue {
width: 160rpx;
height: 160rpx;
}
.shoppingCart .list .item .picTxt .pictrue image {
width: 100%;
height: 100%;
border-radius: 6rpx;
}
.shoppingCart .list .item .picTxt .text {
width: 444rpx;
font-size: 28rpx;
color: #282828;
}
.shoppingCart .list .item .picTxt .text .infor {
font-size: 24rpx;
color: #868686;
margin-top: 16rpx;
}
.shoppingCart .list .item .picTxt .text .money {
font-size: 32rpx;
color: #282828;
margin-top: 28rpx;
}
.shoppingCart .list .item .picTxt .carnum {
height: 47rpx;
position: absolute;
bottom: 7rpx;
right: 0;
}
.shoppingCart .list .item .picTxt .carnum view {
border: 1rpx solid #a4a4a4;
width: 66rpx;
text-align: center;
height: 100%;
line-height: 40rpx;
font-size: 28rpx;
color: #a4a4a4;
}
.shoppingCart .list .item .picTxt .carnum .reduce {
border-right: 0;
border-radius: 3rpx 0 0 3rpx;
}
.shoppingCart .list .item .picTxt .carnum .reduce.on {
border-color: #e3e3e3;
color: #dedede;
}
.shoppingCart .list .item .picTxt .carnum .plus {
border-left: 0;
border-radius: 0 3rpx 3rpx 0;
}
.shoppingCart .list .item .picTxt .carnum .num {
color: #282828;
}
.shoppingCart .invalidGoods {
background-color: #fff;
}
.shoppingCart .invalidGoods .goodsNav {
width: 100%;
height: 66rpx;
padding: 0 30rpx;
box-sizing: border-box;
font-size: 28rpx;
color: #282828;
}
.shoppingCart .invalidGoods .goodsNav .iconfont {
color: #424242;
font-size: 28rpx;
margin-right: 17rpx;
}
.shoppingCart .invalidGoods .goodsNav .del {
font-size: 26rpx;
color: #999;
}
.shoppingCart .invalidGoods .goodsNav .del .icon-shanchu1 {
color: #999;
font-size: 33rpx;
vertical-align: -2rpx;
margin-right: 8rpx;
}
.shoppingCart .invalidGoods .goodsList .item {
padding: 20rpx 30rpx;
border-top: 1rpx solid #f5f5f5;
}
.shoppingCart .invalidGoods .goodsList .item .invalid {
font-size: 22rpx;
color: #fff;
width: 70rpx;
height: 36rpx;
background-color: #aaa;
border-radius: 3rpx;
text-align: center;
line-height: 36rpx;
}
.shoppingCart .invalidGoods .goodsList .item .pictrue {
width: 140rpx;
height: 140rpx;
}
.shoppingCart .invalidGoods .goodsList .item .pictrue image {
width: 100%;
height: 100%;
border-radius: 6rpx;
}
.shoppingCart .invalidGoods .goodsList .item .text {
width: 433rpx;
font-size: 28rpx;
color: #999;
height: 140rpx;
}
.shoppingCart .invalidGoods .goodsList .item .text .name{width:100%;}
.shoppingCart .invalidGoods .goodsList .item .text .infor {
font-size: 24rpx;
}
.shoppingCart .invalidGoods .goodsList .item .text .end {
font-size: 26rpx;
color: #bbb;
}
.shoppingCart .footer {
z-index:9;
width: 100%;
height: 96rpx;
background-color: #fafafa;
position: fixed;
padding: 0 30rpx;
box-sizing: border-box;
border-top: 1rpx solid #eee;
//
bottom: 0;
//
// #ifndef MP
bottom: 50px;
// #endif
}
.shoppingCart .footer .checkAll {
font-size: 28rpx;
color: #282828;
margin-left: 16rpx;
}
// .shoppingCart .footer checkbox .wx-checkbox-input{background-color:#fafafa;}
.shoppingCart .footer .money {
font-size: 30rpx;
}
.shoppingCart .footer .placeOrder {
color: #fff;
font-size: 30rpx;
width: 226rpx;
height: 70rpx;
border-radius: 50rpx;
text-align: center;
line-height: 70rpx;
margin-left: 22rpx;
}
.shoppingCart .footer .button .bnt {
font-size: 28rpx;
color: #999;
border-radius: 50rpx;
border: 1px solid #999;
width: 160rpx;
height: 60rpx;
text-align: center;
line-height: 60rpx;
}
.shoppingCart .footer .button form~form {
margin-left: 17rpx;
}
</style>

View File

File diff suppressed because it is too large Load Diff

View File

@@ -226,7 +226,7 @@
</view>
<home></home>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<payment :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :order_id="pay_order_id" :totalPrice='totalPrice'></payment>
</view>
@@ -658,7 +658,8 @@
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
id: 0, //订单id
uniId: ''
uniId: '',
utils: this.$util,
};
},
computed: mapGetters(['isLogin', 'chatUrl']),
@@ -676,13 +677,7 @@
this.getOrderInfo();
this.getUserInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onHide: function() {
@@ -835,7 +830,6 @@
newCartInfo.push(item.info);
});
that.$set(that, 'cartInfo', newCartInfo);
console.log(that.cartInfo)
if (res.data.refundStatus != 0) {
that.isGoodsReturn = true;
};
@@ -961,7 +955,7 @@
*/
delOrder: function() {
let that = this;
orderDel(this.order_id).then(res => {
orderDel(this.id).then(res => {
return that.$util.Tips({
title: '删除成功',
icon: 'success'

View File

@@ -47,7 +47,7 @@
<button @click="goIndex" class='returnBnt cart-color' formType="submit" hover-class='none' v-else>返回首页</button>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -88,6 +88,16 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getOrderPayInfo();
}
},
deep:true
}
},
onLoad: function(options) {
if (!options.order_id) return this.$util.Tips({
title: '缺少参数无法查看订单支付状态'
@@ -101,13 +111,7 @@
if (this.isLogin) {
this.getOrderPayInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@@ -12,6 +12,11 @@
请点击授权
</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="name" v-if="!userInfo.uid && isWeixin" @tap="openAuto">
请点击授权
</view>
<!-- #endif -->
<view class="name" v-if="userInfo.uid">
{{userInfo.nickname}}
<view class="vip" v-if="userInfo.vip">
@@ -20,7 +25,7 @@
</view>
</view>
<view class="num" v-if="userInfo.phone" @click="goEdit()">
<view class="num-txt">ID{{userInfo.uid}}</view>
<view class="num-txt">{{userInfo.phone}}</view>
<view class="icon">
<image src="/static/images/edit.png" mode=""></image>
</view>
@@ -71,9 +76,7 @@
indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
<block v-for="(item,index) in imgUrls" :key="index">
<swiper-item>
<navigator :url='item.url' class='slide-navigator acea-row row-between-wrapper' hover-class='none'>
<image :src="item.pic" class="slide-image"></image>
</navigator>
<image :src="item.pic" class="slide-image" @click="navito(item.url)"></image>
</swiper-item>
</block>
</swiper>
@@ -92,7 +95,7 @@
<!-- #ifdef H5 -->
<view class="item" @click="kefuClick">
<view class="left">
<image src="/static/images/user_menu08.png"></image>
<image :src="servicePic"></image>
<text>联系客服</text>
</view>
<view class="iconfont icon-xiangyou"></view>
@@ -101,7 +104,7 @@
<!-- #ifdef MP -->
<button class="item" open-type='contact' hover-class='none'>
<view class="left">
<image src="/static/images/user_menu08.png"></image>
<image :src="servicePic"></image>
<text>联系客服</text>
</view>
<view class="iconfont icon-xiangyou"></view>
@@ -110,7 +113,7 @@
</view>
<img src="/static/images/support.png" alt="" class='support'>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -129,6 +132,9 @@
import {
mapGetters
} from "vuex";
// #ifdef H5
import Auth from '@/libs/wechat';
// #endif
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
@@ -184,12 +190,22 @@
orderStatusNum: {},
userInfo: {},
MyMenus: [],
wechatUrl: []
wechatUrl: [],
servicePic: '',
// #ifdef H5
isWeixin: Auth.isWeixin()
//#endif
}
},
onLoad() {
let that = this;
that.$set(that, 'MyMenus', app.globalData.MyMenus);
console.log('user页面',that.isLogin)
if (that.isLogin == false) {
// #ifdef H5 || APP-PLUS
toLogin()
// #endif
}
},
onShow: function() {
let that = this;
@@ -199,11 +215,7 @@
// this.setVisit();
this.getOrderData();
}else{
// #ifdef H5 || APP-PLUS
if (that.isLogin == false) {
toLogin();
}
// #endif
toLogin();
}
},
methods: {
@@ -213,11 +225,11 @@
// url:'/pages/user/index'
// }).then(res=>{})
// },
navito(e){
window.location.href = 'https://' + e;
},
kefuClick(){
location.href = this.wechatUrl[0].wap_url
// return this.$util.Tips({
// title: '客服功能正在开发中......'
// });
location.href = this.wechatUrl[0].wap_url;
},
getOrderData(){
let that = this;
@@ -246,8 +258,8 @@
},
// 打开授权
openAuto() {
this.isAuto = true;
this.isShowAuth = true
console.log('点击事件','lala')
toLogin();
},
// 授权回调
onLoadFun() {
@@ -277,6 +289,7 @@
* 获取个人用户信息
*/
getUserInfo: function() {
const _app = getApp();
let that = this;
getUserInfo().then(res => {
that.userInfo = res.data;
@@ -292,22 +305,27 @@
if (this.MyMenus.length) return;
getMenuList().then(res => {
that.$set(that, 'MyMenus', res.data.routine_my_menus);
// location.pathname.indexOf('auth') !== -1
// console.log( res.data.routine_my_menus.filter( item => {
// if( item.url.indexOf('service') !== -1 ) return item.wap_url
// }))
this.wechatUrl = res.data.routine_my_menus.filter((item) => {
that.wechatUrl = res.data.routine_my_menus.filter((item) => {
return item.url.indexOf('service') !== -1
})
console.log(this.wechatUrl)
this.imgUrls = res.data.routine_my_banner
res.data.routine_my_menus.map((item) => {
if(item.url.indexOf('service') !==-1) that.servicePic = item.pic
})
that.imgUrls = res.data.routine_my_banner
});
},
// 编辑页面
goEdit() {
uni.navigateTo({
url: '/pages/users/user_info/index'
})
if (this.isLogin == false) {
toLogin();
} else {
uni.navigateTo({
url: '/pages/users/user_info/index'
})
}
// uni.navigateTo({
// url: '/pages/users/user_info/index'
// })
},
// 签到
goSignIn() {
@@ -391,13 +409,12 @@
.vip {
display: flex;
align-items: center;
height: 36rpx;
padding: 0 20rpx;
padding: 6rpx 20rpx;
background: rgba(0, 0, 0, 0.2);
border-radius: 18px;
font-size: 20rpx;
margin-left: 12rpx;
margin-top: 2rpx;
// margin-top: 2rpx;
image {
width: 27rpx;

View File

@@ -32,7 +32,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -74,18 +74,23 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getBrokerageRankList();
this.getBrokerageRankNumber(this.type);
}
},
deep:true
}
},
onLoad() {
if (this.isLogin) {
this.getBrokerageRankList();
this.getBrokerageRankNumber(this.type);
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {

View File

@@ -40,7 +40,7 @@
</view>
</form>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -92,6 +92,16 @@
};
},
computed: mapGetters(['isLogin']),
watch: {
isLogin: {
handler: function(newV, oldV) {
if (newV) {
this.getOrderProduct();
}
},
deep: true
}
},
onLoad(options) {
if (!options.unique || !options.uni || !options.id) return this.$util.Tips({
title: '缺少参数'
@@ -106,13 +116,7 @@
if (this.isLogin) {
this.getOrderProduct();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {

View File

@@ -98,7 +98,9 @@
that.$set(that,'reply',that.reply);
that.loading = false;
that.loadend = loadend;
that.loadTitle = loadend ? "😕人家是有底线的~~" : "加载更多";
if(that.reply.length){
that.loadTitle = loadend ? "😕人家是有底线的~~" : "加载更多";
}
that.page = that.page + 1;
}).catch(err => {
that.loading = false,

View File

@@ -14,7 +14,7 @@
<!-- #ifdef H5 -->
<a class="store-phone" :href="'tel:' + item.phone"><span class="iconfont icon-dadianhua01"></span></a>
<!-- #endif -->
<!-- #ifdef MP -->
<!-- #ifdef MP || APP-PLUS -->
<view class="store-phone" @click="call(item.phone)"><text class="iconfont icon-dadianhua01"></text></view>
<!-- #endif -->
</div>

View File

@@ -40,7 +40,7 @@
<recommend :hostProduct='hostProduct' v-if="hostProduct.length"></recommend>
</view>
<!-- #ifdef MP -->
<authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -78,10 +78,27 @@
},
orderInfo: {},
expressList: [],
hostProduct: []
hostProduct: [],
loading: false,
goodScroll: true,
params: { //精品推荐分页
page: 1,
limit: 10,
},
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getExpress();
this.get_host_product();
}
},
deep:true
}
},
onLoad: function (options) {
if (!options.orderId) return this.$util.Tips({title:'缺少订单号'});
this.orderId = options.orderId;
@@ -89,13 +106,7 @@
this.getExpress();
this.get_host_product();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onReady: function() {
@@ -133,13 +144,43 @@
/**
* 获取我的推荐
*/
// getGroomList(onloadH) {
// this.loading = true
// if (!this.goodScroll) return
// if (onloadH) {
// this.iSshowH = true
// }
// getGroomList(type, this.params).then(({
// data
// }) => {
// this.iSshowH = false
// this.loading = false
// this.goodScroll = data.list.length >= this.params.limit
// this.params.page++
// this.tempArr = this.tempArr.concat(data.list)
// })
// }
get_host_product: function () {
this.loading = true
if (!this.goodScroll) return
let that = this;
getProductHot().then(function (res) {
that.$set(that,'hostProduct',res.data.list);
getProductHot(that.params.page,that.params.limit).then(function (res) {
//this.iSshowH = false
that.loading = false
that.goodScroll = res.data.list.length >= that.params.limit
that.params.page++
that.hostProduct = that.hostProduct.concat(res.data.list)
// that.$set(that,'hostProduct',res.data.list);
});
},
}
},
// 滚动到底部
onReachBottom() {
if (this.params.page != 1) {
this.get_host_product();
}
},
}
</script>

View File

@@ -59,7 +59,7 @@
</view>
</form>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -93,6 +93,17 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getOrderInfo();
this.getRefundReason();
}
},
deep:true
}
},
onLoad: function (options) {
if (!options.orderId) return this.$util.Tips({title:'缺少订单id,无法退款'},{tab:3,url:1});
this.orderId = options.orderId;
@@ -100,13 +111,7 @@
this.getOrderInfo();
this.getRefundReason();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@@ -1,47 +1,36 @@
<template>
<div class="register absolute">
<div class="login-wrapper">
<div class="shading">
<div class="pictrue acea-row row-center-wrapper">
<image :src="logoUrl" v-if="logoUrl" />
<image src="../../../static/images/logo2.png" v-else />
</div>
<image :src="logoUrl" v-if="logoUrl" />
<image src="/static/images/logo2.png" v-else />
</div>
<div class="whiteBg" v-if="formItem === 1">
<div class="title acea-row row-center-wrapper">
<div class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" @click="navTap(index)"
:key="index">
{{ item }}
</div>
</div>
<div class="list" :hidden="current !== 1">
<div class="list" v-if="current !== 1">
<form @submit.prevent="submit">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<image src="/static/images/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
<input type="text" placeholder="输入手机号码" v-model="account" required />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
<input type="password" placeholder="填写登录密码" v-model="password" required />
</div>
</div>
</form>
<!-- <navigator class="forgetPwd" hover-class="none" url="/pages/users/retrievePassword/index">
<span class="iconfont icon-wenti"></span>忘记密码
</navigator> -->
</div>
<div class="list" :hidden="current !== 0">
<div class="list" v-if="current !== 0 || appLoginStatus || appleLoginStatus">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<image src="/static/images/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
<input type="text" placeholder="输入手机号码" v-model="account" />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">
{{ text }}
@@ -50,59 +39,44 @@
</div>
<div class="item" v-if="isShowCode">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
<div class="code" @click="again"><img :src="codeUrl" /></div>
</div>
</div>
</div>
<div class="logon" @click="loginMobile" :hidden="current !== 0">登录</div>
<div class="logon" @click="submit" :hidden="current === 0">登录</div>
<div class="tip">
<div :hidden="current !== 1">
没有账号?
<span @click="current = 0" class="font-color-red">快速登录</span>
</div>
<div class="logon" @click="loginMobile" v-if="current !== 0">登录</div>
<div class="logon" @click="submit" v-if="current === 0">登录</div>
<!-- #ifndef APP-PLUS -->
<div class="tips">
<div v-if="current==0" @click="current = 1">快速登录</div>
<div v-if="current==1" @click="current = 0">账号登录</div>
</div>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view class="appLogin" v-if="!appLoginStatus && !appleLoginStatus">
<view class="hds">
<span class="line"></span>
<p>其他方式登录</p>
<span class="line"></span>
</view>
<view class="btn-wrapper">
<view class="btn wx" @click="wxLogin">
<span class="iconfont icon-s-weixindenglu1"></span>
</view>
<view class="btn mima" v-if="current == 1" @click="current =0">
<span class="iconfont icon-s-mimadenglu1"></span>
</view>
<view class="btn yanzheng" v-if="current == 0" @click="current =1">
<span class="iconfont icon-s-yanzhengmadenglu1"></span>
</view>
<view class="apple-btn" @click="appleLogin" v-if="appleShow">
<view class="iconfont icon-s-pingguo"></view>通过Apple登录
</view>
</view>
</view>
<!-- #endif -->
</div>
<!-- <div class="whiteBg" v-else>
<div class="title">注册账号</div>
<div class="list">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入手机号码" v-model="account" />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">
{{ text }}
</button>
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_1.png"></image>
<input type="password" placeholder="填写您的登录密码" v-model="password" />
</div>
</div>
<div class="item" v-if="isShowCode">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
<div class="code" @click="again"><img :src="codeUrl" /></div>
</div>
</div>
</div>
<div class="logon" @click="register">注册</div>
<div class="tip">
已有账号?
<span @click="formItem = 1" class="font-color-red">立即登录</span>
</div>
</div> -->
<div class="bottom"></div>
</div>
</template>
@@ -150,7 +124,12 @@
keyCode: "",
codeUrl: "",
codeVal: "",
isShowCode: false
isShowCode: false,
appLoginStatus: false, // 微信登录强制绑定手机号码状态
appUserInfo: null, // 微信登录保存的用户信息
appleLoginStatus: false, // 苹果登录强制绑定手机号码状态
appleUserInfo: null,
appleShow: false // 苹果登录版本必须要求ios13以上的
};
},
watch:{
@@ -167,6 +146,138 @@
this.getLogoImage();
},
methods: {
// 苹果登录
appleLogin() {
let self = this
this.account = ''
this.captcha = ''
uni.showLoading({
title: '登录中'
})
uni.login({
provider: 'apple',
timeout: 10000,
success(loginRes) {
console.log(loginRes, 'loginRes')
uni.getUserInfo({
provider: 'apple',
success: function(infoRes) {
console.log(infoRes.userInfo, 'yyyy')
self.appleUserInfo = infoRes.userInfo
self.appleLoginApi()
console.log(self.$store);
console.log(infoRes.userInfo);
},
fail() {
uni.showToast({
title: '获取用户信息失败',
icon: 'none',
duration: 2000
})
},
complete() {
uni.hideLoading()
}
});
},
fail(error) {
console.log(error)
}
})
},
// 苹果登录Api
appleLoginApi() {
let self = this
appleLogin({
openId: self.appleUserInfo.openId,
email: self.appleUserInfo.email || '',
phone: this.account,
captcha: this.captcha
}).then(({
data
}) => {
if (data.isbind) {
uni.showModal({
title: '提示',
content: '请绑定手机号后,继续操作',
showCancel: false,
success: function(res) {
if (res.confirm) {
self.current = 1
self.appleLoginStatus = true
}
}
});
} else {
self.$store.commit("LOGIN", {
'token': data.token,
'time': data.expires_time - self.$Cache.time()
});
let backUrl = self.$Cache.get(BACK_URL) || "/pages/index/index";
self.$Cache.clear(BACK_URL);
self.$store.commit("SETUID", data.userInfo.uid);
uni.reLaunch({
url: backUrl
});
}
}).catch(error => {
uni.showModal({
title: '提示',
content: `错误信息${error}`,
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
})
},
// App微信登录
wxLogin() {
let self = this
this.account = ''
this.captcha = ''
uni.showLoading({
title: '登录中'
})
uni.login({
provider: 'weixin',
success: function(loginRes) {
// 获取用户信息
uni.getUserInfo({
provider: 'weixin',
success: function(infoRes) {
console.log(infoRes.userInfo, 'yyyy')
self.appUserInfo = infoRes.userInfo
self.wxLoginApi()
console.log(self.$store);
console.log(infoRes.userInfo);
},
fail() {
uni.showToast({
title: '获取用户信息失败',
icon: 'none',
duration: 2000
})
},
complete() {
uni.hideLoading()
}
});
},
fail() {
uni.showToast({
title: '登录失败',
icon: 'none',
duration: 2000
})
}
});
},
again() {
this.codeUrl =
VUE_APP_API_URL +
@@ -221,8 +332,9 @@
});
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
// getUserInfo().then(res => {
that.$store.commit("SETUID", res.data.user.uid);
getUserInfo().then(res => {
that.$store.commit("UPDATE_USERINFO", res.data);
that.$store.commit("SETUID", res.data.uid);
if (backUrl === '/pages/index/index' || backUrl === '/pages/order_addcart/order_addcart' || backUrl ===
'/pages/user/index') {
@@ -231,11 +343,12 @@
});
} else {
uni.switchTab({
url: '/pages/index/index'
});
uni.navigateBack()
// uni.switchTab({
// url: '/pages/index/index'
// });
}
// })
})
})
.catch(res => {
that.$util.Tips({
@@ -304,7 +417,7 @@
// that.codeUrl = `${VUE_APP_API_URL}/sms_captcha?key=${that.keyCode}`;
// that.isShowCode = true;
// }
that.$util.Tips({title:res});
that.$util.Tips({title:res.message});
});
},
navTap: function(index) {
@@ -324,7 +437,7 @@
loginH5({
account: that.account,
password: that.password,
spread_spid: that.$Cache.get("spread")
spread: that.$Cache.get("spread")
})
.then(({
data
@@ -337,6 +450,7 @@
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
getUserInfo().then(res => {
that.$store.commit("UPDATE_USERINFO", res.data);
that.$store.commit("SETUID", res.data.uid);
if (backUrl === '/pages/index/index' || backUrl === '/pages/order_addcart/order_addcart' || backUrl ==='/pages/user/index') {
uni.switchTab({
@@ -347,11 +461,7 @@
url: '/pages/index/index'
});
}
}).catch(e => {
that.$util.Tips({
title: e
});
});
})
})
.catch(e => {
that.$util.Tips({
@@ -362,7 +472,81 @@
}
};
</script>
<style lang="scss">
<style lang="scss" scoped>
.appLogin {
margin-top: 60rpx;
.hds {
display: flex;
justify-content: center;
align-items: center;
font-size: 24rpx;
color: #B4B4B4;
.line {
width: 68rpx;
height: 1rpx;
background: #CCCCCC;
}
p {
margin: 0 20rpx;
}
}
.btn-wrapper {
display: flex;
align-items: center;
justify-content: center;
margin-top: 30rpx;
.btn {
display: flex;
align-items: center;
justify-content: center;
width: 68rpx;
height: 68rpx;
border-radius: 50%;
}
.apple-btn {
display: flex;
align-items: center;
justify-content: center;
width: 246rpx;
height: 66rpx;
margin-left: 30rpx;
background: #EAEAEA;
border-radius: 34rpx;
font-size: 24rpx;
.icon-s-pingguo {
color: #333;
margin-right: 10rpx;
font-size: 34rpx;
}
}
.iconfont {
font-size: 40rpx;
color: #fff;
}
.wx {
margin-right: 30rpx;
background-color: #61C64F;
}
.mima {
background-color: #28B3E9;
}
.yanzheng {
background-color: #F89C23;
}
}
}
.code img {
width: 100%;
height: 100%;
@@ -371,6 +555,67 @@
.acea-row.row-middle {
input {
margin-left: 20rpx;
display: block;
}
}
.login-wrapper{
padding: 30rpx;
.shading{
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 200rpx;
margin-top: 200rpx;
image{
width: 180rpx;
height: 180rpx;
}
}
.whiteBg{
margin-top: 100rpx;
.list{
border-radius: 16rpx;
overflow: hidden;
.item{
border-bottom: 1px solid #F0F0F0;
background: #fff;
.row-middle{
position: relative;
padding: 30rpx 45rpx;
input{
flex: 1;
font-size: 28rpx;
height: 80rpx;
}
.code{
position: absolute;
right: 30rpx;
top: 50%;
color: #E93323;
font-size: 26rpx;
transform: translateY(-50%);
}
}
}
}
.logon{
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 86rpx;
margin-top: 100rpx;
background-color: $theme-color;
border-radius: 120rpx;
color: #FFFFFF;
font-size: 30rpx;
}
.tips{
margin:30rpx;
text-align: center;
color: #999;
}
}
}
</style>

View File

@@ -1,372 +0,0 @@
<template>
<div class="register absolute">
<div class="shading">
<div class="pictrue acea-row row-center-wrapper">
<image :src="logoUrl" v-if="logoUrl" />
<image src="../../../static/images/logo2.png" v-else />
</div>
</div>
<div class="whiteBg" v-if="formItem === 1">
<div class="title acea-row row-center-wrapper">
<div class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" @click="navTap(index)"
:key="index">
{{ item }}
</div>
</div>
<div class="list" :hidden="current !== 1">
<form @submit.prevent="submit">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入手机号码" v-model="account" required />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="password" placeholder="填写登录密码" v-model="password" required />
</div>
</div>
</form>
<!-- <navigator class="forgetPwd" hover-class="none" url="/pages/users/retrievePassword/index">
<span class="iconfont icon-wenti"></span>忘记密码
</navigator> -->
</div>
<div class="list" :hidden="current !== 0">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入手机号码" v-model="account" />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">
{{ text }}
</button>
</div>
</div>
<div class="item" v-if="isShowCode">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
<div class="code" @click="again"><img :src="codeUrl" /></div>
</div>
</div>
</div>
<div class="logon" @click="loginMobile" :hidden="current !== 0">登录</div>
<div class="logon" @click="submit" :hidden="current === 0">登录</div>
<div class="tip">
<div :hidden="current !== 1">
没有账号?
<span @click="current = 0" class="font-color-red">快速登录</span>
</div>
</div>
</div>
<!-- <div class="whiteBg" v-else>
<div class="title">注册账号</div>
<div class="list">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入手机号码" v-model="account" />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">
{{ text }}
</button>
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_1.png"></image>
<input type="password" placeholder="填写您的登录密码" v-model="password" />
</div>
</div>
<div class="item" v-if="isShowCode">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
<div class="code" @click="again"><img :src="codeUrl" /></div>
</div>
</div>
</div>
<div class="logon" @click="register">注册</div>
<div class="tip">
已有账号?
<span @click="formItem = 1" class="font-color-red">立即登录</span>
</div>
</div> -->
<div class="bottom"></div>
</div>
</template>
<script>
import dayjs from "@/plugin/dayjs/dayjs.min.js";
import sendVerifyCode from "@/mixins/SendVerifyCode";
import {
loginH5,
loginMobile,
registerVerify,
register,
// getCodeApi,
getUserInfo
} from "@/api/user";
import attrs, {
required,
alpha_num,
chs_phone
} from "@/utils/validate";
import {
validatorDefaultCatch
} from "@/utils/dialog";
import {
getLogo
} from "@/api/public";
import {
VUE_APP_API_URL
} from "@/utils";
const BACK_URL = "login_back_url";
export default {
name: "Login",
mixins: [sendVerifyCode],
data: function() {
return {
navList: ["快速登录", "账号登录"],
current: 0,
account: "",
password: "",
captcha: "",
formItem: 1,
type: "login",
logoUrl: "",
keyCode: "",
codeUrl: "",
codeVal: "",
isShowCode: false
};
},
watch:{
formItem:function(nval,oVal){
if(nval == 1){
this.type = 'login'
}else{
this.type = 'register'
}
}
},
mounted: function() {
this.getCode();
this.getLogoImage();
},
methods: {
again() {
this.codeUrl =
VUE_APP_API_URL +
"/sms_captcha?" +
"key=" +
this.keyCode +
Date.parse(new Date());
},
getCode() {
let that = this
// getCodeApi()
// .then(res => {
// that.keyCode = res.data.key;
// })
// .catch(res => {
// that.$util.Tips({
// title: res
// });
// });
},
async getLogoImage() {
let that = this;
getLogo().then(res => {
that.logoUrl = res.data.logoUrl;
});
},
async loginMobile() {
let that = this;
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (!that.captcha) return that.$util.Tips({
title: '请填写验证码'
});
if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
title: '请输入正确的验证码'
});
loginMobile({
account: that.account,
captcha: that.captcha,
spread: that.$Cache.get("spread")
})
.then(res => {
let data = res.data;
let newTime = Math.round(new Date() / 1000);
that.$store.commit("LOGIN", {
'token': data.token
// 'time': dayjs(data.expiresTime) - newTime
});
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
// getUserInfo().then(res => {
that.$store.commit("SETUID", res.data.user.uid);
if (backUrl === '/pages/index/index' || backUrl === '/pages/order_addcart/order_addcart' || backUrl ===
'/pages/user/index') {
uni.switchTab({
url: backUrl
});
} else {
uni.switchTab({
url: '/pages/index/index'
});
}
// })
})
.catch(res => {
that.$util.Tips({
title: res
});
});
},
async register() {
let that = this;
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (!that.captcha) return that.$util.Tips({
title: '请填写验证码'
});
if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
title: '请输入正确的验证码'
});
if (!that.password) return that.$util.Tips({
title: '请填写密码'
});
if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/i.test(that.password)) return that.$util.Tips({
title: '您输入的密码过于简单'
});
register({
account: that.account,
captcha: that.captcha,
password: that.password,
spread: that.$Cache.get("spread")
})
.then(res => {
that.$util.Tips({
title: res
});
that.formItem = 1;
})
.catch(res => {
that.$util.Tips({
title: res
});
});
},
async code() {
let that = this;
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (that.formItem == 2) that.type = "register";
// phone: that.account
// type: that.type,
// key: that.keyCode,
// code: that.codeVal
await registerVerify(that.account)
.then(res => {
that.$util.Tips({title:res.message});
that.sendCode();
})
.catch(res => {
// if (res.data.status === 402) {
// that.codeUrl = `${VUE_APP_API_URL}/sms_captcha?key=${that.keyCode}`;
// that.isShowCode = true;
// }
that.$util.Tips({title:res.message});
});
},
navTap: function(index) {
this.current = index;
},
async submit() {
let that = this;
if (!that.account) return that.$util.Tips({
title: '请填写账号'
});
if (!/^[\w\d]{5,16}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的账号'
});
if (!that.password) return that.$util.Tips({
title: '请填写密码'
});
loginH5({
account: that.account,
password: that.password,
spread: that.$Cache.get("spread")
})
.then(({
data
}) => {
// let newTime = Math.round(new Date() / 1000);
that.$store.commit("LOGIN", {
'token': data.token
// 'time': dayjs(data.expiresTime) - newTime
});
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
getUserInfo().then(res => {
that.$store.commit("SETUID", res.data.uid);
if (backUrl === '/pages/index/index' || backUrl === '/pages/order_addcart/order_addcart' || backUrl ==='/pages/user/index') {
uni.switchTab({
url: backUrl
});
} else {
uni.switchTab({
url: '/pages/index/index'
});
}
})
})
.catch(e => {
that.$util.Tips({
title: e
});
});
}
}
};
</script>
<style lang="scss">
.code img {
width: 100%;
height: 100%;
}
.acea-row.row-middle {
input {
margin-left: 20rpx;
}
}
</style>

View File

@@ -142,7 +142,7 @@
<addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :address='address' :pagesUrl="pagesUrl"
@OnChangeAddress="OnChangeAddress" @changeClose="changeClose"></addressWindow>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -280,6 +280,17 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getaddressInfo();
this.getConfirm();
}
},
deep:true
}
},
onLoad: function(options) {
// #ifdef H5
this.payChannel = this.$wechat.isWeixin() ? 'public' : 'weixinh5'
@@ -310,13 +321,7 @@
//调用子页面方法授权后执行获取地址列表
this.$nextTick(function() {})
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
/**

View File

@@ -93,7 +93,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
<payment :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :order_id="pay_order_id" :totalPrice='totalPrice'></payment>
@@ -173,13 +173,7 @@
this.getOrderList();
this.getUserInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@@ -69,7 +69,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -119,13 +119,7 @@
if (this.isLogin) {
this.userSpreadNewList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
onShow: function() {

View File

@@ -46,7 +46,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -92,13 +92,7 @@
if (this.isLogin) {
this.getRecordOrderList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {

View File

@@ -10,21 +10,21 @@
</view>
</view>
<view class="rank acea-row row-bottom row-around">
<view class="item" v-if="Two.uid">
<view class="item" v-show="Two.uid">
<view class="pictrue">
<image :src="Two.avatar"></image>
</view>
<view class="name line1">{{Two.nickname}}</view>
<view class="num">{{Two.spreadCount}}</view>
</view>
<view class="item" v-if="One.uid">
<view class="item" v-show="One.uid">
<view class="pictrue">
<image :src="One.avatar"></image>
</view>
<view class="name line1">{{One.nickname}}</view>
<view class="num">{{One.spreadCount}}</view>
</view>
<view class="item" v-if="Three.uid">
<view class="item" v-show="Three.uid">
<view class="pictrue">
<image :src="Three.avatar"></image>
</view>
@@ -48,7 +48,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -93,17 +93,21 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getRanklist();
}
},
deep:true
}
},
onLoad() {
if (this.isLogin) {
this.getRanklist();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
// onShow: function () {

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -43,7 +43,7 @@
</view>
</form>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -102,6 +102,17 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserAddress();
this.getCityList();
}
},
deep:true
}
},
onLoad(options) {
if (this.isLogin) {
this.cartId = options.cartId || '';
@@ -120,13 +131,7 @@
// this.initialize();
// }
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {

View File

@@ -1,537 +0,0 @@
<template>
<view>
<form @submit="formSubmit" report-submit='true'>
<view class='addAddress'>
<view class='list'>
<view class='item acea-row row-between-wrapper'>
<view class='name'>姓名</view>
<input type='text' placeholder='请输入姓名' name='real_name' :value="userAddress.real_name" placeholder-class='placeholder'></input>
</view>
<view class='item acea-row row-between-wrapper'>
<view class='name'>联系电话</view>
<input type='text' placeholder='请输入联系电话' name="phone" :value='userAddress.phone' placeholder-class='placeholder'></input>
</view>
<view class='item acea-row row-between-wrapper'>
<view class='name'>所在地区</view>
<view class="address">
<picker mode="multiSelector" @change="bindRegionChange" @columnchange="bindMultiPickerColumnChange" :value="valueRegion"
:range="multiArray">
<view class='acea-row'>
<view class="picker">{{region[0]}}{{region[1]}}{{region[2]}}</view>
<view class='iconfont icon-dizhi font-color'></view>
</view>
</picker>
</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view class='name'>详细地址</view>
<input type='text' placeholder='请填写具体地址' name='detail' placeholder-class='placeholder' :value='userAddress.detail'></input>
</view>
</view>
<view class='default acea-row row-middle'>
<checkbox-group @change='ChangeIsDefault'>
<checkbox :checked="userAddress.is_default ? true : false" />设置为默认地址</checkbox-group>
</view>
<button class='keepBnt bg-color' form-type="submit">立即保存</button>
<!-- #ifdef MP -->
<view class="wechatAddress" v-if="!id" @click="getWxAddress">导入微信地址</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="wechatAddress" v-if="this.$wechat.isWeixin() && !id" @click="getAddress">导入微信地址</view>
<!-- #endif -->
</view>
</form>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
</template>
<script>
import {
editAddress,
getAddressDetail
} from '@/api/user.js';
import {
getCity
} from '@/api/api.js';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
import wPicker from "@/components/wPicker/w-picker.vue";
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
import home from '@/components/home';
import city from '@/utils/city';
export default {
components: {
// #ifdef MP
authorize,
// #endif
home
},
data() {
return {
regionDval: ['浙江省', '杭州市', '滨江区'],
cartId: '', //购物车id
pinkId: 0, //拼团id
couponId: 0, //优惠券id
id: 0, //地址id
userAddress: {
is_default: false
}, //地址详情
region: ['省', '市', '区'],
valueRegion: [0, 0, 0],
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
district: [],
multiArray: [],
multiIndex: [0, 0, 0],
cityId: 0,
defaultRegion: ['广东省', '广州市', '番禺区'],
defaultRegionCode: '440113'
};
},
computed: mapGetters(['isLogin']),
onLoad(options) {
if (this.isLogin) {
this.cartId = options.cartId || '';
this.pinkId = options.pinkId || 0;
this.couponId = options.couponId || 0;
this.id = options.id || 0;
uni.setNavigationBarTitle({
title: options.id ? '修改地址' : '添加地址'
})
this.getUserAddress();
this.getCityList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {
// 回去地址数据
getCityList: function() {
let that = this;
getCity().then(res => {
this.district = res.data
that.initialize();
})
},
initialize: function() {
let that = this,
province = [],
city = [],
area = [];
if (that.district.length) {
let cityChildren = that.district[0].c || [];
let areaChildren = cityChildren.length ? (cityChildren[0].c || []) : [];
that.district.forEach(function(item) {
province.push(item.n);
});
cityChildren.forEach(function(item) {
city.push(item.n);
});
areaChildren.forEach(function(item) {
area.push(item.n);
});
this.multiArray = [province, city, area]
}
},
bindRegionChange: function(e) {
let multiIndex = this.multiIndex,
province = this.district[multiIndex[0]] || {
c: []
},
city = province.c[multiIndex[1]] || {
v: 0
},
multiArray = this.multiArray,
value = e.detail.value;
this.region = [multiArray[0][value[0]], multiArray[1][value[1]], multiArray[2][value[2]]]
// this.$set(this.region,0,multiArray[0][value[0]]);
// this.$set(this.region,1,multiArray[1][value[1]]);
// this.$set(this.region,2,multiArray[2][value[2]]);
this.cityId = city.v
this.valueRegion = [0, 0, 0]
this.initialize();
},
bindMultiPickerColumnChange: function(e) {
let that = this,
column = e.detail.column,
value = e.detail.value,
currentCity = this.district[value] || {
c: []
},
multiArray = that.multiArray,
multiIndex = that.multiIndex;
multiIndex[column] = value;
switch (column) {
case 0:
let areaList = currentCity.c[0] || {
c: []
};
multiArray[1] = currentCity.c.map((item) => {
return item.n;
});
multiArray[2] = areaList.c.map((item) => {
return item.n;
});
break;
case 1:
let cityList = that.district[multiIndex[0]].c[multiIndex[1]].c || [];
multiArray[2] = cityList.map((item) => {
return item.n;
});
break;
case 2:
break;
}
// #ifdef MP
this.$set(this.multiArray, 0, multiArray[0]);
this.$set(this.multiArray, 1, multiArray[1]);
this.$set(this.multiArray, 2, multiArray[2]);
// #endif
// #ifdef H5
this.multiArray = multiArray;
// #endif
this.multiIndex = multiIndex
// this.setData({ multiArray: multiArray, multiIndex: multiIndex});
},
// 授权回调
onLoadFun: function() {
this.getUserAddress();
},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e
},
toggleTab(str) {
this.$refs[str].show();
},
// bindRegionChange: function(e) {
// this.$set(this, 'region', e.detail.value);
// },
onConfirm(val) {
this.region = val.checkArr[0] + '-' + val.checkArr[1] + '-' + val.checkArr[2];
},
getUserAddress: function() {
if (!this.id) return false;
let that = this;
getAddressDetail(this.id).then(res => {
// let region = [res.data.province, res.data.city, res.data.district];
let region = [res.data.province, res.data.city, res.data.district];
that.$set(that, 'userAddress', res.data);
that.$set(that, 'region', region);
that.city_id = res.data.city_id
});
},
// 导入共享地址(小程序)
getWxAddress: function() {
let that = this;
uni.authorize({
scope: 'scope.address',
success: function(res) {
uni.chooseAddress({
success: function(res) {
let addressP = {};
addressP.province = res.provinceName;
addressP.city = res.cityName;
addressP.district = res.countyName;
editAddress({
address: addressP,
is_default: 1,
real_name: res.userName,
post_code: res.postalCode,
phone: res.telNumber,
detail: res.detailInfo,
id: 0,
type: 1,
}).then(res => {
setTimeout(function() {
if (that.cartId) {
let cartId = that.cartId;
let pinkId = that.pinkId;
let couponId = that.couponId;
that.cartId = '';
that.pinkId = '';
that.couponId = '';
uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + cartId + '&addressId=' + (that.id ? that.id :
res.data
.id) + '&pinkId=' + pinkId + '&couponId=' + couponId
});
} else {
uni.navigateBack({
delta: 1
});
}
}, 1000);
return that.$util.Tips({
title: "添加成功",
icon: 'success'
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
},
fail: function(res) {
if (res.errMsg == 'chooseAddress:cancel') return that.$util.Tips({
title: '取消选择'
});
},
})
},
fail: function(res) {
uni.showModal({
title: '您已拒绝导入微信地址权限',
content: '是否进入权限管理,调整授权?',
success(res) {
if (res.confirm) {
uni.openSetting({
success: function(res) {}
});
} else if (res.cancel) {
return that.$util.Tips({
title: '已取消!'
});
}
}
})
},
})
},
// 导入共享地址(微信);
getAddress() {
let that = this;
that.$wechat.openAddress().then(userInfo => {
open();
editAddress({
id: this.id,
real_name: userInfo.userName,
phone: userInfo.telNumber,
address: {
province: userInfo.provinceName,
city: userInfo.cityName,
district: userInfo.countryName
},
detail: userInfo.detailInfo,
is_default: 1,
post_code: userInfo.postalCode,
type: 1,
})
.then(() => {
setTimeout(function() {
if (that.cartId) {
let cartId = that.cartId;
let pinkId = that.pinkId;
let couponId = that.couponId;
that.cartId = '';
that.pinkId = '';
that.couponId = '';
uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + cartId + '&addressId=' + (that.id ? that.id :
res.data
.id) + '&pinkId=' + pinkId + '&couponId=' + couponId
});
} else {
uni.navigateTo({
url:'/pages/users/user_address_list/index'
})
// history.back();
}
}, 1000);
close();
that.$util.Tips({
title: "添加成功",
icon: 'success'
});
})
.catch(err => {
close();
return that.$util.Tips({
title: err || "添加失败"
});
});
}).catch(err => {
console.log(err);
});
},
/**
* 提交用户添加地址
*
*/
formSubmit: function(e) {
let that = this,
value = e.detail.value;
if (!value.real_name) return that.$util.Tips({
title: '请填写收货人姓名'
});
if (!value.phone) return that.$util.Tips({
title: '请填写联系电话'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(value.phone)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (that.region == '省-市-区') return that.$util.Tips({
title: '请选择所在地区'
});
if (!value.detail) return that.$util.Tips({
title: '请填写详细地址'
});
value.id = that.id;
let regionArray = that.region;
value.address = {
province: regionArray[0],
city: regionArray[1],
district: regionArray[2],
city_id: that.cityId,
};
value.is_default = that.userAddress.is_default ? 1 : 0;
uni.showLoading({
title: '保存中',
mask: true
})
editAddress(value).then(res => {
if (that.id)
that.$util.Tips({
title: '修改成功',
icon: 'success'
});
else
that.$util.Tips({
title: '添加成功',
icon: 'success'
});
setTimeout(function() {
if (that.cartId) {
let cartId = that.cartId;
let pinkId = that.pinkId;
let couponId = that.couponId;
that.cartId = '';
that.pinkId = '';
that.couponId = '';
uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + cartId + '&addressId=' + (that.id ? that.id : res.data.id) +'&pinkId=' + pinkId + '&couponId=' + couponId
});
} else {
// #ifdef H5
return history.back();
// #endif
// #ifndef H5
return uni.navigateBack({
delta: 1,
})
// #endif
}
}, 1000);
}).catch(err => {
return that.$util.Tips({
title: err
});
})
},
ChangeIsDefault: function(e) {
this.$set(this.userAddress, 'is_default', !this.userAddress.is_default);
}
}
}
</script>
<style scoped lang="scss">
.addAddress .list {
background-color: #fff;
}
.addAddress .list .item {
padding: 30rpx;
border-top: 1rpx solid #eee;
}
.addAddress .list .item .name {
width: 195rpx;
font-size: 30rpx;
color: #333;
}
.addAddress .list .item .address {
// width: 412rpx;
flex: 1;
margin-left: 20rpx;
}
.addAddress .list .item input {
width: 475rpx;
font-size: 30rpx;
}
.addAddress .list .item .placeholder {
color: #ccc;
}
.addAddress .list .item picker {
width: 475rpx;
}
.addAddress .list .item picker .picker {
width: 410rpx;
font-size: 30rpx;
}
.addAddress .list .item picker .iconfont {
font-size: 43rpx;
}
.addAddress .default {
padding: 0 30rpx;
height: 90rpx;
background-color: #fff;
margin-top: 23rpx;
}
.addAddress .default checkbox {
margin-right: 15rpx;
}
.addAddress .keepBnt {
width: 690rpx;
height: 86rpx;
border-radius: 50rpx;
text-align: center;
line-height: 86rpx;
margin: 50rpx auto;
font-size: 32rpx;
color: #fff;
}
.addAddress .wechatAddress {
width: 690rpx;
height: 86rpx;
border-radius: 50rpx;
text-align: center;
line-height: 86rpx;
margin: 0 auto;
font-size: 32rpx;
color: #fe960f;
border: 1px solid #fe960f;
}
</style>

View File

@@ -52,7 +52,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -102,6 +102,16 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserAddress(true);
}
},
deep:true
}
},
onLoad(options) {
if (this.isLogin) {
this.cartId = options.cartId || '';
@@ -112,13 +122,7 @@
this.bargain = options.bargain || false;
this.getAddressList(true);
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
onShow: function() {

View File

@@ -31,7 +31,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -78,13 +78,7 @@
if (this.isLogin) {
this.getUserBillList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
/**
@@ -116,6 +110,7 @@
getUserBillList: function() {
let that = this;
if (that.loadend) return;
if (that.loading) return;
that.loading = true;
that.loadTitle = "";
@@ -126,7 +121,7 @@
}
getBillList(data).then(function(res) {
let list = res.data.list?res.data.list:[],
loadend = list.length < that.limit;
loadend = res.data.list < res.data.limit;
that.userBillList = that.$util.SplitArray(list, that.userBillList);
that.$set(that, 'userBillList', that.userBillList);
that.loadend = loadend;

View File

@@ -108,7 +108,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -165,19 +165,24 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserInfo();
this.getUserExtractBank();
}
},
deep:true
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo();
this.getUserExtractBank();
//this.getBrokerageCommission();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@@ -3,8 +3,8 @@
<view class='coupon-list' v-if="couponsList.length">
<view class='item acea-row row-center-wrapper' v-for='(item,index) in couponsList' :key="index">
<view class='money' :class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'moneyGray' : ''">
<view><text class='num'>{{item.money}}</text></view>
<view class="pic-num">{{ item.minPrice }}元可用</view>
<view><text class='num'>{{item.money?Number(item.money):''}}</text></view>
<view class="pic-num">{{ item.minPrice?Number(item.minPrice):'' }}元可用</view>
</view>
<view class='text'>
<view class='condition line2'>
@@ -26,7 +26,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -73,17 +73,21 @@
};
},
computed: mapGetters(['isLogin']),
watch: {
isLogin: {
handler: function(newV, oldV) {
if (newV) {
this.getUseCoupons();
}
},
deep: true
}
},
onLoad() {
if (this.isLogin) {
this.getUseCoupons();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {

View File

@@ -3,8 +3,8 @@
<view class='coupon-list' v-if="couponsList.length">
<view class='item acea-row row-center-wrapper' v-for="(item,index) in couponsList" :key="index">
<view class='money' :class='item.isUse ? "moneyGray" : "" '>
<view><text class='num'>{{item.money}}</text></view>
<view class="pic-num">{{item.minPrice}}元可用</view>
<view><text class='num'>{{item.money?Number(item.money):''}}</text></view>
<view class="pic-num">{{item.minPrice?Number(item.minPrice):''}}元可用</view>
</view>
<view class='text'>
<view class='condition line2'>
@@ -31,7 +31,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -69,19 +69,21 @@
};
},
computed: mapGetters(['isLogin']),
watch: {
isLogin: {
handler: function(newV, oldV) {
if (newV) {
this.getUseCoupons();
}
},
deep: true
}
},
onLoad(){
if(this.isLogin){
// #ifdef H5
this.getUseCoupons();
// #endif
}else{
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this,'isShowAuth',true)
// #endif
}
},
/**

View File

@@ -25,7 +25,7 @@
<recommend :hostProduct="hostProduct"></recommend>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -75,16 +75,13 @@
computed: mapGetters(['isLogin']),
onLoad() {
if (this.isLogin) {
this.loadend = false;
this.page = 1;
this.collectProductList = [];
this.get_user_collect_product();
this.get_host_product();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
onShow(){

View File

@@ -16,13 +16,19 @@
</view>
<view class='item acea-row row-between-wrapper'>
<view>手机号码</view>
<navigator url="/pages/users/user_phone/index" hover-class="none" class="input" v-if="!userInfo.phone">
<navigator url="/pages/users/user_phone/index" hover-class="none" class="input">
<view class='input acea-row row-between-wrapper'>
<input type='text' disabled='true' name='phone' :value='userInfo.phone' class='id'></input>
<text class='iconfont icon-xiangyou'></text>
</view>
</navigator>
<!-- <navigator url="/pages/users/user_phone/index" hover-class="none" class="input" v-if="!userInfo.phone">
点击绑定手机号<text class="iconfont icon-xiangyou"></text>
</navigator>
<view class='input acea-row row-between-wrapper' v-else>
<input type='text' disabled='true' name='phone' :value='userInfo.phone' class='id'></input>
<text class='iconfont icon-suozi'></text>
</view>
</view> -->
</view>
<view class='item acea-row row-between-wrapper'>
<view>ID号</view>
@@ -53,7 +59,7 @@
</view>
</form>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -93,17 +99,21 @@
};
},
computed: mapGetters(['isLogin']),
watch: {
isLogin: {
handler: function(newV, oldV) {
if (newV) {
this.getUserInfo();
}
},
deep: true
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {
@@ -164,6 +174,8 @@
getUserInfo().then(res => {
res.data.localPath = res.data.avatar;
that.$set(that, 'userInfo', res.data);
that.$store.commit("UPDATE_USERINFO", res.data);
that.$store.commit("SETUID", res.data.uid);
});
},
/**

View File

@@ -61,7 +61,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -109,18 +109,23 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserInfo();
this.getIntegralList();
}
},
deep:true
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo();
this.getIntegralList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
/**

View File

@@ -121,7 +121,7 @@
<recommend :hostProduct="hostProduct" v-if="hostProduct.length"></recommend>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -174,6 +174,19 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserInfo();
this.get_host_product();
this.get_activity();
this.userDalance();
}
},
deep:true
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo();
@@ -181,13 +194,7 @@
this.get_activity();
this.userDalance();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {

View File

@@ -47,7 +47,7 @@
</view>
</form>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -102,6 +102,18 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserInfo();
this.getRecharge();
this.getUserExtractBank();
}
},
deep:true
}
},
onLoad(options) {
// #ifdef H5
this.from = this.$wechat.isWeixin() ? "public" : "weixinh5"
@@ -111,13 +123,7 @@
this.getRecharge();
this.getUserExtractBank();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {

View File

@@ -1,23 +1,25 @@
<template>
<view>
<form @submit="editPwd" report-submit='true'>
<view class="ChangePassword">
<view class="list">
<view class="item">
<input type='number' placeholder='填写手机号码' placeholder-class='placeholder' v-model="phone"></input>
</view>
<view class="item acea-row row-between-wrapper">
<input type='number' placeholder='填写验证码' placeholder-class='placeholder' class="codeIput" v-model="captcha"></input>
<button class="code font-color" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="code">
{{ text }}
</button>
</view>
<view class="ChangePassword">
<view class="list">
<view class="item" v-if="isNew">
<input type='number' disabled='true' placeholder='填写手机号码1' placeholder-class='placeholder' v-model="userInfo.phone"></input>
</view>
<view class="item" v-if="!isNew">
<input type='number' placeholder='填写手机号码' placeholder-class='placeholder' v-model="phone"></input>
</view>
<view class="item acea-row row-between-wrapper">
<input type='number' placeholder='填写验证码' placeholder-class='placeholder' class="codeIput" v-model="captcha"></input>
<button class="code font-color" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="code">
{{ text }}
</button>
</view>
<button form-type="submit" class="confirmBnt bg-color">确认绑定</button>
</view>
</form>
<button form-type="submit" v-if="isNew" class="confirmBnt bg-color" @click="next">下一步</button>
<button form-type="submit" v-if="!isNew" class="confirmBnt bg-color" @click="editPwd">保存</button>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -27,7 +29,8 @@
import {
registerVerify,
bindingPhone,
verifyCode
verifyCode,
bindingVerify
} from '@/api/api.js';
import {
toLogin
@@ -51,31 +54,75 @@
captcha:'',
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
key: ''
key: '',
isNew: true,
timer: '',
text: '获取验证码',
nums: 60
};
},
computed: mapGetters(['isLogin']),
mounted() {
// this.timer = setInterval(this.getTimes, 1000);
},
computed: mapGetters(['isLogin','userInfo']),
onLoad() {
if (this.isLogin) {
// verifyCode().then(res=>{
// this.$set(this, 'key', res.data.key)
// });
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {
getTimes(){
this.nums = this.nums - 1;
this.text = "剩余 " + this.nums + "s";
if (this.nums < 0) {
clearInterval(this.timer);
}
this.text = "剩余 " + this.nums + "s";
if (this.text < "剩余 " + 0 + "s") {
this.disabled = false;
this.text = "重新获取";
}
},
onLoadFun:function(){},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e
},
next() {
uni.hideLoading();
this.isNew = false;
this.captcha = '';
clearInterval(this.timer);
this.disabled = false;
this.text = "获取验证码";
uni.showLoading({
title: '加载中',
mask: true
});
if (!this.captcha) return this.$util.Tips({
title: '请填写验证码'
});
bindingVerify({
phone: this.userInfo.phone,
captcha: this.captcha
}).then(res => {
uni.hideLoading();
this.isNew = false;
this.captcha = '';
clearInterval(this.timer);
this.disabled = false;
this.text = "获取验证码";
}).catch(err => {
return this.$util.Tips({
title: err
});
uni.hideLoading();
})
},
editPwd: function() {
let that = this;
if (!that.phone) return that.$util.Tips({
@@ -88,12 +135,12 @@
title: '请填写验证码'
});
uni.showModal({
title: '是否绑定账号',
title: '是否更换绑定账号',
confirmText: '绑定',
success(res) {
if (res.confirm) {
bindingPhone({
account: that.phone,
phone: that.phone,
captcha: that.captcha
}).then(res => {
return that.$util.Tips({
@@ -110,7 +157,7 @@
})
} else if (res.cancel) {
return that.$util.Tips({
title: '您已取消绑定!'
title: '您已取消更换绑定!'
}, {
tab: 5,
url: '/pages/users/user_info/index'
@@ -124,22 +171,33 @@
*
*/
async code() {
this.nums = 60;
uni.showLoading({
title: '加载中',
mask: true
});
let that = this;
if (!that.phone) return that.$util.Tips({
title: '请填写手机号码!'
});
if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
title: '请输入正确的手机号码!'
});
await registerVerify(that.phone).then(res => {
if(!that.isNew){
if (!that.phone) return that.$util.Tips({
title: '请填写手机号码!'
});
if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
title: '请输入正确的手机号码!'
});
}
await registerVerify(that.isNew?that.userInfo.phone:that.phone).then(res => {
that.$util.Tips({
title: res.message
});
that.sendCode();
that.timer = setInterval(that.getTimes, 1000);
that.disabled = true;
uni.hideLoading();
}).catch(err => {
return that.$util.Tips({
title: err
});
uni.hideLoading();
});
}
}

View File

@@ -21,7 +21,7 @@
</form>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -63,17 +63,21 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserInfo();
}
},
deep:true
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {

View File

@@ -26,7 +26,7 @@
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
@@ -67,17 +67,21 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getOrderList();
}
},
deep:true
}
},
onLoad() {
if (this.isLogin) {
this.getOrderList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
/**

View File

@@ -21,7 +21,8 @@
<view class='wrapper'>
<view class='list acea-row row-between-wrapper'>
<view class='item' v-for="(item,index) in signSystemList" :key="index">
<view :class='(index+1) == signSystemList.length ? "rewardTxt" : ""'>{{item.title}}</view>
<view :class="(index + 1 === signSystemList.length ? 'reward' : '') + ' ' +(sign_index >= index + 1 ? 'rewardTxt' : '')">{{item.title}}</view>
<!-- <view :class='(index+1) == signSystemList.length ? "rewardTxt" : ""'>{{item.title}}</view> -->
<view class='venus' :class="(index + 1 === signSystemList.length ? 'reward' : '') + ' ' +(sign_index >= index + 1 ? 'venusSelect' : '')"></view>
<view class='num' :class='item.is_sgin ? "on" : ""'>+{{item.integral}}</view>
</view>
@@ -64,7 +65,7 @@
<view class='mask' @touchmove.stop.prevent="false" :hidden='active==false'></view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -109,19 +110,25 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserInfo();
this.getSignSysteam();
this.getSignList();
}
},
deep:true
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo();
this.getSignSysteam();
this.getSignList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true)
// #endif
}
},
methods: {

View File

@@ -20,7 +20,7 @@
</view>
</view>
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
@@ -51,17 +51,21 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getSignMoneList();
}
},
deep:true
}
},
onLoad(){
if(this.isLogin){
this.getSignMoneList();
}else{
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this,'isShowAuth',true)
// #endif
}
},
onReachBottom: function () {

Some files were not shown because too many files have changed in this diff Show More