auxiliarySalesOrderDetail.vue 23 KB

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