auxiliarySalesOrderDetail.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <template>
  2. <div class="s-page">
  3. <el-page-header @back="goBack" :content="title"></el-page-header>
  4. <el-divider></el-divider>
  5. <el-card class="box-card">
  6. <div slot="header" class="clearfix">
  7. <span>单据信息</span>
  8. </div>
  9. <div class="mymain-container">
  10. <el-form ref="formData" :rules="rules" :model="formData" label-width="110px" size="small" label-position="left">
  11. <el-row :gutter="20" justify="start">
  12. <el-col :span="8" v-if="id">
  13. <el-form-item label="单据状态">
  14. <el-input type="text" :value="formData.flag == 'SAVE'?'已保存':formData.flag == 'SUBMIT'?'已提交':formData.flag == 'CANCEL'?'取消订单':formData.flag == 'PAY_NOT_TAKE'?'已支付,未提货':formData.flag == 'PAY_TAKE'?'已支付,已提货':''" disabled></el-input>
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="8" v-if="id">
  18. <el-form-item label="单据编号">
  19. <el-input type="text" :value="formData.salesId" disabled></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="8">
  23. <el-form-item label="所属商户" :required="true" >
  24. <el-input type="text" :value="companyName" disabled></el-input>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="8">
  28. <el-form-item label="网点名称" prop="websitId" :required="true">
  29. <el-select v-model="formData.websit" :disabled="formData.flag != 'SAVE' && formType!=0" value-key="websitId" @change="changeWebsit" placeholder="请选择" style="width: 100%;">
  30. <el-option
  31. v-for="item in websitList"
  32. :key="item.websitId"
  33. :label="item.name"
  34. :value="item">
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="8">
  40. <el-form-item label="购买方" :required="true" style="padding-bottom: 1px;">
  41. <el-radio-group v-model="formData.buyPeople">
  42. <el-radio :disabled="formData.flag != 'SAVE' && formType!=0" label="WORKER">内部师傅</el-radio>
  43. <el-radio :disabled="formData.flag != 'SAVE' && formType!=0" label="CUSTOMER">客户</el-radio>
  44. </el-radio-group>
  45. </el-form-item>
  46. </el-col>
  47. <template v-if="formData.buyPeople == 'CUSTOMER'">
  48. <el-col :span="8">
  49. <el-form-item label="客户姓名" prop="workerName" :required="true">
  50. <el-input type="text" :disabled="formData.flag != 'SAVE' && formType!=0" v-model="formData.workerName" placeholder="请输入"></el-input>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="8">
  54. <el-form-item label="客户联系电话" prop="workerMobile" :required="true">
  55. <el-input type="text" :disabled="formData.flag != 'SAVE' && formType!=0" v-model="formData.workerMobile" placeholder="请输入"></el-input>
  56. </el-form-item>
  57. </el-col>
  58. </template>
  59. <template v-else>
  60. <el-col :span="8">
  61. <el-form-item label="师傅姓名" prop="worker" :required="true">
  62. <el-select v-model="formData.worker" :disabled="formData.flag != 'SAVE' && formType!=0" value-key="nickName" @focus="()=>{
  63. if(!this.formData.websitId){return this.$message.warning('请先选择网点名称!');}
  64. }" filterable @change="changeWorker" @blur="workerBlur" placeholder="请选择" style="width: 100%;">
  65. <el-option
  66. v-for="item in workerList"
  67. :key="item.id"
  68. :label="item.nickName + '-' + item.mobile"
  69. :value="item">
  70. </el-option>
  71. </el-select>
  72. </el-form-item>
  73. </el-col>
  74. <!-- <el-col :span="8">
  75. <el-form-item label="师傅身份证" prop="identity" :required="true">
  76. <el-input type="text" :disabled="formData.flag != 'SAVE' && formType!=0" v-model="formData.identity" placeholder="请输入"></el-input>
  77. </el-form-item>
  78. </el-col> -->
  79. <el-col :span="8">
  80. <el-form-item label="师傅联系电话" prop="workerMobile" :required="true">
  81. <el-input type="text" :disabled="formData.flag != 'SAVE' && formType!=0" v-model="formData.workerMobile" placeholder="请输入"></el-input>
  82. </el-form-item>
  83. </el-col>
  84. </template>
  85. <el-col :span="8" v-if="id">
  86. <el-form-item label="单据金额">
  87. <el-input type="text" :value="formData.totalAmount" disabled></el-input>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="6" v-if="id">
  91. <el-form-item label="制单人">
  92. <el-input type="text" :value="formData.createBy" disabled></el-input>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="6" v-if="id">
  96. <el-form-item label="制单时间">
  97. <el-input type="text" :value="formData.createTime" disabled></el-input>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="6" v-if="id">
  101. <el-form-item label="审核人">
  102. <el-input type="text" :value="formData.confirmBy" disabled></el-input>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="6" v-if="id">
  106. <el-form-item label="审核时间">
  107. <el-input type="text" :value="formData.confirmTime" disabled></el-input>
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="12">
  111. <el-form-item label="订单来源" prop="source" :required="true">
  112. <el-select v-model="formData.source" :disabled="true" placeholder="请选择" style="width: 100%;">
  113. <el-option
  114. v-for="item in [{name: '在线订单',id: 'ONLINE'},{name: '自建订单',id: 'SELF'}]"
  115. :key="item.id"
  116. :label="item.name"
  117. :value="item.id">
  118. </el-option>
  119. </el-select>
  120. </el-form-item>
  121. </el-col>
  122. <el-col :span="9">
  123. <el-form-item label="支付方式" prop="payType" :required="true">
  124. <el-select v-model="formData.payType" :disabled="formData.flag != 'SAVE' && formType!=0" placeholder="请选择" style="width: 100%;">
  125. <el-option
  126. v-for="item in [{name: '现金',id: 'CASH'},{name: '微信',id: 'WECHAT'}]"
  127. :key="item.id"
  128. :label="item.name"
  129. :value="item.id">
  130. </el-option>
  131. </el-select>
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="3" v-if="formData.flag == 'SUBMIT' && formData.payType == 'WECHAT'">
  135. <div style="height: 32px;display: flex;align-items: center;cursor: pointer;" @click="wxPay()">微信支付<i class="el-icon-full-screen"></i></div>
  136. </el-col>
  137. <el-col :span="24">
  138. <el-form-item label="备注">
  139. <el-input type="textarea" :rows="4" :disabled="formData.flag != 'SAVE' && formType!=0" v-model="formData.remark" placeholder="请输入"></el-input>
  140. </el-form-item>
  141. </el-col>
  142. </el-row>
  143. </el-form>
  144. </div>
  145. </el-card>
  146. <el-card class="box-card">
  147. <div slot="header" class="clearfix">
  148. <span>辅材信息</span>
  149. </div>
  150. <el-button size="small" v-if="formData.flag == 'SAVE' || formType==0" type="primary" @click="add()">添加</el-button>
  151. <div class="table">
  152. <el-table :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  153. <el-table-column label="大类名称" align="center">
  154. <template slot-scope="scope">
  155. <el-select v-model="scope.row.parentCategory" value-key="categoryId" @change="changeMain" :disabled="isEdit != scope.$index || formType == 2" placeholder="请选择" style="width: 100%;">
  156. <el-option
  157. v-for="item in mainList"
  158. :key="item.categoryId"
  159. :label="item.categoryName"
  160. :value="item">
  161. </el-option>
  162. </el-select>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="小类名称" align="center">
  166. <template slot-scope="scope">
  167. <el-select v-model="scope.row.goodsCategory" @change="changeSmall" @focus="()=>{
  168. if(!scope.row.parentCategory){return this.$message.warning('请先选择大类!');}
  169. }" :disabled="isEdit != scope.$index || formType == 2" value-key="categoryId" placeholder="请选择" style="width: 100%;">
  170. <el-option
  171. v-for="item in scope.row.parentCategory.items"
  172. :key="item.categoryId"
  173. :label="item.categoryName"
  174. :value="item">
  175. </el-option>
  176. </el-select>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="辅材名称" align="center">
  180. <template slot-scope="scope">
  181. <el-select v-model="scope.row.goods" @change="changeGoods" value-key="goodsId" :disabled="isEdit != scope.$index || formType == 2" placeholder="请选择" style="width: 100%;">
  182. <el-option
  183. v-for="item in scope.row.goodsList"
  184. :key="item.goodsId"
  185. :label="item.goodsName"
  186. :value="item">
  187. </el-option>
  188. </el-select>
  189. </template>
  190. </el-table-column>
  191. <el-table-column prop="goods.goodsSalesUnit" align="center" label="单位" ></el-table-column>
  192. <el-table-column prop="" align="center" label="数量" >
  193. <template slot-scope="scope">
  194. <el-input type="number" v-model="scope.row.salesQty" :disabled="isEdit != scope.$index || formType == 2" placeholder="请输入"></el-input>
  195. </template>
  196. </el-table-column>
  197. <el-table-column prop="goods.goodsCode" align="center" label="商品代码"></el-table-column>
  198. <el-table-column prop="goods.goodsSpecification" align="center" label="规格型号"></el-table-column>
  199. <el-table-column prop="goods.price" align="center" label="销售价格"></el-table-column>
  200. <el-table-column prop="" align="center" label="销售金额" >
  201. <template slot-scope="scope" v-if="scope.row.salesQty && scope.row.goods && scope.row.goods.price">
  202. {{((scope.row.goods.price * 100) * scope.row.salesQty / 100).toFixed(2)}}
  203. </template>
  204. </el-table-column>
  205. <el-table-column prop="goods.qty" align="center" label="库存数量"></el-table-column>
  206. <el-table-column label="操作" align="right" width="140">
  207. <template slot-scope="scope" v-if="formType != 2">
  208. <el-button size="mini" type="primary" v-if="scope.$index != isEdit" @click="isEdit = scope.$index">编辑</el-button>
  209. <el-button size="mini" type="danger" @click="dataList.splice(scope.$index,1)">删除</el-button>
  210. </template>
  211. </el-table-column>
  212. </el-table>
  213. </div>
  214. </el-card>
  215. <div class="page-footer">
  216. <div class="footer">
  217. <el-button v-if="formType == 0 || (formType == 1 && formData.flag == 'SAVE')" size="small" type="primary" @click="save()">保存</el-button>
  218. <el-button v-if="formType != 0 && formData.flag == 'SAVE'" size="small" type="primary" @click="submit()">提交</el-button>
  219. <el-button v-if="formData.flag == 'SUBMIT' && formData.payType == 'WECHAT'" size="small" type="primary" @click="wxPay()">微信支付</el-button>
  220. <el-button v-if="formData.flag == 'PAY_NOT_TAKE'" size="small" type="primary" @click="confirm()">确认提货</el-button>
  221. <el-button size="small" type="info" @click="goBack">返回</el-button>
  222. </div>
  223. </div>
  224. <el-dialog title="微信支付" :visible.sync="isPay" width="50%" :close-on-click-modal="false" :modal-append-to-body="false" @close="payCodeUrl = '';clear()">
  225. <h3 style="text-align: center;">扫二维码支付</h3>
  226. <!-- <el-image :src="payCodeUrl" fit="fit"></el-image> -->
  227. <div
  228. ref="payQRCode"
  229. style="display: flex; justify-content: center;"
  230. />
  231. <div style="color: #EA8000;text-align: center;margin-top: 20px;">注:支付成功后,方可操作确认提货!</div>
  232. <div style="display: flex;justify-content: flex-end;margin-top: 30px;">
  233. <el-button size="mini" type="text" @click="isPay = false;clear()">取消</el-button>
  234. <el-button size="small" type="primary" @click="isPay = false;getDetail()">确定</el-button>
  235. </div>
  236. </el-dialog>
  237. </div>
  238. </template>
  239. <script>
  240. import { getWebsit } from "@/api/customerManagement";
  241. import QRCode from "qrcodejs2";
  242. import { getWorker, getCategory, getGoods, getDetail, add, edit, confirm, submit, getCode } from "@/api/auxiliaryFittings/auxiliarySalesOrder";
  243. export default {
  244. props: ['id','title','formType'],
  245. data() {
  246. return {
  247. dataList: [],
  248. websitList: [],
  249. workerList: [],
  250. mainList: [],
  251. isPay: false,
  252. payCodeUrl: '',
  253. formData: {
  254. websit: {},
  255. websitId: '',
  256. websitName: '',
  257. file_url: [],
  258. salesId: '',
  259. flag: '',
  260. createBy: '',
  261. createTime: '',
  262. confirmBy: '',
  263. confirmTime: '',
  264. worker: {},
  265. workerName: '',
  266. workerId: '',
  267. identity: '',
  268. workerMobile: '',
  269. source: 'SELF',
  270. payType: '',
  271. remark: '',
  272. totalAmount: '',
  273. buyPeople: 'WORKER'
  274. },
  275. isEdit: 0,
  276. is_submit: true,
  277. timer: '',
  278. companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
  279. rules: {
  280. websitId: [
  281. { required: true, message: '请选择网点', trigger: 'change' }
  282. ],
  283. worker: [
  284. { required: true, message: '请选择师傅', trigger: 'change' }
  285. ],
  286. source: [
  287. { required: true, message: '请选择订单来源', trigger: 'change' }
  288. ],
  289. payType: [
  290. { required: true, message: '请选择订单来源', trigger: 'change' }
  291. ],
  292. identity: [
  293. { required: true, message: '请输入师傅身份证', trigger: 'blur' },
  294. { pattern:/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '身份证号格式不正确', trigger: 'blur' }
  295. ],
  296. workerMobile: [
  297. { required: true, message: `请输入联系电话`, trigger: 'blur' },
  298. { pattern:/^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/, message: '电话号码格式不正确', trigger: 'blur' }
  299. ],
  300. workerName: [
  301. { required: true, message: '请输入客户姓名', trigger: 'blur' }
  302. ],
  303. }
  304. };
  305. },
  306. computed: {},
  307. created() {
  308. if(this.id){
  309. this.getDetail()
  310. }
  311. this.getWebsit()
  312. },
  313. methods: {
  314. // 返回
  315. goBack() {
  316. this.$emit('back');
  317. },
  318. async getDetail(){
  319. const that = this
  320. getDetail({salesId: this.id}).then( async res => {
  321. Object.assign(this.formData, res.data, {
  322. websit: {websitId: res.data.websitId,name: res.data.websitName},
  323. worker: {nickName: res.data.workerName,userId: res.data.workerId}
  324. })
  325. this.getWorker()
  326. this.getCategory(res.data.websitId)
  327. this.formData.remark = res.data.remark
  328. for(var item of res.data.items){
  329. item.parentCategory = {categoryId: item.parentCategoryId,categoryName: item.parentCategoryName, items: [{categoryId: item.goodsCategoryId,categoryName: item.goodsCategoryName}]}
  330. item.goodsCategory = {categoryId: item.goodsCategoryId,categoryName: item.goodsCategoryName}
  331. var ress = await that.getGoods(item.goodsCategoryId,item.goodsName, 1)
  332. item.goods = ress.data
  333. item.goodsList = ress.data ? [ress.data] : []
  334. }
  335. this.dataList = res.data.items
  336. })
  337. },
  338. getWebsit(){
  339. getWebsit({type: 'C'}).then(res => {
  340. this.websitList = res.data
  341. })
  342. },
  343. changeWebsit(e){
  344. this.formData.websitId = e.websitId
  345. this.formData.websitName = e.name
  346. this.getWorker()
  347. this.getCategory(e.websitId)
  348. },
  349. getCategory(websitId){
  350. getCategory({websitId}).then(res => {
  351. this.mainList = res.data
  352. })
  353. },
  354. async getGoods(categoryId,goodsName,type){
  355. const that = this
  356. if(type == 1){
  357. return new Promise((resolve, reject) => {
  358. getGoods({websitId: this.formData.websitId,categoryId: categoryId,type: 'M',goodsName: goodsName}).then(res => {
  359. resolve({
  360. data: res.data[0]
  361. })
  362. })
  363. })
  364. }else{
  365. getGoods({websitId: this.formData.websitId,categoryId: categoryId,type: 'M'}).then(res => {
  366. that.dataList[that.isEdit].goodsList = res.data
  367. })
  368. }
  369. },
  370. getWorker(){
  371. getWorker({pageNum: 1,pageSize: -1,params: [{param: 'b.websit_id',compare: '=',value: this.formData.websitId}]}).then(res => {
  372. this.workerList = res.data.records
  373. })
  374. },
  375. changeWorker(e){
  376. this.formData.identity = e.idCard
  377. this.formData.workerMobile = e.mobile
  378. this.formData.workerId = e.userId
  379. this.formData.workerName = e.nickName
  380. },
  381. workerBlur(e){
  382. this.formData.worker = e.target.value
  383. this.$forceUpdate()
  384. },
  385. changeMain(e){
  386. this.dataList[this.isEdit].goodsList = [],
  387. this.dataList[this.isEdit].parentCategory = e,
  388. this.dataList[this.isEdit].parentCategoryId = e.categoryId,
  389. this.dataList[this.isEdit].parentCategoryName = e.categoryName,
  390. this.dataList[this.isEdit].goodsCategory = {},
  391. this.dataList[this.isEdit].goodsCategoryName = '',
  392. this.dataList[this.isEdit].goodsCategoryId = '',
  393. this.dataList[this.isEdit].goods = {},
  394. this.dataList[this.isEdit].goodsId = '',
  395. this.dataList[this.isEdit].goodsName = '',
  396. this.dataList[this.isEdit].goodsSalesUnit = '',
  397. this.dataList[this.isEdit].goodsSpecification = '',
  398. this.dataList[this.isEdit].goodsCode = '',
  399. this.dataList[this.isEdit].price = '',
  400. this.dataList[this.isEdit].saleAmount = '',
  401. this.dataList[this.isEdit].salesQty = ''
  402. this.dataList[this.isEdit].qty = '',
  403. this.dataList[this.isEdit].goodsType = 'M'
  404. },
  405. async changeSmall(e){
  406. this.dataList[this.isEdit].goods = {},
  407. this.dataList[this.isEdit].goodsId = '',
  408. this.dataList[this.isEdit].goodsName = '',
  409. this.dataList[this.isEdit].goodsSalesUnit = '',
  410. this.dataList[this.isEdit].goodsSpecification = '',
  411. this.dataList[this.isEdit].goodsCode = '',
  412. this.dataList[this.isEdit].price = '',
  413. this.dataList[this.isEdit].saleAmount = '',
  414. this.dataList[this.isEdit].salesQty = ''
  415. this.dataList[this.isEdit].qty = '',
  416. this.dataList[this.isEdit].goodsCategoryId = e.categoryId
  417. this.dataList[this.isEdit].goodsCategoryName = e.categoryName
  418. getGoods({websitId: this.formData.websitId,categoryId: e.categoryId,type: 'M'}).then(res => {
  419. this.dataList[this.isEdit].goodsList = res.data
  420. })
  421. },
  422. changeGoods(e){
  423. console.log(e)
  424. this.dataList[this.isEdit].goodsId = e.goodsId
  425. this.dataList[this.isEdit].goodsName = e.goodsName
  426. this.dataList[this.isEdit].goodsSalesUnit = e.goodsSalesUnit
  427. this.dataList[this.isEdit].goodsSpecification = e.goodsSpecification
  428. this.dataList[this.isEdit].price = e.price
  429. this.dataList[this.isEdit].goodsCode = e. goodsCode
  430. this.dataList[this.isEdit].qty = e.qty
  431. },
  432. add(){
  433. if(this.dataList.length != 0){this.isEdit += 1}
  434. this.dataList.push({
  435. goodsList: [],
  436. parentCategory: {},
  437. parentCategoryId: '',
  438. parentCategoryName: '',
  439. goodsCategory: {},
  440. goodsCategoryName: '',
  441. goodsCategoryId: '',
  442. goods: {},
  443. goodsId: '',
  444. goodsName: '',
  445. goodsSalesUnit: '',
  446. goodsSpecification: '',
  447. goodsCode: '',
  448. price: '',
  449. saleAmount: '',
  450. salesQty: 1,
  451. qty: '',
  452. goodsType: 'M'
  453. })
  454. },
  455. submit(){
  456. this.$confirm(`请确定是否提交订单, 是否继续?`, '提示', {
  457. confirmButtonText: '确定',
  458. cancelButtonText: '取消',
  459. type: 'warning'
  460. }).then(() => {
  461. submit({
  462. salesId: this.formData.salesId
  463. }).then(res => {
  464. if(res.code == 200){
  465. this.$message.success('提交成功!')
  466. if(this.formData.payType == 'WECHAT'){
  467. this.wxPay()
  468. }else{
  469. this.goBack()
  470. }
  471. }
  472. })
  473. });
  474. },
  475. confirm(){
  476. this.$confirm(`请确定是否确认提货, 是否继续?`, '提示', {
  477. confirmButtonText: '确定',
  478. cancelButtonText: '取消',
  479. type: 'warning'
  480. }).then(() => {
  481. confirm({
  482. salesId: this.formData.salesId
  483. }).then(res => {
  484. if(res.code == 200){
  485. this.$message.success('审核成功!')
  486. this.goBack()
  487. }
  488. })
  489. });
  490. },
  491. checkPay(){
  492. this.timer = setInterval(()=>{
  493. getDetail({salesId: this.id}).then(res => {
  494. if(res.data.payFlag == 'YES'){
  495. this.clear()
  496. this.$message.success('支付成功!')
  497. this.goBack()
  498. }
  499. })
  500. },3000)
  501. },
  502. clear(){
  503. clearInterval(this.timer)
  504. },
  505. wxPay(){
  506. if(!this.is_submit){
  507. return false
  508. }
  509. this.is_submit = false
  510. setTimeout(()=>{
  511. this.is_submit = true
  512. },3000)
  513. getCode({
  514. salesId: this.formData.salesId
  515. }).then(res => {
  516. if(res.code == 200){
  517. this.payCodeUrl = res.data.codeUrl
  518. this.isPay = true
  519. this.$nextTick(() => {
  520. this.payUrl = res.data.codeUrl;
  521. new QRCode(this.$refs.payQRCode, {
  522. text: res.data.codeUrl,
  523. width: 200,
  524. height: 200,
  525. colorDark: "#333333", // 二维码颜色
  526. colorLight: "#ffffff", // 二维码背景色
  527. correctLevel: QRCode.CorrectLevel.L // 容错率,L/M/H
  528. });
  529. this.checkPay()
  530. });
  531. }
  532. })
  533. },
  534. save(){
  535. this.$refs.formData.validate((valid, invalidFields, errLabels) => {
  536. if (valid) {
  537. if(this.formType == 0){
  538. add({
  539. goodsType: 'M',
  540. source: this.formData.source,
  541. payType: this.formData.payType,
  542. remark: this.formData.remark,
  543. websitId: this.formData.websitId,
  544. websitName: this.formData.websitName,
  545. workerName: this.formData.workerName,
  546. workerId: this.formData.workerId,
  547. identity: this.formData.identity,
  548. workerMobile: this.formData.workerMobile,
  549. buyPeople: this.formData.buyPeople,
  550. items: this.dataList
  551. }).then(res => {
  552. if(res.code == 200){
  553. this.$message.success('提交成功!')
  554. this.goBack()
  555. }
  556. })
  557. }else if(this.formType == 1){
  558. edit({
  559. salesId: this.formData.salesId,
  560. goodsType: 'M',
  561. source: this.formData.source,
  562. payType: this.formData.payType,
  563. remark: this.formData.remark,
  564. websitId: this.formData.websitId,
  565. websitName: this.formData.websitName,
  566. workerName: this.formData.workerName,
  567. workerId: this.formData.workerId,
  568. identity: this.formData.identity,
  569. workerMobile: this.formData.workerMobile,
  570. buyPeople: this.formData.buyPeople,
  571. items: this.dataList
  572. }).then(res => {
  573. if(res.code == 200){
  574. this.dataList = []
  575. this.$message.success('提交成功!')
  576. this.goBack()
  577. }
  578. })
  579. }
  580. }
  581. })
  582. }
  583. }
  584. };
  585. </script>
  586. <style scoped="scoped" lang="scss">
  587. .s-page {
  588. padding: 20px;
  589. background-color: #ffffff;
  590. }
  591. .page-footer {
  592. height: 70px;
  593. }
  594. .footer {
  595. position: fixed;
  596. bottom: 0;
  597. left: 0;
  598. z-index: 1;
  599. width: 100%;
  600. background: #fff;
  601. padding: 15px 40px;
  602. box-sizing: border-box;
  603. transition: all 0.28s;
  604. text-align: right;
  605. box-shadow: 0 2px 5px 0 rgb(0 0 0 / 50%), 0 2px 5px 0 rgb(0 0 0 / 10%);
  606. &.hideSidebar {
  607. margin-left: 54px;
  608. width: calc(100vw - 54px);
  609. }
  610. &.openSidebar {
  611. margin-left: 210px;
  612. width: calc(100vw - 210px);
  613. }
  614. .tips {
  615. font-size: 12px;
  616. color: red;
  617. margin-top: 10px;
  618. }
  619. }
  620. </style>