赵明涛
9 months ago
8 changed files with 1396 additions and 481 deletions
-
2src/manifest.json
-
2src/pages/login/login.vue
-
869src/subpackage/party/components/popup-content/miniapp-change-category.vue
-
8src/subpackage/party/components/popup-content/miniapp-change-name.vue
-
2src/subpackage/party/components/popup-content/miniapp-change-signature.vue
-
2src/subpackage/party/pages/index/index.vue
-
126src/subpackage/party/pages/miniapp/regist.vue
@ -0,0 +1,869 @@ |
|||
<template> |
|||
<!-- 弹窗 --> |
|||
<!-- :class="[directionClass,{'b-popup-round':round||''},{'b-popup-animation':animation||''}]" --> |
|||
<view class="m-popup b-popup " v-if="true" > |
|||
<view class="b-popup-shade" @click="showPopup = false"></view> |
|||
<view class="b-popup-content"> |
|||
|
|||
<view class="b-content-view b-flex-y b-flex-c"> |
|||
<!-- 右上角关闭按钮 --> |
|||
<view class="b-flex-x b-flex-e b-mb-20 b-flex-as-e"> |
|||
<text class="b-icon icon-close b-t-gray b-t-44" @click="closeChange"></text> |
|||
</view> |
|||
<view class="b-t-B b-t-36 b-mb-40">小程序类目设置</view> |
|||
|
|||
<!-- 可修改次数,已修改次数 --> |
|||
<!-- <view class="b-flex-x b-mb-20"> |
|||
<text class="b-t-28 b-t-gray">可修改次数:</text> |
|||
<text class="b-t-28 b-t-green">{{appInfo.nickname_info.modify_quota}}</text> |
|||
<text class="b-t-28 b-t-gray">次</text> |
|||
<text class="b-t-28 b-t-gray b-ml-40">已修改次数:</text> |
|||
<text class="b-t-28 b-t-red">{{appInfo.nickname_info.modify_used_count}}</text> |
|||
<text class="b-t-28 b-t-gray">次</text> |
|||
</view> --> |
|||
|
|||
<!-- 一键选择类目 --> |
|||
<view class="b-flex-x b-flex-as-e b-pr-40 b-mb-40 b-mt-30"> |
|||
<text class="b-t-28 b-t-gray" @click="fastAddCategory">一键选择体育场馆</text> |
|||
</view> |
|||
|
|||
<picker mode="multiSelector" |
|||
@change="bindPickerChange_queryCategories" |
|||
@columnchange="bindPickerChange_queryCategories_column" |
|||
:value="queryCategories_index" |
|||
range-key="name" |
|||
:range="queryCategories"> |
|||
<input @click="" class="bc-input b-mb-50" disabled="true" v-model="queryCategories_show" type="text" placeholder="请选择" |
|||
placeholder-class="input-hold-class"> |
|||
</input> |
|||
</picker> |
|||
|
|||
<!-- <input @click="" class="bc-input b-mb-50" disabled="true" v-model="userInputName" type="text" placeholder="请选择" |
|||
placeholder-class="input-hold-class"> |
|||
</input> --> |
|||
<!-- <text class=" bc-arrow b-icon icon-right b-t-gray b-t-28 b-t-B"></text> --> |
|||
|
|||
<!-- <view class=" b-flex-x b-mt-10 b-mb-60" v-if="!checkNameRes"> |
|||
<button class="b-btn b-btn-green b-btn-line " @click="closeChange">取消</button> |
|||
<button class="b-btn b-btn-green b-ml-40" @click="clickSure">确定</button> |
|||
</view> --> |
|||
|
|||
<view class="rb-line" v-if="exterList.length>0"></view> |
|||
<view class="rb-text b-t-24 b-t-red b-p-40" v-if="exterList.length>0"> |
|||
<text >{{exterInfo.scope||""}}</text> |
|||
<!-- <text v-else>你申请的名称涉及特定地域范围或地理名称,需要经过平台审核后才可使用,你可以直接提交审核,或提供《商标注册证》等材料,以证明你可使用该地域范围或地理名称作为账号名称,否则可能审核不通过。</text> --> |
|||
</view> |
|||
|
|||
<block v-if="exterList.length>0"> |
|||
<!-- <view class="rb-radio b-flex-x b-mb-40"> |
|||
<radio-group @change="selectChange"> |
|||
<radio value="id_card" checked style="transform:scale(0.9)" color="#009876">个人号</radio> |
|||
<radio value="license" style="transform:scale(0.9);margin-left: 40rpx;" color="#009876">组织号</radio> |
|||
</radio-group> |
|||
</view> --> |
|||
|
|||
<scroll-view scroll-y="true" class="scroll-Y" @scroll="" scroll-left="0"> |
|||
<view class="rb-upload-list b-flex-y b-flex-c"> |
|||
<!-- rb-line --> |
|||
<view v-if="true" v-for="(e,i) in exterList" class="b-flex-y b-flex-c b-mt-10 b-pb-40" > |
|||
<view class="b-mb-20 b-t-24 b-t-B">{{i+1}}/{{exterList.length}} - {{e.name}}</view> |
|||
<view class="b-mb-20 b-t-24 b-t-green" @click="copyUrl(e.url_origin)" v-if="e.url_origin">复制参考链接</view> |
|||
<view class="rb-upload-item b-flex-y b-flex-c" @click="clickUploadImg(e,i)"> |
|||
<image class="rb-upload-bg" src="../../static/regist/upload_bg.png" |
|||
:src="e.url?e.url:imgbg" |
|||
></image> |
|||
<image class="rb-upload-cam" src="../../static/regist/camera.png"></image> |
|||
<text class="rb-input-img-text">点击上传</text> |
|||
</view> |
|||
</view> |
|||
<!-- <view v-if="true" class="b-flex-y b-flex-c rb-line b-mt-10" @click="clickUploadImg('license')"> |
|||
<view class="b-mb-30 b-t-26">营业执照</view> |
|||
<view class="rb-upload-item b-flex-y b-flex-c"> |
|||
<image class="rb-upload-bg" src="../../static/regist/upload_bg.png"></image> |
|||
<image class="rb-upload-cam" src="../../static/regist/camera.png"></image> |
|||
<text class="rb-input-img-text">点击上传</text> |
|||
</view> |
|||
</view> |
|||
<view v-if="true" class="b-flex-y b-flex-c b-mt-10" @click="clickUploadImg('naming_other_stuff_1')"> |
|||
<view class="b-mb-30 b-t-26">关键词补充材料</view> |
|||
<view class="rb-upload-item b-flex-y b-flex-c"> |
|||
<image class="rb-upload-bg" src="../../static/regist/upload_bg.png"></image> |
|||
<image class="rb-upload-cam" src="../../static/regist/camera.png"></image> |
|||
<text class="rb-input-img-text">点击上传</text> |
|||
</view> |
|||
</view> --> |
|||
<!-- <view class="b-flex-as-e b-ml-40 b-t-24 b-t-green b-t-B b-t-U">重新上传</view> --> |
|||
</view> |
|||
</scroll-view> |
|||
|
|||
|
|||
</block> |
|||
<view class="rb-btns b-flex-x b-mt-40 b-mb-50"> |
|||
<button class="b-btn b-btn-green b-mr-40" @click="closeChange">取消</button> |
|||
<button class="b-btn b-btn-green " @click="clickSure">确定</button> |
|||
</view> |
|||
|
|||
</view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import util from '@/utils/util'; |
|||
import { servers } from '@/js/server'; |
|||
import party_api from '../../js/api.js'; |
|||
|
|||
import { mapState } from 'vuex'; |
|||
|
|||
export default { |
|||
props: { |
|||
appInfo: { |
|||
type: Object, |
|||
default: ()=>({ |
|||
// showPopup:true, |
|||
}) |
|||
}, |
|||
appid: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
queryInfo: { |
|||
type: Object, |
|||
default: ()=>({ |
|||
}) |
|||
}, |
|||
|
|||
|
|||
}, |
|||
computed: { |
|||
...mapState(['brandInfo']), |
|||
|
|||
}, |
|||
created(){ |
|||
console.log("类目 oncreated ") |
|||
this.setData() |
|||
}, |
|||
data() { |
|||
return { |
|||
showPopup:true, |
|||
userInputName: '',//用户输入的名称 |
|||
checkNameRes: "",//查询名称是否可用 |
|||
|
|||
selectType:"",//选择的类型 |
|||
localImg :{ |
|||
id_card: { |
|||
mediaid: '', |
|||
url: '', |
|||
txt:"身份证照片" |
|||
}, |
|||
license: { |
|||
mediaid: '', |
|||
url: '', |
|||
txt:"组织机构代码证或营业执照" |
|||
}, |
|||
naming_other_stuff_1: { |
|||
mediaid: '', |
|||
url: '', |
|||
txt:"关键词补充材料" |
|||
} |
|||
}, |
|||
imgbg:"../../static/regist/upload_bg.png", |
|||
queryCategories: [[],[]],//类目二位数组 |
|||
queryCategories_child: [],//二级子类目分类 |
|||
queryCategories_index:[[0],[0]],//分类index二位数组 |
|||
queryCategories_show:"请选择", |
|||
queryCategories_sport_index:null, |
|||
exterList: [],//敏感词附件列表 |
|||
// exterList: [{"name":"政府/有政府职能的事业单位:提供《统一社会信用代码证》(机构类型为:机关)","url":"","mediaid":"","url_origin":""},{"name":"非政府/事业单位:提供相关政府部门的《资质授权文件》","url":"","mediaid":"","url_origin":"https://res.wx.qq.com/op_res/BPlSPJtUqcBCopjAOauMB9U_taQRxlbmQ7WTCG44uvOVMs6vXPEM8Zy9XyhU-Jn3aO2szARomffYSfMCO-I64Q"}],//敏感词附件列表 |
|||
exterInfo:{ |
|||
scope:"" |
|||
}, |
|||
} |
|||
}, |
|||
methods: { |
|||
|
|||
moveHandle(){}, |
|||
closeChange(){ |
|||
this.$emit('close'); |
|||
}, |
|||
async setData(){ |
|||
util.showLoad() |
|||
try { |
|||
await this.getcategory() |
|||
await this.getAllCategoriesByType() |
|||
} catch (error) { |
|||
console.log("setData-err", error) |
|||
} |
|||
util.hideLoad() |
|||
}, |
|||
|
|||
clickCheckName(){ |
|||
if(this.userInputName == '')return util.showNone('请输入名称!'); |
|||
|
|||
this.checkwxverifynickname(); |
|||
}, |
|||
async addcategory(arr){ |
|||
|
|||
let media_res = await this.getMediaidFromList() |
|||
console.log("addcategory:",media_res) |
|||
if(!media_res){ |
|||
return |
|||
} |
|||
|
|||
let _data = this.getGateWayJson("addcategory") |
|||
let _add_cacategorie = [{ |
|||
certicates:media_res, |
|||
first:arr[0], |
|||
second:arr[1], |
|||
}] |
|||
_data.form.categories = _add_cacategorie |
|||
// data.appid = this.appid |
|||
this.gatewayDo(_data).then(res => { |
|||
console.log("addcategory:",res) |
|||
if(res.code == 0){ |
|||
util.showNone("添加成功") |
|||
this.getcategory() |
|||
} |
|||
}) |
|||
}, |
|||
getMediaidFromList(){ |
|||
let arr = [] |
|||
let {exterList} = this |
|||
//exterList |
|||
if(exterList.length == 0){ |
|||
return [] |
|||
} |
|||
for (var key in exterList) { |
|||
if(exterList[key].mediaid){ |
|||
arr.push({ |
|||
key:exterList[key].name, |
|||
value:exterList[key].mediaid, |
|||
// expire_time, |
|||
// is_permanent |
|||
}) |
|||
} |
|||
} |
|||
if(exterList.length != arr.length){ |
|||
util.showNone("请上传所有附件") |
|||
console.log("需要对比:",exterList,arr) |
|||
return false |
|||
} |
|||
|
|||
console.log(arr) |
|||
return arr |
|||
}, |
|||
async clickSure(){ |
|||
// let temp = this.getMediaidFromList() |
|||
// console.log("clickSure:",temp) |
|||
let msg = "注意: 最多可以设置的类目数量: 5 个;是否添加?" |
|||
let msg_res = await util.showModalMsg(msg,true) |
|||
if(msg_res){ |
|||
//获取选择的服务内容类型type参数 |
|||
let select_type = [] |
|||
let value = this.queryCategories_index |
|||
select_type.push(this.queryCategories[0][value[0]].id) |
|||
select_type.push(this.queryCategories[1][value[1]].id) |
|||
|
|||
this.addcategory(select_type) |
|||
|
|||
console.log('select_type:', select_type) |
|||
this.$emit('sure',this.appInfo); |
|||
}else{ |
|||
util.showNone("取消添加") |
|||
this.$emit('close'); |
|||
} |
|||
}, |
|||
async fastAddCategory(){ |
|||
let msg_res = await util.showModalMsg("一键添加:体育场馆服务类目?",true) |
|||
|
|||
console.log("fastAddCategory:",msg_res) |
|||
if(msg_res){ |
|||
// this.addcategory([674, 676]) |
|||
this.queryCategories[1] = this.queryCategories_child[0] //强制将二级分类设置为体育场馆. 前提:将体育类目放在第一个 |
|||
this.bindPickerChange_queryCategories({target:{value:[0,0]}}) |
|||
}else{ |
|||
util.showNone("取消添加") |
|||
} |
|||
|
|||
}, |
|||
bindPickerChange_queryCategories(e) { |
|||
console.log('picker发送选择改变,携带值为', e.target.value) |
|||
let value = e.target.value; |
|||
let data = "" |
|||
this.queryCategories_index = value; |
|||
if (this.queryCategories[0].length != 0) { |
|||
this.queryCategories_show = this.queryCategories[0][this.queryCategories_index[0]].name |
|||
}; |
|||
if (this.queryCategories[1].length != 0) { |
|||
this.queryCategories_show += '/' + this.queryCategories[1][this.queryCategories_index[1]].name |
|||
data = this.queryCategories[1][this.queryCategories_index[1]] |
|||
} |
|||
|
|||
console.log("bindPickerChange_queryCategories 111:",data) |
|||
|
|||
//判断选择的类目内容类型, 是否命中敏感词. 如果命中, 则显示敏感词附件列表 |
|||
if (data.sensitive_type === 1) { |
|||
data.qualify.exterList = []; |
|||
data.qualify.exter_list.forEach((item) => { |
|||
item.inner_list.forEach((item2) => { |
|||
item2.mediaid = "";//敏感词附件列表, mediaid为空 |
|||
item2.url_origin = item2.url;//原始url |
|||
item2.url = "";// |
|||
data.qualify.exterList.push(item2); |
|||
}); |
|||
}); |
|||
console.log("类目命中敏感词:",data.qualify.scope,data.qualify.exterList) |
|||
|
|||
this.exterList = data.qualify.exterList |
|||
console.log(JSON.stringify(data.qualify.exterList)) |
|||
}else{ |
|||
this.exterList = [] |
|||
} |
|||
this.exterInfo = data |
|||
|
|||
console.log("bindPickerChange_queryCategories 222:",data) |
|||
|
|||
|
|||
//获取选择的服务内容类型type参数 |
|||
let select_type = [] |
|||
select_type.push(this.queryCategories[0][value[0]].id) |
|||
select_type.push(this.queryCategories[1][value[1]].id) |
|||
|
|||
console.log('select_type:', select_type) |
|||
|
|||
|
|||
// this.form.icp_applets.base_info.service_content_types = select_type |
|||
}, |
|||
bindPickerChange_queryCategories_column(e){ |
|||
console.log(e.detail) |
|||
// 当滚动切换一级分类时,为当前的一级分类添加它的子类 |
|||
if (e.detail.column == 0) { |
|||
let children_arr = this.queryCategories_child[e.detail.value] |
|||
if(this.queryCategories_sport_index>=0){ |
|||
this.queryCategories[1] = this.queryCategories_child[e.detail.value] |
|||
} |
|||
console.log("children_arr:",children_arr,e.detail.value) |
|||
// #ifdef H5 |
|||
// 在小程序中直接赋值无效 H5 可直接赋值 |
|||
this.queryCategories[1] = children_arr |
|||
// #endif |
|||
// #ifdef MP-WEIXIN |
|||
// 在 H5 环境下 $set 会导致一级分类无法滚动, 小程序正常运行 |
|||
this.$set(this.queryCategories, 1, children_arr) |
|||
// #endif |
|||
} |
|||
}, |
|||
copyUrl(url){ |
|||
uni.setClipboardData({ |
|||
data: url, |
|||
success: function () { |
|||
util.showNone('复制成功') |
|||
} |
|||
}); |
|||
}, |
|||
async clickUploadImg(e,i){ |
|||
//for (e,i) in exterList |
|||
let {exterList} = this |
|||
|
|||
exterList[i].url = await this.getLocalImg(); |
|||
console.log("clickUploadImg-local:", exterList[i].url) |
|||
exterList[i].mediaid = await this.getUploadImgMediaId(exterList[i].url); |
|||
console.log("clickUploadImg-mediaid:", exterList[i].mediaid) |
|||
//当需要回显数据时, 同时上传图片到服务器 |
|||
// this.localImg[which].url = await this.getUploadImgURL(this.localImg[which].url); |
|||
|
|||
}, |
|||
resetLocalImg(){ |
|||
this.localImg = { |
|||
id_card: { |
|||
mediaid: '', |
|||
url: '', |
|||
txt:"身份证照片" |
|||
}, |
|||
license: { |
|||
mediaid: '', |
|||
url: '', |
|||
txt:"组织机构代码证或营业执照" |
|||
}, |
|||
naming_other_stuff_1: { |
|||
mediaid: '', |
|||
url: '', |
|||
txt:"关键词补充材料" |
|||
} |
|||
} |
|||
}, |
|||
getUploadImgURL(tempFilePath){ |
|||
return servers.uploadFile({ |
|||
url: party_api.webUpload, |
|||
filePath: tempFilePath, |
|||
name: 'file', |
|||
formData: {} |
|||
}) |
|||
.then(res=>{ |
|||
console.log("uploadFile-res", res) |
|||
if(res.statusCode == 200){ |
|||
// console.log("uploadFile-url 上传成功1", res.data.data.url) |
|||
let _data = JSON.parse(JSON.stringify(res.data)) |
|||
console.log("uploadFile-url return type", typeof(_data)) |
|||
// console.log("uploadFile-url 上传成功 接口真正数据", JSON.parse(_data)) |
|||
_data = JSON.parse(_data).data |
|||
return _data.url |
|||
} |
|||
}) |
|||
.catch(err=>{ |
|||
console.log("uploadFile-err", err) |
|||
}) |
|||
}, |
|||
//从相册获取照片 |
|||
getLocalImg() { |
|||
console.log("clickUploadImg"); |
|||
return new Promise((resolve, reject) => { |
|||
uni.chooseImage({ |
|||
count: 1, |
|||
sizeType: ['original', 'compressed'], |
|||
sourceType: ['album', 'camera'], |
|||
success: (res) => { |
|||
console.log("chooseImage", res) |
|||
let tempFilePaths = res.tempFilePaths[0]; |
|||
resolve(tempFilePaths) |
|||
}, |
|||
fail: (err) => { |
|||
console.log("chooseImage-err", err) |
|||
reject(err) |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
getUploadImgMediaId(tempFilePath){ |
|||
let appid = this.appid |
|||
let _param_str = `module=/cgi-bin/media/upload&appid=${appid}` |
|||
let _url = party_api.gatewayDoDuplicate+"?"+_param_str |
|||
return servers.uploadFile({ |
|||
url: _url, |
|||
filePath: tempFilePath, |
|||
name: 'image', |
|||
formData: { |
|||
'form.type':"image" |
|||
} |
|||
}) |
|||
.then(res=>{ |
|||
console.log("uploadFile-gatewayDoDuplicate-res", res) |
|||
if(res.statusCode == 200){ |
|||
|
|||
let _data = JSON.parse(JSON.stringify(res.data)) |
|||
console.log("uploadFile-url return type", typeof(_data)) |
|||
_data = JSON.parse(_data).data |
|||
console.log("uploadFile-gatewayDoDuplicate-上传成功 接口真正数据", _data) |
|||
return _data.media_id |
|||
} |
|||
}) |
|||
.catch(err=>{ |
|||
console.log("uploadFile-err", err) |
|||
}) |
|||
}, |
|||
getUploadImgURL(tempFilePath){ |
|||
return servers.uploadFile({ |
|||
url: party_api.webUpload, |
|||
filePath: tempFilePath, |
|||
name: 'file', |
|||
formData: {} |
|||
}) |
|||
.then(res=>{ |
|||
console.log("uploadFile-res", res) |
|||
if(res.statusCode == 200){ |
|||
// console.log("uploadFile-url 上传成功1", res.data.data.url) |
|||
let _data = JSON.parse(JSON.stringify(res.data)) |
|||
console.log("uploadFile-url return type", typeof(_data)) |
|||
// console.log("uploadFile-url 上传成功 接口真正数据", JSON.parse(_data)) |
|||
_data = JSON.parse(_data).data |
|||
return _data.url |
|||
} |
|||
}) |
|||
.catch(err=>{ |
|||
console.log("uploadFile-err", err) |
|||
}) |
|||
}, |
|||
setnickname(){ |
|||
let _data = this.getGateWayJson('setnickname') |
|||
_data.form.nick_name = this.userInputName |
|||
_data.form.id_card = this.localImg.id_card.mediaid |
|||
_data.form.license = this.localImg.license.mediaid |
|||
|
|||
console.log("setnickname:",_data) |
|||
return servers.post({ |
|||
url: party_api.gatewayDo, |
|||
data: _data, |
|||
isDefaultGet: false, |
|||
}) |
|||
.then(res=>{ |
|||
console.log("setnickname:", res.data) |
|||
if(res.data.code!=0){ |
|||
util.showNone("设置失败") |
|||
console.log("setnickname-err", res.data) |
|||
}else{ |
|||
util.showNone('设置成功') |
|||
} |
|||
}) |
|||
.catch(err=>{ |
|||
console.log("setnickname-err", err) |
|||
}) |
|||
}, |
|||
checkwxverifynickname(){ |
|||
this.checkNameRes = {} |
|||
let _data = this.getGateWayJson('checkwxverifynickname') |
|||
_data.form.nick_name = this.userInputName |
|||
console.log("getaccountbasicinfo:",_data) |
|||
servers.post({ |
|||
url: party_api.gatewayDo, |
|||
data: _data, |
|||
isDefaultGet: false, |
|||
}) |
|||
.then(res=>{ |
|||
console.log("checkwxverifynickname:", res.data) |
|||
if(res.data.code!=0){ |
|||
util.showNone("名称不可用") |
|||
console.log("checkwxverifynickname-err", res.data) |
|||
}else{ |
|||
util.showNone('名称可用') |
|||
if(!res.data.data.hit_condition){ |
|||
res.data.message = '名称可用(注意:改名次数将在自然年 1 月 1 日和微信认证审核通过后重置为 2 次.请慎重修改.)' |
|||
} |
|||
} |
|||
this.checkNameRes = res.data |
|||
console.log("checkwxverifynickname123123:", this.checkNameRes) |
|||
|
|||
}) |
|||
.catch(err=>{ |
|||
console.log("checkwxverifynickname-err", err) |
|||
}) |
|||
|
|||
}, |
|||
gatewayDo(postJson) { |
|||
// postJson.token = "2187a643-4d4a-11ee-a364-5254005df464" |
|||
let url = party_api.gatewayDo |
|||
// #ifdef H5 |
|||
url+= "?token=" + "2187a643-4d4a-11ee-a364-5254005df464" |
|||
// #endif |
|||
if(this.appid) postJson.appid = this.appid |
|||
return servers.post({ |
|||
url: url, |
|||
data: postJson, |
|||
isDefaultGet: false, |
|||
}) |
|||
.then(res => { |
|||
console.log("gatewayDo 0 :", res.data) |
|||
if(res.data.code!=0){ |
|||
return util.showNone(res.data.message) |
|||
}else{ |
|||
return res.data |
|||
} |
|||
}) |
|||
.catch(err => { |
|||
console.log("gatewayDo-err", err) |
|||
}) |
|||
}, |
|||
getGateWayJson(jname){ |
|||
let appid = this.appid |
|||
let _data = party_api["gatewayDoJson"][jname] |
|||
if(!appid){ |
|||
console.error("当前page中: this.appid不存在") |
|||
return util.showNone("appid不存在") |
|||
} |
|||
if(!_data){ |
|||
console.error("先去api.js定义透传数据:",jname) |
|||
return util.showNone("接口不存在") |
|||
} |
|||
_data.appid = appid; |
|||
return _data |
|||
}, |
|||
confirmChange(){ |
|||
let { brandInfo, orderInfo, input_amount, selectType } = this |
|||
if(input_amount == '')return util.showNone('请输入金额!'); |
|||
util.showLoad(); |
|||
deviceServer.get({ |
|||
url: deviceApi.timeOrderEnd, |
|||
data: { |
|||
brand_id: brandInfo.brand.id, |
|||
order_no: orderInfo.order_no, |
|||
pay_amount: parseFloat(input_amount), |
|||
end_type: selectType==1?'end_timing':selectType==2?'end_order':'', |
|||
}, |
|||
failMsg: '加载失败!' |
|||
}) |
|||
.then(res=>{ |
|||
util.hideLoad() |
|||
util.showNone('操作成功!'); |
|||
this.$emit('close'); |
|||
// setTimeout(()=>uni.navigateBack(),1200); |
|||
this.$emit('timeEndBtn'); |
|||
}) |
|||
}, |
|||
async getAllCategoriesByType() { |
|||
try { |
|||
const res = await this.gatewayDo({ |
|||
appid: this.appid, |
|||
module: '/cgi-bin/wxopen/getcategoriesbytype', |
|||
method: 'POST', |
|||
form: { |
|||
verify_type: 1 |
|||
} |
|||
}); |
|||
console.log("getAllCategoriesByType:", res.data.errcode,res) |
|||
if (res.data.errcode === 0) { |
|||
/* |
|||
getTwoArrFromWX(res,needSportFirst,needSportOnly) |
|||
如: |
|||
res,true,true:只需要体育类目 |
|||
res,false,true:只需要体育类目 |
|||
res,true,false:将体育类目放在第一个 |
|||
res,false,false:使用默认数据,可选所有类目 |
|||
*/ |
|||
let obj = this.getTwoArrFromWX(res,true,false)//只需要体育类目 |
|||
|
|||
console.log("obj:",obj) |
|||
this.queryCategories = obj.array_obj; |
|||
this.queryCategories_child = obj.child_arr; |
|||
this.queryCategories_sport_index = obj.index_sport; |
|||
|
|||
} else { |
|||
util.showNone(res.data.errmsg); |
|||
} |
|||
// getAllCategoriesByType |
|||
|
|||
} catch (error) { |
|||
} |
|||
}, |
|||
getTwoArrFromWX(res,needSportFirst=false,needSportOnly = false) { |
|||
|
|||
if(needSportOnly){//只需要体育类目 |
|||
needSportFirst = true |
|||
} |
|||
|
|||
let categories = res.data.categories_list.categories |
|||
let firstLevel = [] |
|||
|
|||
firstLevel = categories.filter((item) => item.level === 1).map((item) => { |
|||
return { |
|||
...item, |
|||
sub_list: categories.filter( |
|||
(item2) => item2.father === item.id |
|||
) |
|||
}; |
|||
}); |
|||
|
|||
|
|||
//生成二维数组给uni: [[],[]] |
|||
let array = [[],[]] |
|||
let array_type = [[],[]] |
|||
|
|||
let array_obj = [[],[]] //携带type,name等信息的二位数组 |
|||
let child_arr = [] |
|||
|
|||
firstLevel.forEach((item) => { |
|||
// array[0].push(item.name) |
|||
// array_type[0].push(item.type) |
|||
array_obj[0].push(item) |
|||
|
|||
// let children_name = item.children.map((item1) => { |
|||
// return item1.name |
|||
// }) |
|||
// array[1].push(children_name) |
|||
|
|||
// let children_type = item.children.map((item1) => { |
|||
// return item1.type |
|||
// }) |
|||
// array_type[1].push(children_type) |
|||
|
|||
}) |
|||
child_arr = firstLevel.map((item) => item.sub_list)// 将数据源中的二级分类 push 进 childArr,作为二级分类的数据源 |
|||
|
|||
let _index_sport=""; |
|||
if(needSportFirst){ //是否需要将体育类目放在第一个 |
|||
//将array_obj[0]中id=674的元素移动到第一个 |
|||
_index_sport = array_obj[0].findIndex((item)=>item.id==674) |
|||
console.log("_index_sport:",_index_sport) |
|||
|
|||
if(_index_sport>0){ |
|||
let _temp = array_obj[0][_index_sport] |
|||
array_obj[0].splice(_index_sport,1) |
|||
array_obj[0].unshift(_temp) |
|||
|
|||
let _temp_child = child_arr[_index_sport] |
|||
child_arr.splice(_index_sport,1) |
|||
child_arr.unshift(_temp_child) |
|||
} |
|||
} |
|||
|
|||
// if(!needSportFirst) |
|||
array_obj[1].push(...child_arr[0]) //// 第一次打开时,默认给一级分类添加它的二级分类 |
|||
|
|||
if(needSportOnly){//只需要体育类目 |
|||
array_obj[0].splice(1,array_obj[0].length-1) |
|||
} |
|||
|
|||
return { |
|||
firstLevel, //后台管理picker数据: [{一级name,type,children:[二级]},...] |
|||
// array, //uni picker数据: [[一级name],[二级name]] |
|||
// array_type,//uni picker type数据: [[一级type],[二级type]] |
|||
array_obj,//uni picker obj数据: [[一级obj],[二级obj]] |
|||
child_arr,//二级分类数据源 |
|||
index_sport:_index_sport,//需要移动的位置 |
|||
|
|||
} |
|||
// this.queryIcpServiceContentTypes = firstLevel; |
|||
|
|||
}, |
|||
getcategory(){ |
|||
let data = { |
|||
"appid":"wxeb7efb9a1cbdd554", |
|||
"module":"/cgi-bin/wxopen/getcategory", |
|||
"method":"GET", |
|||
"form":{} |
|||
} |
|||
data.appid = this.appid |
|||
return servers.post({ |
|||
url: party_api.gatewayDo, |
|||
data: data, |
|||
isDefaultGet: false, |
|||
}) |
|||
.then(res=>{ |
|||
console.log("getcategory:", res.data) |
|||
if(res.data.code!=0){ |
|||
return util.showNone("errcode:"+res.data.errcode+"-"+res.data.errmsg) |
|||
}else{ |
|||
this.categoryInfo = res.data.data |
|||
return res.data |
|||
} |
|||
}) |
|||
.catch(err=>{ |
|||
console.log("getcategory-err", err) |
|||
}) |
|||
}, |
|||
selectBtn(type){ |
|||
this.selectType = type |
|||
}, |
|||
selectChange(e){ |
|||
console.log(e.detail) |
|||
this.selectType = e.detail.value |
|||
}, |
|||
}, |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style lang="scss" > |
|||
@import '~style/public.scss'; |
|||
@import '../../ui/maincss.scss'; |
|||
|
|||
|
|||
.scroll-Y{ |
|||
height: 300rpx; |
|||
} |
|||
.m-popup{ |
|||
.b-popup-shade{ |
|||
background: rgba(0,0,0,0.5); |
|||
position: fixed; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 100%; |
|||
z-index: 100; |
|||
} |
|||
.b-popup-content{ |
|||
position: fixed; |
|||
top: 50%; |
|||
left: 50%; |
|||
transform: translate(-50%,-50%); |
|||
background: #fff; |
|||
border-radius: 5rpx; |
|||
z-index: 101; |
|||
.b-content-view{ |
|||
width: 620rpx; |
|||
padding: 20rpx; |
|||
.b-content-title{ |
|||
|
|||
} |
|||
.bc-input{ |
|||
width: 538rpx; |
|||
height: 88rpx; |
|||
background: #FFFFFF; |
|||
border: 2rpx solid #D8D8D8; |
|||
border-radius: 10rpx; |
|||
padding-left: 30rpx; |
|||
} |
|||
.bc-arrow{ |
|||
position: relative; |
|||
right: 40rpx; |
|||
padding-top: 58rpx; |
|||
|
|||
} |
|||
.input-hold-class{ |
|||
font-size: 28rpx; |
|||
} |
|||
.rb-line{ |
|||
border-bottom: 1rpx solid #E5E5E5; |
|||
width: 100%; |
|||
} |
|||
.rb-btns{ |
|||
>button{ |
|||
width: 240rpx; |
|||
height: 88rpx; |
|||
} |
|||
>button:first-child{ |
|||
background: #fff; |
|||
color: $b-color-green; |
|||
// border: 1rpx solid $b-color-green; |
|||
} |
|||
} |
|||
.rb-text{ |
|||
>text{ |
|||
line-height: 40rpx; |
|||
} |
|||
border-bottom: 1rpx solid #E5E5E5; |
|||
} |
|||
.rb-upload-list{ |
|||
width: 100%; |
|||
|
|||
.rb-upload-item{ |
|||
width: 168rpx; |
|||
height: 168rpx; |
|||
// position: relative; |
|||
|
|||
.rb-upload-bg{ |
|||
width: 168rpx; |
|||
height: 168rpx; |
|||
position: absolute; |
|||
} |
|||
|
|||
.rb-upload-cam{ |
|||
width: 48rpx; |
|||
height: 40rpx; |
|||
z-index: 2; |
|||
} |
|||
.rb-input-img-text{ |
|||
font-size: 24rpx; |
|||
margin-top: 24rpx; |
|||
color: #1A1A1A; |
|||
z-index: 2; |
|||
} |
|||
} |
|||
.idcard-width-170{ |
|||
width: 280rpx; |
|||
height: 170rpx; |
|||
.rb-upload-bg{ |
|||
width: 280rpx; |
|||
height: 170rpx; |
|||
position: absolute; |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
.popup-demo{ |
|||
font-size: 32rpx; |
|||
color: #333333; |
|||
} |
|||
|
|||
} |
|||
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue