123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- <template>
- <view class="container">
- <view class="forms">
- <u--form :rules="rules"
- labelPosition="left"
- :model="yhxx" labelWidth="120"
- ref="uForm">
- <u-form-item
- label="加油站名称"
- prop="jyzmc"
- borderBottom
- ref="item1">
- <u--input
- v-model="yhxx.jyzmc"
- placeholder="请输入加油站名称"
- border="none"
- ></u--input>
- </u-form-item>
-
- <u-form-item
- label="统一社会信用代码"
- prop="shtyxydm"
- borderBottom
- ref="item1">
- <u--input
- v-model="yhxx.shtyxydm"
- placeholder="请输入统一社会信用代码"
- border="none"
- ></u--input>
- </u-form-item>
-
- <u-form-item
- label="加油站照片"
- prop="jyzzp"
- borderBottom
- placeholder=""
- ref="item1">
- <view class="zpbox" v-if="!yhxx.jyzzp" @click="uploadimg">
- <uni-icons type="plusempty" size="30"></uni-icons>
- </view>
- <view v-else>
- <image mode="widthFix" :src="yhxx.jyzzp" style="width: 120rpx;"></image>
- </view>
- </u-form-item>
-
- <u-form-item
- label="法人姓名"
- prop="frxm"
- borderBottom
- ref="item1">
- <u--input
- v-model="yhxx.frxm"
- placeholder="请输入法人姓名"
- border="none"
- ></u--input>
- </u-form-item>
-
- <u-form-item
- label="法人电话"
- prop="frdh"
- borderBottom
- ref="item1">
- <u--input
- v-model="yhxx.frdh"
- placeholder="请输入法人电话"
- border="none"
- ></u--input>
- </u-form-item>
-
- <u-form-item
- label="负责人姓名"
- prop="fzrxm"
- borderBottom
- ref="item1">
- <u--input
- v-model="yhxx.fzrxm"
- placeholder="请输入负责人姓名"
- border="none"
- ></u--input>
- </u-form-item>
-
- <u-form-item
- label="负责人电话"
- prop="fzrdh"
- borderBottom
- ref="item1">
- <u--input
- v-model="yhxx.fzrdh"
- placeholder="请输入负责人电话"
- border="none"
- ></u--input>
- </u-form-item>
-
- <u-form-item
- label="加油站地址"
- prop="jyzxz"
- borderBottom
- ref="item1">
- <u--input
- v-model="yhxx.jyzxz"
- placeholder="请输入加油站地址"
- border="none"
- ></u--input>
- </u-form-item>
-
- <u-form-item
- label="管辖地派出所"
- prop="sspcs"
- borderBottom
- ref="item1">
- <uni-data-picker placeholder="请选择管辖地派出所" popup-title="请选择管辖地派出所" :localdata="dataTreepcs" v-model="yhxx.sspcs"
- @change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened" @popupclosed="onpopupclosed">
- </uni-data-picker>
- </u-form-item>
-
-
- <u-form-item
- label="管辖地社区"
- prop="sssq"
- borderBottom
- ref="item1">
- <uni-data-picker placeholder="请选择社区" popup-title="请选择社区" :localdata="dataTree" v-model="yhxx.sssq"
- @change="onchange" @nodeclick="onnodeclick2" @popupopened="onpopupopened" @popupclosed="onpopupclosed">
- </uni-data-picker>
- </u-form-item>
- </u--form>
-
- <view @click="dengji" class="djbutton">登记</view>
- </view>
- </view>
- </template>
- <script>
- import { jyzdjSave } from "@/api/jfsc.js"
- import { getDeptList,putfiles } from "@/api/my.js"
- import { baseurl } from "../../common/setting"
- export default{
- data(){
- return{
- dataTree:[],
- dataTreepcs:[],
- show: true,
- columns:[],
- columnData: [],
- fileList1: [],
- yhxx:{
- jyzmc:'',
- shtyxydm:'',
- frxm:'',
- },
- rules:{
- 'jyzmc': {
- type: 'string',
- required: true,
- message: '请填写加油站名称',
- trigger: ['blur', 'change']
- },
- 'shtyxydm': {
- type: 'string',
- required: true,
- message: '请填写社会统一信用代码',
- trigger: ['blur', 'change']
- },
- 'frxm': {
- type: 'string',
- required: true,
- message: '请填写法人姓名',
- trigger: ['blur', 'change']
- }
- }
- }
- },
-
- onLoad() {
- uni.showLoading({
- title: '加载中'
- });
- getDeptList().then(res=>{
- res.data.forEach((vs,v)=>{
- vs.text = vs.label
- })
- this.dataTreepcs = res.data
- uni.hideLoading()
- }).finally(()=>{
- uni.hideLoading()
- })
- },
-
- methods:{
- dengji(){
- this.$refs.uForm.validate().then(res => {
- uni.showLoading({
- title: '加载中'
- });
- jyzdjSave(this.yhxx).then(res=>{
- uni.showToast({
- success:'登记成功'
- })
- uni.switchTab({
- url: "/pages/my/index", // 确保 url 是正确的
- });
- this.$refs.uForm.resetFields()
- }).finally(()=>{
- uni.hideLoading()
- })
- }).catch(errors => {
-
- })
-
- },
- back(){
- uni.switchTab({
- url: "/pages/my/index", // 确保 url 是正确的
- });
- },
- goPage(url){
- uni.navigateTo({
- url:url
- })
- },
- onnodeclick(e) {
- getDeptList(e.value).then(res=>{
- res.data.forEach((vs,v)=>{
- vs.text = vs.label
- })
- this.dataTree = res.data
- }).finally(()=>{
- uni.hideLoading()
- })
- },
- onnodeclick2(e){
-
- },
- onpopupopened(e) {
- console.log('popupopened');
- },
- onpopupclosed(e) {
- console.log('popupclosed');
- },
- onchange(e) {
- console.log('onchange:', e);
- },
- // 删除图片
- deletePic(event) {
- this[`fileList${event.name}`].splice(event.index, 1)
- },
-
- uploadimg(){
- uni.chooseImage({
- success: (chooseImageRes) => {
- const tempFilePaths = chooseImageRes.tempFilePaths;
- uni.uploadFile({
- url: baseurl+'/blade-resource/oss/endpoint/put-file', //仅为示例,非真实的接口地址
- filePath: tempFilePaths[0],
- name: 'file',
- // 客户端认证参数
- header:{
- Authorization:'Basic c2FiZXI6c2FiZXJfc2VjcmV0'
- },
- formData: {
- 'file': tempFilePaths[0]
- },
- success: (res) => {
- let datalink = JSON.parse(res.data)
- if(datalink.code == 200) {
- this.$set(this.yhxx,'jyzzp',datalink.data.link)
- //this.yhxx.jyzzp = datalink.data.link
- this.$u.func.showToast({title:'图片上传成功'})
- }
- },
- fail: (err) => {
- console.log(err);
- }
-
- });
- }
- });
- //this.userInfo.jyzzp
- },
-
- }
- }
- </script>
- <style lang="scss">
- /deep/ .uni-navbar__content{
- border-bottom: none !important;
- }
- .container{
- height: 100vh;
- padding: 24rpx 24rpx 0;
- box-sizing: border-box;
- background: #F8F8F8;
- }
- .zpbox{
- width: 120rpx;
- height: 120rpx;
- border: 1px dotted #ddd;
- text-align: center;
- line-height: 120rpx;
- display: inline-block;
- border-radius: 3px;
- }
- .forms{
- width: calc(100% - 24rpx);
- margin: auto;
- background: #FFF;
- border-radius: 15px;
- padding:24rpx;
- box-sizing: border-box;
- }
- .djbutton{
- height: 88rpx;
- background: linear-gradient( to top, #65CBFF 0%, #0260FE 100%);
- border-radius: 44rpx;
- opacity: 0.5;
- font-family: PingFangSC, PingFang SC;
- font-weight: 500;
- font-size: 36rpx;
- color: #FFFFFF;
- line-height: 88rpx;
- text-align: center;
- font-style: normal;
- margin-top: 48rpx;
- }
- /deep/ .input-value-border{
- border: 0 !important;
- }
- </style>
|