editOrder.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-gradual-pink" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content">委托修改</block>
  6. </cu-custom>
  7. <form>
  8. <uni-group mode="card">
  9. <view class="cu-form-group" style="justify-content: flex-start;">
  10. <view class="title">委托单号</view>
  11. <view style="text-align: left;" >{{weituodanhao}}</view>
  12. </view>
  13. <!-- <view class="cu-form-group">
  14. <view class="title">类型</view>
  15. <input placeholder="常规" name="input" v-model="myFormData.username" disabled></input>
  16. </view> -->
  17. <view class="cu-form-group">
  18. <my-date style="padding: 0rpx;" v-model="beginTime" placeholder="请选择" fields="day"
  19. label="期望完成时间"></my-date>
  20. </view>
  21. </uni-group>
  22. <uni-group mode="card" title="样品信息">
  23. <view class="cu-form-group margin-top">
  24. <view class="title" style="color: #888888">样品名称</view>
  25. <input placeholder="请输入样品名称" v-model="ypname" name="input"></input>
  26. </view>
  27. <view class="cu-form-group ">
  28. <view class="title" style="color: #888888">规格型号</view>
  29. <input placeholder="请输入规格型号" v-model="ypguige" name="input"></input>
  30. </view>
  31. <view class="cu-form-group ">
  32. <view class="title" style="color: #888888">数量</view>
  33. <input placeholder="请输入数量" v-model="ypshuliang" name="input" type="number"></input>
  34. </view>
  35. <view class="cu-form-group ">
  36. <view class="title" style="color: #888888">生产日期/批号</view>
  37. <input placeholder="请输入" v-model="yppihao" name="input"></input>
  38. </view>
  39. <view class="cu-form-group ">
  40. <view class="title" style="color: #888888">样品处置</view>
  41. <app-select v-model="type2" placeholder="请选择处置方式" :dict="plan_type" space></app-select>
  42. </view>
  43. <view class="cu-form-group">
  44. <view class="title" style="color: #888888">检测类别</view>
  45. <app-select v-model="type1" placeholder="请选择检测类别" :dict="plan_type1" space ></app-select>
  46. </view>
  47. </uni-group>
  48. <uni-group mode="card" >
  49. <uni-section v-bind:title="'检测对象/'+sex[radio1].leixing" type="line">
  50. <view class="example-body2 uni-px-5 uni-pb-5">
  51. <uni-data-checkbox :multiple="false" v-model="radio1" :localdata="sex" @change="change(sex[radio1].text)">
  52. </uni-data-checkbox>
  53. </view>
  54. <view class="uni-px-5 uni-pb-5">
  55. <uni-data-checkbox multiple v-model="checkbox2"
  56. :localdata="sex[radio1].canshu" icon="right" @change="calc" ></uni-data-checkbox>
  57. </view>
  58. <view>
  59. <!-- 检测方法:{{sex[radio1].fangfa}} -->
  60. <view style="margin-bottom: 25rpx; float: right;">总价:{{total}}¥</view>
  61. </view>
  62. </uni-section>
  63. </uni-group>
  64. <view class="">
  65. <uni-section title="" type="line" padding>
  66. <view class="cu-form-group">
  67. <view class="title">报告份数</view>
  68. <uni-number-box v-model="vModelValue" @blur="blur" @focus="focus" @change="changeValue" />
  69. </view>
  70. <view class="cu-form-group">
  71. <view class="title">是否出具意见和解释</view>
  72. <uni-data-checkbox v-model="radio2" :localdata="yijian" @change="change(yijian[radio2].text)">
  73. </uni-data-checkbox>
  74. </view>
  75. <view class="cu-form-group">
  76. <view class="title">检测结论</view>
  77. <uni-data-checkbox v-model="radio3" :localdata="jielun" @change="change(jielun[radio3].text)">
  78. </uni-data-checkbox>
  79. </view>
  80. <view class="cu-form-group">
  81. <view class="title">取报告方式</view>
  82. <uni-data-checkbox style="flex-wrap: nowrap;" v-model="radio4" :localdata="baogao"
  83. @change="change(baogao[radio4].text)"></uni-data-checkbox>
  84. </view>
  85. <uni-collapse-item title="声明" :open="open">
  86. <uni-card :is-shadow="false">
  87. <text class="uni-body" style="color: #DD514C;">1.送样单位须保证样品的真实性、代表性.
  88. 2.本检验中心保证检测结果的公正性,对来样的检测数据负责;并对其样品及相关资料保密。
  89. 3.委托方需对送检样品的安全性和缺陷负责,一旦因样品自身问题发生事故损失的,委托方需承担相应责任。</text>
  90. </uni-card>
  91. </uni-collapse-item>
  92. </uni-section>
  93. </view>
  94. <view class="padding flex flex-direction" style="margin-bottom: 400rpx;">
  95. <button class="cu-btn bg-blue lg" @click="onSubmit">提交</button>
  96. </view>
  97. </form>
  98. </view>
  99. </template>
  100. <script>
  101. const plan_type = [{
  102. text: '返回给委托人',
  103. value: '1'
  104. }, {
  105. text: '自取',
  106. value: '2'
  107. }, {
  108. text: '不取回',
  109. value: '3'
  110. }];
  111. const plan_type1 = [{
  112. text: '委托检测',
  113. value: '1'
  114. }, {
  115. text: '抽样检测',
  116. value: '2'
  117. }];
  118. import myDate from '@/components/my-componets/my-date.vue'
  119. import appSelect from '@/components/my-componets/appSelect.vue'
  120. import md5 from "@/common/util/md5.js"
  121. import { ACCESS_TOKEN,USER_NAME,USER_INFO } from "@/common/util/constants"
  122. export default {
  123. components: {
  124. myDate,
  125. appSelect
  126. },
  127. data() {
  128. return {
  129. order:'',
  130. ypname:'',
  131. ypguige:'',
  132. ypshuliang:'',
  133. yppihao:'',
  134. ypchuzhi:'',
  135. ypleibie:'',
  136. fangfa:'',
  137. total:0,
  138. open:true,
  139. rateValue: 0,
  140. vModelValue: 1,
  141. radio1: 0,
  142. radio2: 1,
  143. radio3: 1,
  144. radio4: 0,
  145. checkbox2: [],
  146. sex: [{
  147. text: '碳素钢和中低合金钢',
  148. value: 0,
  149. canshu:[]
  150. }, {
  151. text: '金属零件',
  152. value: 1,
  153. canshu:[]
  154. }],
  155. yijian: [{
  156. text: '要',
  157. value: 0
  158. }, {
  159. text: '不要',
  160. value: 1
  161. }],
  162. jielun: [{
  163. text: '要',
  164. value: 0
  165. }, {
  166. text: '不要',
  167. value: 1
  168. }],
  169. baogao: [{
  170. text: '自取',
  171. value: 0
  172. }, {
  173. text: '邮件',
  174. value: 1
  175. }, {
  176. text: '其它',
  177. value: 2
  178. }],
  179. value: 0,
  180. type: "default",
  181. inverted: false,
  182. leibie: "",
  183. weituodanhao: '',
  184. plan_type1,
  185. plan_type,
  186. type2: '',
  187. type1: '',
  188. beginTime: '',
  189. index: -1,
  190. leixing: '',
  191. switchC: true,
  192. imgList: [],
  193. uploadUrl: "/sys/common/upload",
  194. myFormData: {
  195. weituodanhao: '',
  196. avatar: '',
  197. realname: '',
  198. username: '',
  199. sex: 1,
  200. birthday: '',
  201. orgCode: '',
  202. workNo: '',
  203. phone: '',
  204. email: '',
  205. id: '',
  206. },
  207. };
  208. },
  209. onLoad: function(option) {
  210. if(option=={} || option.id==undefined){
  211. uni.navigateTo({
  212. url:"/pages/jiance/jindu"
  213. })
  214. return;
  215. }
  216. //委托单号
  217. //this.weituodanhao=option.id;
  218. this.$tip.loading();
  219. //查询原有订单数据
  220. let url="ibps/business/v3/form/def/getFormData?templateKey=ddfqlb&formKey=ddfq&pk=#orderId&rightsScope=data";
  221. url=url.replace("#orderId",option.id)
  222. this.$http.post(url).then(res => {
  223. if (res.data.state == 200) {
  224. this.$tip.loaded()
  225. let data = res.data.data.boData;
  226. let entity=JSON.parse(data);
  227. this.order=entity;
  228. console.log(this.order)
  229. this.weituodanhao=entity.weiTuoDanHao;
  230. this.beginTime=entity.qiWangWanChengShi;
  231. this.total=entity.zongJinE;
  232. //取报告方式
  233. let text=entity.quBaoGaoFangShiJi;
  234. if(text=="自取"){
  235. this.radio4=0;
  236. }else if(text=="邮件"){
  237. this.radio4=1;
  238. }else if(text=="其它"){
  239. this.radio4=2;
  240. }
  241. text=entity.yangPinChuZhi;
  242. if(text=="返回给委托人"){
  243. this.type2="1";
  244. }else if(text=="自取"){
  245. this.type2="2";
  246. }else if(text=="不取回"){
  247. this.type2="3";
  248. }
  249. text=entity.yangPinChuZhi;
  250. if(text=="返回给委托人"){
  251. this.type2="1";
  252. }else if(text=="自取"){
  253. this.type2="2";
  254. }else if(text=="不取回"){
  255. this.type2="3";
  256. }
  257. text=entity.yangPinChuZhi;
  258. if(text=="返回给委托人"){
  259. this.type2="1";
  260. }else if(text=="自取"){
  261. this.type2="2";
  262. }else if(text=="不取回"){
  263. this.type2="3";
  264. }
  265. text=entity.jianCeLeiBie;
  266. if(text=="委托检测"){
  267. this.type1="1";
  268. }else if(text=="抽样检测"){
  269. this.type1="2";
  270. }
  271. this.ypname=entity.gdyrqcyp[0].yangPinMingCheng;
  272. this.ypguige=entity.gdyrqcyp[0].guiGeXingHao;
  273. this.ypshuliang=entity.gdyrqcyp[0].shuLiang;
  274. this.yppihao=entity.gdyrqcyp[0].shengChanRiQiPiHa;
  275. }
  276. });
  277. let pagepara={
  278. "parameters": [],
  279. "requestPage": {
  280. "pageNo": 1,
  281. "limit": 100,
  282. "offset": 0,
  283. "totalCount": 12
  284. }
  285. }
  286. let this_=this;
  287. //"ibps/business/v3/entrust/sysjtsjpz/query"
  288. this.$http.post("/ibps/business/v3/entrust/sysjtsjpz/query", pagepara).then(res => {
  289. if (res.data.state == 200) {
  290. console.log(res.data.variables.data)
  291. let data=res.data.variables.data;
  292. console.log(filterJson(data,"jianCeDuiXiang"))
  293. let jianceduix=filterJson(data,"jianCeDuiXiang")
  294. let datajiance=[]
  295. for(let i in jianceduix){
  296. let yy={};
  297. yy.jianceduix=jianceduix[i].jianCeDuiXiang;
  298. yy.jianCeLeiBie=jianceduix[i].jianCeLeiBie;
  299. yy.jianCeFangFa=jianceduix[i].jianCeFangFa;
  300. yy.canshu=data.filter(function(item){
  301. return item.jianCeDuiXiang==jianceduix[i].jianCeDuiXiang
  302. })
  303. datajiance.push(yy);
  304. }
  305. //let jiance=[];
  306. for(let i in datajiance){
  307. let entity={};
  308. entity.value=i;
  309. entity.text=datajiance[i].jianceduix;
  310. entity.leixing=datajiance[i].jianCeLeiBie;
  311. entity.canshu=datajiance[i].canshu;
  312. entity.fangfa=datajiance[i].jianCeFangFa;
  313. for(let j in datajiance[i].canshu){
  314. datajiance[i].canshu[j].text=datajiance[i].canshu[j].xiangMuCanShu+" 单价:"+datajiance[i].canshu[j].price +"¥"
  315. datajiance[i].canshu[j].value=j;
  316. // datajiance[i].canshu[j].selected=true;
  317. }
  318. if(i<2){
  319. this_.sex[i]=entity;//
  320. }else{
  321. this_.sex.push(entity)
  322. }
  323. //jiance.push(entity)
  324. }
  325. this_.radio1=0;
  326. console.log(this_.sex)
  327. //this_.radio1=0;
  328. }
  329. });
  330. //检测对象 https://www.szjyxt.com/ibps/business/v3/data/template/queryDataTable
  331. let param1 = {
  332. "parameters": [{
  333. "key": "response_data",
  334. "value": "{\"template_id\":\"958692267806162944\",\"template_type\":\"\",\"attrs\":\"\",\"result_columns\":[{\"label\":\"检测对象\",\"name\":\"jian_ce_dui_xiang\"}],\"sort_columns\":\"\",\"buttons\":\"\",\"export_columns\":\"\",\"datasetKey\":\"jianceduixiangv\",\"unique\":\"jian_ce_dui_xiang\",\"key\":\"jcdxzly\",\"dynamic_params\":{}}"
  335. },
  336. {
  337. "key": "filter_condition_key",
  338. "value": ""
  339. }
  340. ]
  341. }
  342. this.$http.post("ibps/business/v3/data/template/queryDataTable", param1).then(res => {
  343. if (res.data.state == 200) {
  344. console.log(res.data.data)
  345. let data = res.data.data.dataResult
  346. console.log(data)
  347. }
  348. });
  349. //检测类型、检测
  350. //请求系统接口demo
  351. let query = this.$Route.query
  352. },
  353. methods: {
  354. calc(e){
  355. let total=0;
  356. let data=e.detail.data;
  357. let canshu=[];
  358. for(let i in data){
  359. total=total+data[i].price;
  360. canshu.push(data[i].xiangMuCanShu)
  361. }
  362. this.canshu=canshu;
  363. this.total=total
  364. },
  365. onChange(e) {
  366. //console.log('rate发生改变:' + JSON.stringify(e))
  367. console.log(e)
  368. // console.log(this.rateValue);
  369. },
  370. onSubmit() {
  371. let data={
  372. crmZhuangTai: "crm",
  373. weiTuoZhuangTai: "待审核",
  374. id: this.order.id,
  375. weiTuoDanHaoZhuan: "",
  376. yangPinBianHaoZhu: "",
  377. shouLiBuMen: "检测室",
  378. weiTuoFang: "外部委托",
  379. jianCeWeiZhi: "",
  380. shouLiShiJian: "2022-06-07",
  381. dingDanHao: "",
  382. dingDanLaiYuan: "业务人员下单",
  383. baoJiaDan: "",
  384. quDao: "",
  385. xiaoShouRenYuan: "",
  386. zongJinE: this.total,
  387. weiTuoDanHao: "",
  388. lianXiRen: "邓进源",
  389. weiTuoDanWei: "975038272398950400",
  390. lianXiFangShi: "",
  391. qiWangWanChengShi: "",
  392. tongXunDiZhi: "质量部",
  393. gdyrqcyp: [],
  394. yangPinChuZhi: "返回给委托人",
  395. jianCeLeiBie: "委托检测",
  396. keHuYaoQiu: "无特殊要求",
  397. jcxmcrm: [],
  398. quBaoGaoFangShiJi: "自取",
  399. baoGaoFenShu: 1,
  400. qiTaYaoQiu: "无特殊要求",
  401. jianCeJieGuoZuoCh: "不要",
  402. jianCeJieLun: "不要",
  403. jianCeBaoGaoZhong: "不要",
  404. hkfab: [],
  405. dingDanShenHeYiJi: "",
  406. dingDanShenPiYiJi: "",
  407. bianZhiRen: "",
  408. yangPinMingCheng: "样品名称",
  409. guiGeXingHao: "45541212",
  410. shengChanRiQiPiHa: "212313130.0.",
  411. shouJiKeHuId:""
  412. };
  413. //组装数据
  414. //获取下单用户信息
  415. let info= uni.getStorageSync(USER_INFO);
  416. console.log(info)
  417. if(info==undefined){
  418. return;
  419. }
  420. data.lianXiRen=info.username;
  421. data.weiTuoDanWei=info.companyname;
  422. data.lianXiFangShi=info.number;
  423. data.dingDanLaiYuan="手机下单";
  424. data.shouLiBuMen="检测室";
  425. data.shouJiKeHuId=info.id;
  426. data.weiTuoDanHao=this.weituodanhao;
  427. data.qiWangWanChengShi=this.beginTime;
  428. //样品处置
  429. if(this.type2==""||this.type1==""){
  430. this.$tip.alert("请选择检测类别或处置方式");
  431. return false;
  432. }
  433. data.yangPinChuZhi=this.plan_type[this.type2-1].text;
  434. //检测类别
  435. data.jianCeLeiBie=this.plan_type1[this.type1-1].text;
  436. //样品名称、规格、数量、批号
  437. let yangpin= {
  438. yangPinMingCheng: this.ypname,
  439. guiGeXingHao:this.ypguige,
  440. shuLiang: this.ypshuliang,
  441. shengChanRiQiPiHa: this.yppihao
  442. }
  443. data.gdyrqcyp.push(yangpin);
  444. //报告份数
  445. data.baoGaoFenShu=this.vModelValue;
  446. //检测结论
  447. data.jianCeJieLun=this.jielun[this.radio3].text;
  448. data.quBaoGaoFangShiJi=this.baogao[this.radio4].text
  449. let para={boCode: "gdyrqcwt",
  450. version: 0,
  451. formKey: "ddfq",
  452. pk: "",
  453. data:JSON.stringify(data)}
  454. // console.log(para)
  455. let that=this;
  456. this.$http.post("ibps/business/v3/data/template/saveFormData/vo",para).then(res =>{
  457. if (res.data.state == 200) {
  458. this.$tip.success("下单成功!")
  459. this.$Router.replace({name:'index'})
  460. }else{
  461. this.$tip.error("请求错误: "+res.data.message)
  462. }
  463. }).catch((err) => {
  464. let msg = ((err.response || {}).data || {}).message || err.data.message || "请求出现错误,请稍后再试"
  465. this.$tip.error(msg);
  466. });
  467. },
  468. DateChange(e) {
  469. this.myFormData.birthday = e.detail.value
  470. },
  471. SwitchC(e) {
  472. this.switchC = e.detail.value
  473. },
  474. sig(sql) {
  475. let rul = (sql.length + 9) * 12 * 3 + 168
  476. let salt = "JinYuanXinTong"
  477. return md5(rul + '' + salt)
  478. },
  479. ChooseImage() {
  480. var that = this;
  481. uni.chooseImage({
  482. count: 4, //默认9
  483. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  484. sourceType: ['album'], //从相册选择
  485. success: (res) => {
  486. that.$http.upload(that.$config.apiUrl + that.uploadUrl, {
  487. filePath: res.tempFilePaths[0],
  488. name: 'file'
  489. })
  490. .then(res => {
  491. that.myFormData.avatar = res.data.message;
  492. })
  493. .catch(err => {
  494. that.$tip.error(err.data.message)
  495. });
  496. this.imgList = res.tempFilePaths
  497. }
  498. });
  499. },
  500. ViewImage(e) {
  501. uni.previewImage({
  502. urls: this.imgList,
  503. current: e.currentTarget.dataset.url
  504. });
  505. },
  506. DelImg(e) {
  507. uni.showModal({
  508. title: '召唤师',
  509. content: '确定要删除这段回忆吗?',
  510. cancelText: '再看看',
  511. confirmText: '再见',
  512. success: res => {
  513. if (res.confirm) {
  514. this.imgList.splice(e.currentTarget.dataset.index, 1)
  515. }
  516. }
  517. })
  518. },
  519. change(text) {
  520. this.checkbox2=[]; //检测项目重新选择
  521. },
  522. changeValue(value) {
  523. console.log('返回数值:', value);
  524. },
  525. focus(e) {
  526. console.log('focus:', e);
  527. },
  528. blur(e) {
  529. console.log('blur:', e);
  530. },
  531. setType() {
  532. let types = ["default", "primary", "success", "warning", "error"];
  533. let index = types.indexOf(this.type);
  534. types.splice(index, 1);
  535. let randomIndex = Math.floor(Math.random() * 4);
  536. this.type = types[randomIndex];
  537. },
  538. setInverted(index) {
  539. this.canshu[index].show = !this.canshu[index].show;
  540. },
  541. }
  542. }
  543. //过滤数据
  544. function filterJson(data, Name) { //data是json对象,Name是根据什么字段去重
  545. var map = {},
  546. dest = [];
  547. for (var i = 0; i < data.length; i++) {
  548. var ai = data[i];
  549. if (i == 0) {
  550. dest.push(ai);
  551. } else {
  552. var filterData = dest.filter(function (e) {
  553. return e[Name] == ai[Name];
  554. })
  555. if (filterData.length == 0) {
  556. dest.push(ai);
  557. }
  558. }
  559. }
  560. return dest;
  561. }
  562. </script>
  563. <style>
  564. .cu-form-group .title {
  565. min-width: calc(4em + 15px);
  566. }
  567. .example-body {
  568. /* #ifndef APP-PLUS-NVUE */
  569. display: flex;
  570. /* #endif */
  571. flex-direction: row;
  572. justify-content: flex-start;
  573. align-items: flex-end;
  574. flex-wrap: wrap;
  575. }
  576. .tag-view {
  577. margin-right: 10px;
  578. }
  579. .example-body2 {
  580. padding: 12px;
  581. background-color: #FFFFFF;
  582. }
  583. .result-box {
  584. text-align: center;
  585. padding: 20px 0px;
  586. font-size: 16px;
  587. }
  588. .uni-list-item {
  589. border-bottom-style: solid;
  590. border-bottom-width: 1px;
  591. border-bottom-color: #eee;
  592. font-size: 14px;
  593. }
  594. .uni-list-item__container {
  595. /* #ifndef APP-NVUE */
  596. display: flex;
  597. width: 100%;
  598. box-sizing: border-box;
  599. /* #endif */
  600. padding: 12px 15px;
  601. flex: 1;
  602. position: relative;
  603. flex-direction: row;
  604. justify-content: space-between;
  605. align-items: center;
  606. }
  607. .uni-list-item__content-title {
  608. font-size: 14px;
  609. color: #666;
  610. }
  611. </style>