lhypbMessage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <view>
  3. <view class="u-m-20">
  4. <u-form :model="form" ref="form" label-width="220" :error-type="errorType">
  5. <u-form-item label="样品名称" prop="yangPinMingCheng" required>
  6. <u-input placeholder="请输入样品名称" v-model="form.yangPinMingCheng" />
  7. </u-form-item>
  8. <u-form-item label="样品编号">
  9. <u-input placeholder="请输入样品编号" v-model="form.yangPinBianHao" disabled />
  10. </u-form-item>
  11. <u-form-item label="姓名">
  12. <u-input placeholder="请输入姓名" v-model="form.xingMing" />
  13. </u-form-item>
  14. <u-form-item label="性别">
  15. <u-radio-group v-model="form.xingBie">
  16. <u-radio v-for="(it, index) in sexList" :key="index" :name="it.name">
  17. {{it.name}}
  18. </u-radio>
  19. </u-radio-group>
  20. </u-form-item>
  21. <u-form-item label="年龄">
  22. <u-input placeholder="请输入年龄" v-model="form.nianLing" />
  23. </u-form-item>
  24. <u-form-item label="送检批号/编号" prop="songJianPiHao" required>
  25. <u-input placeholder="请输入送检批号/编号" v-model="form.songJianPiHao" />
  26. </u-form-item>
  27. <u-form-item label="样本状态" prop="yangPinZhuangTai" required>
  28. <u-input placeholder="请选择样本状态" type="select" v-model="form.yangPinZhuangTai"
  29. @click="sheetClick('state')" />
  30. </u-form-item>
  31. <u-form-item label="送检时间" prop="songJianShiJian" required>
  32. <u-input placeholder="请选择送检时间" type="select" v-model="form.songJianShiJian"
  33. @click="dateClick('inspect')" />
  34. </u-form-item>
  35. <u-form-item label="备注">
  36. <u-input placeholder="请输入备注" v-model="form.beiZhu1" />
  37. </u-form-item>
  38. <view class="qingshe" style="background-color: #99cc66;">
  39. <view class="qingTitle" style="color: #FFFFFF;">
  40. 常规项目选择
  41. </view>
  42. </view>
  43. <u-form-item label="检测类型">
  44. <u-input placeholder="请选择检测类型" type="select" v-model="form.jianCeType"
  45. @click="selectClick('jianCeType')" />
  46. </u-form-item>
  47. <u-form-item label="检测项目" prop="name" label-position="top">
  48. <checkbox-group v-for="(it, x) in form.jianCeList" :key="x" @click="changeIndex(it,x)">
  49. <label class=" uni-list-cell uni-list-cell-pd"
  50. v-show="(it.jian_ce_lei_bie_==form.jianCeType) || it.checked"
  51. style="display: flex;margin: 15rpx 10rpx;font-size: 20rpx;line-height: 40rpx;">
  52. <view>
  53. <checkbox :checked="it.checked" :value="it.id_" />
  54. </view>
  55. <view style="margin-left: 10rpx;font-size: 28rpx;">
  56. <view>
  57. {{it.jian_ce_lei_bie_ || ''}}-{{it.jian_ce_xiang_mu_ || ''}}
  58. <text style="color: red;">[{{it.zhe_hou_jia_ge_ || '当'}}元]</text>
  59. </view>
  60. <view>{{it.yi_ju_de_biao_zhu || ''}}</view>
  61. <view>报告周期(工作日):{{it.bao_gao_zhou_qi_g || '当'}}天</view>
  62. <view>送样要求:{{it.yang_pin_tiao_jia || ''}}</view>
  63. </view>
  64. </label>
  65. </checkbox-group>
  66. </u-form-item>
  67. <view class="qingshe" style="background-color: #99cc66;">
  68. <view class="qingTitle" style="color: #FFFFFF;">
  69. 套餐选择
  70. </view>
  71. </view>
  72. <u-form-item label="选择套餐" prop="name" label-position="top">
  73. <checkbox-group v-for="(it, x) in form.taoCanList" :key="x" @click="changeTaoCanIndex(it,x)">
  74. <label class=" uni-list-cell uni-list-cell-pd"
  75. style="display: flex;align-items: center;margin: 15rpx 10rpx;font-size: 20rpx;line-height: 40rpx;">
  76. <view>
  77. <checkbox :checked="it.checked" :value="it.id_" />
  78. </view>
  79. <view style="margin-left: 10rpx;font-size: 28rpx;">
  80. <view>
  81. {{it.tao_can_ming_chen || ''}}
  82. </view>
  83. </view>
  84. </label>
  85. </checkbox-group>
  86. </u-form-item>
  87. <view class="qingshe" @click="form.showBoolean1 = !form.showBoolean1">
  88. <view>
  89. ①
  90. </view>
  91. <view>
  92. <u-icon name="arrow-up" v-if="form.showBoolean1"></u-icon>
  93. <u-icon name="arrow-down" v-else></u-icon>
  94. </view>
  95. </view>
  96. <block v-if="form.showBoolean1">
  97. <u-form-item label="样品类型①">
  98. <u-input placeholder="请选择样品类型①" type="select" v-model="form.yangPinLeiXing"
  99. @click="sheetClick('yangpinType1')" />
  100. </u-form-item>
  101. <u-form-item label="样品运输条件①">
  102. <u-input placeholder="请选择样品运输条件①" type="select" v-model="form.yangBenYunShuTiao"
  103. @click="sheetClick('transportType1')" />
  104. </u-form-item>
  105. <u-form-item label="数量①">
  106. <uni-number-box v-model="form.shuLiang"></uni-number-box>
  107. </u-form-item>
  108. <u-form-item label="样品规格①">
  109. <u-input placeholder="请输入样品规格①" v-model="form.yangPinGuiGe" />
  110. <u-button slot="right" type="success" size="mini" @click="sheetClick('specification1')">规格
  111. </u-button>
  112. </u-form-item>
  113. </block>
  114. <view class="qingshe" @click="form.showBoolean2 = !form.showBoolean2">
  115. <view>
  116. ②
  117. </view>
  118. <view>
  119. <u-icon name="arrow-up" v-if="form.showBoolean2"></u-icon>
  120. <u-icon name="arrow-down" v-else></u-icon>
  121. </view>
  122. </view>
  123. <block v-if="form.showBoolean2">
  124. <u-form-item label="样品类型②">
  125. <u-input placeholder="请选择样品类型②" type="select" v-model="form.yangPinLeiXingEr"
  126. @click="sheetClick('yangpinType2')" />
  127. </u-form-item>
  128. <u-form-item label="样品运输条件②">
  129. <u-input placeholder="请选择样品运输条件②" type="select" v-model="form.yangPinYunShuTiao"
  130. @click="sheetClick('transportType2')" />
  131. </u-form-item>
  132. <u-form-item label="数量②">
  133. <uni-number-box v-model="form.shuLiangEr"></uni-number-box>
  134. </u-form-item>
  135. <u-form-item label="样品规格②">
  136. <u-input placeholder="请输入样品规格②" v-model="form.yangPinGuiGeEr" />
  137. <u-button slot="right" type="success" size="mini" @click="sheetClick('specification2')">规格
  138. </u-button>
  139. </u-form-item>
  140. </block>
  141. <view class="qingshe" @click="form.showBoolean3 = !form.showBoolean3">
  142. <view>
  143. ③
  144. </view>
  145. <view>
  146. <u-icon name="arrow-up" v-if="form.showBoolean3"></u-icon>
  147. <u-icon name="arrow-down" v-else></u-icon>
  148. </view>
  149. </view>
  150. <block v-if="form.showBoolean3">
  151. <u-form-item label="样品类型③">
  152. <u-input placeholder="请选择样品类型③" type="select" v-model="form.yangPinLeiXingSan"
  153. @click="sheetClick('yangpinType3')" />
  154. </u-form-item>
  155. <u-form-item label="样品运输条件③">
  156. <u-input placeholder="请选择样品运输条件③" type="select" v-model="form.yangPinYunShuSan"
  157. @click="sheetClick('transportType3')" />
  158. </u-form-item>
  159. <u-form-item label="数量③">
  160. <uni-number-box v-model="form.shuLiangSan"></uni-number-box>
  161. </u-form-item>
  162. <u-form-item label="样品规格③">
  163. <u-input placeholder="请输入样品规格③" v-model="form.yangPinGuiGeSan" />
  164. <u-button slot="right" type="success" size="mini" @click="sheetClick('specification3')">规格
  165. </u-button>
  166. </u-form-item>
  167. </block>
  168. <view class="qingshe" @click="form.showBoolean4 = !form.showBoolean4">
  169. <view>
  170. ④
  171. </view>
  172. <view>
  173. <u-icon name="arrow-up" v-if="form.showBoolean4"></u-icon>
  174. <u-icon name="arrow-down" v-else></u-icon>
  175. </view>
  176. </view>
  177. <block v-if="form.showBoolean4">
  178. <u-form-item label="样品类型④">
  179. <u-input placeholder="请选择样品类型④" type="select" v-model="form.yangPinLeiXingSi"
  180. @click="sheetClick('yangpinType4')" />
  181. </u-form-item>
  182. <u-form-item label="样品运输条件④">
  183. <u-input placeholder="请选择样品运输条件④" type="select" v-model="form.yangPinYunShuSi"
  184. @click="sheetClick('transportType4')" />
  185. </u-form-item>
  186. <u-form-item label="数量④">
  187. <uni-number-box v-model="form.shuLiangSi"></uni-number-box>
  188. </u-form-item>
  189. <u-form-item label="样品规格④">
  190. <u-input placeholder="请输入样品规格④" v-model="form.yangPinGuiGeSi" />
  191. <u-button slot="right" type="success" size="mini" @click="sheetClick('specification4')">规格
  192. </u-button>
  193. </u-form-item>
  194. </block>
  195. <u-form-item label="项目名称" prop="xiangMuMingCheng" v-if="form.weiTuoHeTong == '技术服务协议'">
  196. <u-input placeholder="请输入项目名称" v-model="form.xiangMuMingCheng" />
  197. </u-form-item>
  198. <u-form-item label="样品总价" prop="yangPinZongJia">
  199. <u-input v-model="form.yangPinZongJia" disabled />
  200. </u-form-item>
  201. </u-form>
  202. <view style="height: 220rpx;"></view>
  203. <view class="btnBottom">
  204. <u-button type="error" class="btn" @click="deletSing">取消
  205. </u-button>
  206. <u-button type="error" class="btn" @click="sumbitSing">保存
  207. </u-button>
  208. </view>
  209. </view>
  210. <u-action-sheet :list="list" v-model="sheetShow" @click="actionSheetCallback" z-index="2000">
  211. </u-action-sheet>
  212. <u-select v-model="selectShow" :list="list" @confirm="selectConfirm"></u-select>
  213. <u-calendar v-model="dateShow" :mode="mode" max-date="2050-01-01" @change="dateChange"></u-calendar>
  214. </view>
  215. </template>
  216. <script>
  217. import order from './test.json'
  218. export default {
  219. props: {
  220. jianCeTypeList: {
  221. type: Array,
  222. default: () => {
  223. return []
  224. }
  225. }
  226. },
  227. data() {
  228. return {
  229. errorType: ['toast'],
  230. form: {
  231. },
  232. //样本状态
  233. sampleStateList: order.sampleState,
  234. sexList: order.sex,
  235. //样本类型
  236. sampleTypeList: order.sampleType,
  237. //样本运输条件
  238. transportTypeList: order.transportType,
  239. //样本规格
  240. specificationList: order.specification,
  241. list: [],
  242. listType: '',
  243. sheetShow: false,
  244. selectShow: false,
  245. dateShow: false,
  246. mode: 'date',
  247. type: "",
  248. rules: {
  249. yangPinMingCheng: [{
  250. required: true,
  251. message: '请输入样品名称',
  252. trigger: 'blur',
  253. }],
  254. songJianPiHao: [{
  255. required: true,
  256. message: '请输入送检批号/编号',
  257. trigger: 'blur',
  258. }],
  259. yangPinZhuangTai: [{
  260. required: true,
  261. message: '请输入样本状态',
  262. trigger: 'blur',
  263. }],
  264. songJianShiJian: [{
  265. required: true,
  266. message: '请输入送检时间',
  267. trigger: 'blur',
  268. }],
  269. }
  270. }
  271. },
  272. onReady() {
  273. this.$refs.form.setRules(this.rules);
  274. },
  275. methods: {
  276. getInit(data) {
  277. this.form = data
  278. },
  279. changeIndex(it, x) {
  280. let itemData = this.form
  281. this.form.jianCeList[x].checked = !this.form.jianCeList[x].checked
  282. let show = itemData.jianCeList.some(item => item.id_ == '1039826037036285952' || item.id_ ==
  283. '1040205909151711232')
  284. if (show) {
  285. itemData.mingChengShow = true
  286. }
  287. this.getTotal()
  288. },
  289. changeTaoCanIndex(it, x) {
  290. let itemData = this.form
  291. this.form.taoCanList[x].checked = !this.form.taoCanList[x].checked
  292. this.getTotal()
  293. },
  294. getTotal() {
  295. var itemTotal = 0
  296. this.form.jianCeList.forEach((it, x) => {
  297. if (it.checked) {
  298. itemTotal += parseFloat(it.zhe_hou_jia_ge_ || 0)
  299. }
  300. })
  301. this.form.yangPinZongJia = (itemTotal).toFixed(2)
  302. },
  303. selectClick(type) {
  304. this.listType = type
  305. this.selectShow = true
  306. if (type == 'jianCeType') {
  307. this.list = this.jianCeTypeList
  308. }
  309. },
  310. sheetClick(type) {
  311. this.listType = type
  312. this.sheetShow = true
  313. if (type == 'state') {
  314. this.list = this.sampleStateList
  315. }
  316. //1
  317. if (type.includes('yangpinType')) {
  318. this.list = this.sampleTypeList
  319. }
  320. if (type.includes('transportType')) {
  321. this.list = this.transportTypeList
  322. }
  323. if (type.includes('specification')) {
  324. this.list = this.specificationList
  325. }
  326. if (type == 'disposition') {
  327. this.list = this.dispositionList
  328. }
  329. },
  330. //下拉框回调
  331. actionSheetCallback(e) {
  332. let that = this
  333. let lists = that.form
  334. if (this.listType == 'state') {
  335. lists.yangPinZhuangTai = this.list[e].text
  336. }
  337. //1
  338. if (this.listType == 'yangpinType1') {
  339. lists.yangPinLeiXing = that.list[e].text
  340. }
  341. if (this.listType == 'transportType1') {
  342. lists.yangBenYunShuTiao = that.list[e].text
  343. }
  344. if (this.listType == 'specification1') {
  345. lists.yangPinGuiGe = that.list[e].text
  346. }
  347. //2
  348. if (this.listType == 'yangpinType2') {
  349. lists.yangPinLeiXingEr = that.list[e].text
  350. }
  351. if (this.listType == 'transportType2') {
  352. lists.yangPinYunShuTiao = that.list[e].text
  353. }
  354. if (this.listType == 'specification2') {
  355. lists.yangPinGuiGeEr = that.list[e].text
  356. }
  357. //3
  358. if (this.listType == 'yangpinType3') {
  359. lists.yangPinLeiXingSan = that.list[e].text
  360. }
  361. if (this.listType == 'transportType3') {
  362. lists.yangPinYunShuSan = that.list[e].text
  363. }
  364. if (this.listType == 'specification3') {
  365. lists.yangPinGuiGeSan = that.list[e].text
  366. }
  367. //3
  368. if (this.listType == 'yangpinType4') {
  369. lists.yangPinLeiXingSi = that.list[e].text
  370. }
  371. if (this.listType == 'transportType4') {
  372. lists.yangPinYunShuSi = that.list[e].text
  373. }
  374. if (this.listType == 'specification4') {
  375. lists.yangPinGuiGeSi = that.list[e].text
  376. }
  377. if (this.listType == 'disposition') {
  378. this.form.yangBenChuLi = this.list[e].text
  379. }
  380. },
  381. //调用日期组件
  382. dateClick(type) {
  383. if (type == 'inspect') {
  384. this.type = type
  385. this.mode = 'date'
  386. this.dateShow = true
  387. }
  388. },
  389. //日期回调
  390. dateChange(e) {
  391. if (this.type == 'inspect') {
  392. this.form.songJianShiJian = e.result
  393. }
  394. },
  395. deletSing() {
  396. this.$emit("deletClick")
  397. },
  398. sumbitSing() {
  399. if (this.form.yangPinZongJia == '') {
  400. this.form.yangPinZongJia = 0
  401. }
  402. // let showIndex = this.form.lhypb.findIndex(item => item.jianCeXiangMu == '')
  403. // if (showIndex >= 0) {
  404. // uni.showToast({
  405. // title: `请在样品信息${showIndex+1}选择委托单需要检测项目`,
  406. // icon: 'none',
  407. // duration: 2000
  408. // })
  409. // return
  410. // }
  411. this.$refs.form.validate(valid => {
  412. if (valid) {
  413. this.$emit("sumbitSingClick", this.form)
  414. } else {
  415. uni.showToast({
  416. title: '必填项未填写',
  417. icon: 'none',
  418. duration: 2000
  419. })
  420. }
  421. });
  422. }
  423. }
  424. }
  425. </script>
  426. <style lang="scss" scoped>
  427. .qingshe {
  428. background-color: #f0f9eb;
  429. color: #67c23a;
  430. padding: 15rpx 20rpx;
  431. border-radius: 8rpx;
  432. display: flex;
  433. justify-content: space-between;
  434. align-items: center;
  435. margin-top: 25rpx;
  436. }
  437. .btnBottom {
  438. z-index: 1500;
  439. height: 220rpx;
  440. background-color: #FFFFFF;
  441. position: fixed;
  442. bottom: 0;
  443. left: 0;
  444. right: 0;
  445. .btn {
  446. margin: 20rpx;
  447. }
  448. }
  449. </style>