newDetailModel.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  1. <template>
  2. <div class="detail-model new-detail-model">
  3. <!-- 线下开发票 -->
  4. <Modal title="线下开发票" v-model="iShow" class-name="order-model piao-model" :mask-closable="false"
  5. @on-visible-change="visibleChange">
  6. <!-- <Select placeholder="请选择发票类型" v-model="invoice.type" style="width:100%;margin: 20px 0">
  7. <Option v-for="item in invoType" :value="item.n" :key="item.v">{{ item.n }}</Option>
  8. </Select> -->
  9. <p style="text-align:center;margin:16px 0;font-size:15px">确定线下开发票吗?如若确定,则会关闭用户线上开票入口。</p>
  10. <div slot="footer">
  11. <Button type="primary" size="large" @click="invoSave" :disabled="isDisable">确定</Button>
  12. <Button size="large" @click="iShow = false">取消</Button>
  13. </div>
  14. </Modal>
  15. <!-- 新增回款信息 -->
  16. <Modal title="新增回款信息" v-model="backShow" class-name="order-model back-model" :mask-closable="false"
  17. @on-visible-change="visibleChange1">
  18. <Form ref="backed" :model="backed" :rules="backRuleValidate" :label-width="110">
  19. <FormItem label="回款状态" prop="return_status">
  20. <Select v-model="backed.return_status" placeholder="请选择回款状态">
  21. <Option v-for="item in backSats" :value="item.v" :key="item.v">{{ item.n }}</Option>
  22. </Select>
  23. </FormItem>
  24. <FormItem label="回款交易详情" class="back-list">
  25. <Form ref="returned" :model="returned" :rules="backDetailValidate">
  26. <Row :gutter="10" class="back-row">
  27. <Col span="8">
  28. <FormItem prop="returnTime" v-if="visibleChange1">
  29. <date-sigle ref="sigleRef" :dateType="'date'" :placeholderd="'请选择回款时间'" @startDate="startDate"
  30. :overTime="0"></date-sigle>
  31. </FormItem>
  32. </Col>
  33. <Col span="8">
  34. <FormItem prop="returnMoney">
  35. <Input v-model="returned.returnMoney" type="text" placeholder="请输入回款金额" :maxlength="9"
  36. @on-keyup="returned.returnMoney = inptReg(returned.returnMoney)"></Input>
  37. </FormItem>
  38. </Col>
  39. <Col span="8">
  40. <FormItem prop="">
  41. <Input v-model="returned.returnRemark" type="text" placeholder="请输入回款说明(选填)"></Input>
  42. </FormItem>
  43. </Col>
  44. </Row>
  45. <Row :gutter="10" class="back-row">
  46. <Col span="8">
  47. <FormItem prop="returnType">
  48. <Select v-model="returned.returnType" placeholder="请选择支付方式">
  49. <Option v-for="item in backPayType" :value="item.v" :key="item.v">{{ item.n }}</Option>
  50. </Select>
  51. </FormItem>
  52. </Col>
  53. <Col span="8">
  54. <FormItem prop="">
  55. <Input v-model="returned.returnCode" type="text" placeholder="请输入支付单号"></Input>
  56. </FormItem>
  57. </Col>
  58. <Col span="8">
  59. <FormItem prop="returnInvoiceStatus">
  60. <Select v-model="returned.returnInvoiceStatus" placeholder="请选择发票状态">
  61. <Option v-for="item in backInvoStas" :value="item.v" :key="item.v">{{ item.n }}</Option>
  62. </Select>
  63. </FormItem>
  64. </Col>
  65. </Row>
  66. <FormItem prop="">
  67. <b-upload ref="uploadRef1" @fileData="fileData" :placeholdered="'请上传凭证'" :accepted="'.jpg,.png,.jpeg'"
  68. :formated="['jpg', 'png', 'jpeg']" :multipled="false"
  69. :validateVar="returned.returnVoucherUrl"></b-upload>
  70. </FormItem>
  71. </Form>
  72. </FormItem>
  73. </Form>
  74. <div slot="footer">
  75. <Button type="primary" size="large" @click="backSave" :disabled="isDisable">提交</Button>
  76. <Button size="large" @click="backCancel">取消</Button>
  77. </div>
  78. </Modal>
  79. <!-- 上传归档协议 -->
  80. <Modal title="上传归档协议" v-model="pShow" class-name="order-model contract-model" :mask-closable="false"
  81. @on-visible-change="visibleChange">
  82. <Form :label-width="110">
  83. <FormItem required label="归档时间">
  84. <date-sigle ref="sigleRef5" :dateType="'date'" :placeholderd="'请选择归档时间'" @startDate="guiDate"
  85. :overTime="0"></date-sigle>
  86. </FormItem>
  87. <FormItem required label="归档份数">
  88. <Input v-model.number="contract.contract_archive_num" type="tel" maxlength="4" @on-keyup="payHandler"
  89. placeholder="请输入归档份数"></Input>
  90. </FormItem>
  91. <FormItem required label="归档协议">
  92. <b-upload ref="uploadRef2" @fileData="contractFile" :placeholdered="'请上传归档协议'"
  93. :accepted="'.doc,.pdf,.docx,.rar,.zip,.jpg,.png,.jpeg'"
  94. :formated="['doc', 'pdf', 'docx', 'rar', 'zip', 'jpg', 'png', 'jpeg']" :multipled="false"></b-upload>
  95. </FormItem>
  96. </Form>
  97. <div slot="footer">
  98. <Button type="primary" size="large" @click="pingSub" :disabled="isDisable">提交</Button>
  99. <Button size="large" @click="pingCancel">取消</Button>
  100. </div>
  101. </Modal>
  102. <!-- 审核 -->
  103. <Modal title="审核" v-model="sShow" class-name="shen-model" :mask-closable="false" @on-visible-change="visibleChange">
  104. <p>请确认此订单审核结果!</p>
  105. <Input type="tel" placeholder="请输入应付金额(元)" v-model="funds.sum" :maxlength="9"
  106. @on-keyup="funds.sum = inptReg(funds.sum)"></Input>
  107. <div slot="footer">
  108. <Button type="primary" size="large" @click="subConfirm">通过</Button>
  109. <Button type="error" size="large" @click="defeated">失败</Button>
  110. <Button size="large" @click="sShow = false">取消</Button>
  111. </div>
  112. </Modal>
  113. <!-- 退款登记 -->
  114. <Modal title="退款登记" v-model="tShow" class-name="order-model tui-model" :mask-closable="false"
  115. @on-visible-change="visibleChange">
  116. <Form ref="models" :model="models" :rules="refundRuleValidate" :label-width="110">
  117. <FormItem label="退款金额" prop="refundMoney">
  118. <Input v-model="models.refundMoney" type="text" :maxlength="9" placeholder="请输入退款金额"
  119. @on-keyup="models.refundMoney = inptReg(models.refundMoney)"></Input>
  120. </FormItem>
  121. <FormItem label="退款原因" prop="refundType">
  122. <Select placeholder="请选择退款原因" clearable v-model="models.refundType">
  123. <Option v-for="item in refundType" :value="item.v" :key="item.v">{{ item.n }}</Option>
  124. </Select>
  125. </FormItem>
  126. <FormItem label="备注">
  127. <Input v-model="models.refundReason" type="textarea" size="large" :autosize="{ minRows: 2, maxRows: 5 }"
  128. placeholder="请输入备注" :maxlength="255"></Input>
  129. </FormItem>
  130. </Form>
  131. <div slot="footer">
  132. <Button type="primary" size="large" @click="subSave('models')" :disabled="isDisable">提交</Button>
  133. <Button size="large" @click="tShow = false">取消</Button>
  134. </div>
  135. </Modal>
  136. <!-- 修正记录 -->
  137. <Modal title="红冲" v-model="correctionShow" class-name="order-model tui-model" :mask-closable="false"
  138. @on-visible-change="visibleChange">
  139. <!-- <label class="correctionLabel">请输入该订单最终准确的信息:</label> -->
  140. <Form ref="correctionModels" :model="models" :label-width="110">
  141. <FormItem label="红冲类型">
  142. <RadioGroup v-model="models.redType" @on-change="checkAllGroupChange">
  143. <Radio label="签约主体红冲"></Radio>
  144. <Radio label="金额红冲"></Radio>
  145. </RadioGroup>
  146. </FormItem>
  147. <p class="correctionLabel">请输入该订单最终准确的信息:</p>
  148. <FormItem label="签约主体" v-if="redCorrection == 3 || redCorrection == 1">
  149. <Input v-model="signingSubject" type="text" :maxlength="50" disabled placeholder="请输入签约主体"></Input>
  150. </FormItem>
  151. <!-- bigPayMoney -->
  152. <FormItem label="合同金额" v-if="(redCorrection == 3 || redCorrection == 2) && bigCorrection">
  153. <Input v-model="models.payMoney" type="text" :maxlength="9" placeholder="合同金额"></Input>
  154. </FormItem>
  155. <!-- <FormItem label="子账号应付金额" v-if="(redCorrection == 3 || redCorrection == 2) && bigCorrection">
  156. <Input v-model="models.subMoney" type="text" :maxlength="9" :disabled="!(filterData.subPayMoney && filterData.subPayMoney>0)" placeholder="请输入子账号应付金额"></Input>
  157. </FormItem>
  158. <FormItem label="补充包应付金额" v-if="(redCorrection == 3 || redCorrection == 2) && bigCorrection">
  159. <Input v-model="models.supplyMoney" type="text" :maxlength="9" :disabled="!(filterData.supplyPayMoney && filterData.supplyPayMoney>0)" placeholder="请输入补充包应付金额"></Input>
  160. </FormItem> -->
  161. <!-- <FormItem label="订单金额" v-if="(redCorrection == 3 || redCorrection == 2) && !bigCorrection">
  162. <Input v-model="models.orderMoney" type="text" :maxlength="9" placeholder="请输入订单金额"></Input>
  163. </FormItem> -->
  164. <FormItem label="合同金额" v-if="(redCorrection == 3 || redCorrection == 2) && !bigCorrection">
  165. <Input v-model="models.payMoney" type="text" :maxlength="9" placeholder="请输入合同金额"></Input>
  166. </FormItem>
  167. <FormItem label="佣金" v-if="redCorrection == 3 || redCorrection == 2">
  168. <Input v-model="models.commission" type="text" :maxlength="9" placeholder="请输入佣金"></Input>
  169. </FormItem>
  170. <!-- <FormItem label="手续费" v-if="redCorrection == 3 || redCorrection == 2">
  171. <Input v-model="models.proceduresMoney" type="text" :maxlength="9" placeholder="请输入手续费"></Input>
  172. </FormItem> -->
  173. <FormItem label="修正原因">
  174. <Select placeholder="请选择修正原因" clearable v-model="models.correctionType">
  175. <Option v-for="item in correctionType" :value="item.v" :key="item.v">{{ item.n }}</Option>
  176. </Select>
  177. </FormItem>
  178. <FormItem label="">
  179. <Input v-model="models.correctionReason" v-if="models.correctionType === '其他'" type="textarea" size="large"
  180. :autosize="{ minRows: 2, maxRows: 5 }" placeholder="请输入修正原因"></Input>
  181. </FormItem>
  182. </Form>
  183. <div slot="footer">
  184. <Button type="primary" size="large" @click="correctionSave()" :disabled="redCorrection == 4" :loading="btnloading">提交</Button>
  185. <Button size="large" @click="correctionShow = false">取消</Button>
  186. </div>
  187. </Modal>
  188. <!-- 权限开通 -->
  189. <Modal title="权限开通" v-model="permissionActivationShow" class-name="order-model permissionActivation-model"
  190. :mask-closable="false" @on-visible-change="permissionActivationVisible">
  191. <Form ref="permissionActivation" :model="permissionActivation" :label-width="120">
  192. <FormItem label="开通权益手机号" style="width: 460px;" required>
  193. <Input class="ipt-inpt" v-model="permissionActivation.phone" type="text" @on-keyup="keyHandler"
  194. :maxlength="11" placeholder="请输入手机号"></Input>
  195. </FormItem>
  196. <FormItem label="开始日期" style="width: 460px;" required>
  197. <date-sigle ref="sigleRef1" :dateType="'date'" :placeholderd="'请选择开始日期'" @startDate="startDate_"
  198. :overTime="0"></date-sigle>
  199. </FormItem>
  200. </Form>
  201. <div slot="footer">
  202. <Button type="primary" size="large" @click="pa_Save" :disabled="pa_dis">确定</Button>
  203. <Button size="large" @click="permissionActivationShow = false">取消</Button>
  204. </div>
  205. </Modal>
  206. <!-- 权限开通 -->
  207. <Modal title="业绩变更" v-model="performanceShow" class-name="order-model performance-model" :mask-closable="false"
  208. @on-visible-change="performanceVisible">
  209. <Form ref="performance" :model="performanceFrom" :label-width="120">
  210. <FormItem label="请输入变更后业绩归属情况" class="formTitle" :label-width="230"></FormItem>
  211. <FormItem label="销售人员">
  212. <sale-select ref="saleRef" :saleType="'1'" @salePerson="salePerson" transfer></sale-select>
  213. </FormItem>
  214. <FormItem class="table-order1" v-show="saleTableData.length > 0">
  215. <Table border :columns="saleTable" :data="saleTableData">
  216. <template slot-scope="{ row }" slot="name">
  217. <strong>{{ row.name }}</strong>
  218. </template>
  219. <template slot-scope="{ row }" slot="saler_dept">
  220. <strong>{{ row.saler_dept }}</strong>
  221. </template>
  222. <template slot-scope="{ row, index }" slot="money">
  223. <Input style="padding: 0 10px;" v-model="saleTableData[index].money" type="number" placeholder="请输入"></Input>
  224. </template>
  225. <template slot-scope="{ row }" slot="channel">
  226. <span style="display:none;">{{ row.channel }}</span>
  227. <!-- <Input v-model="saleTableData[index].channel" type="number" placeholder="请输入"></Input> -->
  228. <Cascader :data="channelListGetters" v-model="row.channel" @on-change="(value,selectedData)=>{ onChangeCascader(value,selectedData,row)}" transfer />
  229. <!-- <v-cascader ref="casRef" :data-id="row.channel" :initVal="row.channel" placeholderType="销售渠道" type="1" quType="1" transfer></v-cascader> -->
  230. </template>
  231. </Table>
  232. </FormItem>
  233. <FormItem label="变更原因">
  234. <RadioGroup v-model="performanceFrom.changeReason">
  235. <Radio :label="item" v-for="item in reasonList" :key="item">{{item}}</Radio>
  236. </RadioGroup>
  237. </FormItem>
  238. </Form>
  239. <div slot="footer">
  240. <Button type="primary" size="large" :disabled="performanceDis" @click="performanceSave">确定</Button>
  241. <Button size="large" @click="performanceShow = false">取消</Button>
  242. </div>
  243. </Modal>
  244. <!-- 微信/支付宝付款码 -->
  245. <Modal title="微信/支付宝付款码" v-model="paymentCodeShow" class-name="order-model payment-code-model" :mask-closable="false"
  246. @on-visible-change="onPaymentVisibleChange">
  247. <Form ref="performance" :model="paymentForm" :label-width="180">
  248. <FormItem label="付款金额(元):">
  249. <Input v-model="paymentForm.money" type="number" placeholder="请输入付款金额" @on-change="onChangePayMoney"></Input>
  250. </FormItem>
  251. <FormItem label="付款方式:">
  252. <RadioGroup v-model="paymentForm.mode" @on-change="onChangePayWay">
  253. <Radio label="1">微信</Radio>
  254. <Radio label="2">支付宝</Radio>
  255. </RadioGroup>
  256. </FormItem>
  257. <div class="screenshot-container" ref="screenshotRef" v-loading="paymentLoading" element-loading-background="rgba(255,255, 255)">
  258. <img class="screenshot-logo" src="@/assets/images/logo_main.png" alt="logo">
  259. <div class="screenshot-content">
  260. <div class="screenshot-info">
  261. <p v-if="paymentForm.account">{{paymentForm.account}}</p>
  262. <p v-if="paymentForm.product">产品类型:{{paymentForm.product}}</p>
  263. </div>
  264. <div class="screenshot-money">金额 <i class="num">¥{{formatPrice(paymentForm.money, -1, true)}}</i></div>
  265. <div class="screenshot-code">
  266. <img :src="paymentForm.imgCode">
  267. </div>
  268. <p class="screenshot-tip">使用手机{{paymentForm.mode === '1' ? '微信' : '支付宝'}}扫描二维码支付</p>
  269. <p class="screenshot-date">此二维码有效期截至到:{{ dateFormatter(paymentForm.expire * 1000, 'yyyy年MM月dd日') || '--'}}</p>
  270. </div>
  271. </div>
  272. </Form>
  273. <div slot="footer" style="display:flex;flex-direction: column;align-items: center;">
  274. <Button style="width:100%;" type="primary" size="large" :disabled="saveCodeDisabled" @click="onSavePaymentCode">保存二维码</Button>
  275. <p class="guide-tip">将二维码发送给客户,引导客户扫码支付</p>
  276. </div>
  277. </Modal>
  278. </div>
  279. </template>
  280. <script>
  281. import html2canvas from 'html2canvas'
  282. import { mapGetters } from 'vuex'
  283. import dateSigle from '@/components/dateSigle.vue'
  284. import bUpload from '@/components/uploadFile.vue'
  285. import saleSelect from '@/views/order/components/salesSelect.vue'
  286. import { dateFormatter } from '@/assets/js/date'
  287. import { copyImage } from '@/utils/copy'
  288. // import { Loading } from 'element-ui';
  289. import vCascader from '@/components/cascader'
  290. import { getChannelCode, formatPrice, debounce } from '@/utils/globalFun'
  291. import QRCode from 'qrcode'
  292. import { ajaxGetPayCode } from '@/api/modules'
  293. export default {
  294. name: 'newDetailModel',
  295. props: {
  296. data: {},
  297. orderDetail: {},
  298. contractData: {},
  299. returnRes: {},
  300. returnInfo: {},
  301. filterData: {},
  302. isStatus: String,
  303. payMoney: Number
  304. },
  305. components: {
  306. dateSigle,
  307. bUpload,
  308. saleSelect,
  309. vCascader
  310. },
  311. methods: {
  312. dateFormatter, formatPrice,
  313. inited() {
  314. this.invoice.type = ''
  315. this.funds.sum = ''
  316. this.redCorrection = 4
  317. this.models.redType = ""
  318. this.models.refundReason = ''
  319. this.models.refundType = ''
  320. this.models.correctionReason = ''
  321. this.models.correctionType = ''
  322. this.contract.contractFileUrl = ''
  323. this.returned.returnVoucherUrl = ''
  324. this.returned.returnRemark = ''
  325. this.returned.returnCode = ''
  326. this.$refs.sigleRef.initd()
  327. this.$refs['backed'].resetFields()
  328. this.$refs['returned'].resetFields()
  329. this.$refs['models'].resetFields()
  330. this.$refs.uploadRef1.uploadShow = false
  331. this.$refs.uploadRef1.payHtml = ''
  332. this.$refs.uploadRef2.uploadShow = false
  333. this.$refs.uploadRef2.payHtml = ''
  334. },
  335. inptReg(val) {
  336. return val.match(/\d+(\.\d{0,2})?/) ? val.match(/\d+(\.\d{0,2})?/)[0] : ''
  337. },
  338. keyHandler() {
  339. this.permissionActivation.phone = this.permissionActivation.phone.replace(/[^\d]/g, '')
  340. },
  341. timeReg(val) {
  342. return new Date(dateFormatter(val, 'yyyy-MM-dd') + ' 00:00:00').getTime() / 1000
  343. },
  344. startDate_(val) {
  345. if (val) {
  346. this.permissionActivation.startTime = this.timeReg(val)
  347. } else {
  348. this.permissionActivation.startTime = ''
  349. }
  350. },
  351. permissionActivationVisible(val) {
  352. if (val) {
  353. this.permissionActivation.phone = this.orderDetail.user_phone || ''
  354. this.permissionActivation.orderCode = this.orderDetail.order_code
  355. } else {
  356. this.permissionActivation.phone = ''
  357. this.permissionActivation.startTime = ''
  358. this.permissionActivation.orderCode = ''
  359. this.$refs.sigleRef1.dataVals = ''
  360. }
  361. },
  362. pa_Save() {
  363. if (this.permissionActivation.phone == '') {
  364. this.$Notice.warning({ title: '请输入手机号' })
  365. return
  366. }
  367. if (this.permissionActivation.phone && !/^1[3456789]\d{9}$/.test(this.permissionActivation.phone)) {
  368. this.$Notice.warning({ title: '手机号格式不正确' })
  369. return
  370. }
  371. if (this.permissionActivation.startTime == '') {
  372. this.$Notice.warning({ title: '请选择开始日期' })
  373. return
  374. }
  375. this.pa_dis = true
  376. let obj = this.permissionActivation
  377. this.$request('/order/serviceOpen').data(obj).success(() => {
  378. this.$parent.ordered()
  379. this.permissionActivationShow = false
  380. this.$Message.success({ content: '提交成功' })
  381. this.pa_dis = false
  382. }).error(() => {
  383. this.pa_dis = false
  384. }).post()
  385. },
  386. performanceVisible(val) {
  387. if (val) {
  388. const { saleDataRes } = JSON.parse(JSON.stringify(this.data))
  389. let list =[]
  390. if (saleDataRes.saleFinal) {
  391. list = saleDataRes.saleFinal.list || []
  392. let sarr = list.map(ele => {
  393. return ele.id + ''
  394. })
  395. this.$nextTick(()=>{
  396. this.$refs.saleRef.salePerson = sarr
  397. setTimeout(() => {
  398. if (saleDataRes.saleFinal && saleDataRes.saleFinal.list.length > 0) {
  399. let salelist = JSON.parse(JSON.stringify(saleDataRes.saleFinal.list))
  400. salelist.forEach(ele => {
  401. ele.channel = getChannelCode(this.channelListGetters, ele.distribution_channel)
  402. ele.money = ele.money / 100
  403. })
  404. this.saleTableData = salelist
  405. let ajaxinitSalelist = JSON.parse(JSON.stringify(saleDataRes.saleFinal.list))
  406. ajaxinitSalelist.forEach(ele => {
  407. ele.money = ele.money / 100
  408. // ele.channel = ele.distribution_channel
  409. })
  410. this.ajaxinitSalelist = ajaxinitSalelist
  411. }
  412. }, 500)
  413. })
  414. this.reasonList = saleDataRes.reason
  415. }
  416. }else{
  417. this.performanceFrom.changeReason = ''
  418. this.saleTableData = []
  419. this.$refs.saleRef.salePerson = []
  420. }
  421. },
  422. performanceSave() {
  423. let salesMoneylist = this.saleTableData.map(ele => {
  424. const channel = ele.channel[1]? ele.channel[1] : ''
  425. return { id: Number(ele.id), money: this.fixedNum(ele.money), channel: channel }
  426. })
  427. this.performanceDis = true
  428. this.$request('/order/saleRecord').data({
  429. orderCode: this.orderDetail.order_code,
  430. doType: "update",
  431. salesMoney: JSON.stringify(salesMoneylist),
  432. reason: this.performanceFrom.changeReason
  433. }).success((res) => {
  434. this.performanceDis = false
  435. this.$parent.ordered()
  436. if (res.data == 'success') {
  437. this.$Notice.success({ title: '提交成功' })
  438. this.performanceShow = false
  439. }
  440. }).error(() => {
  441. this.performanceDis = false
  442. }).post()
  443. },
  444. onChangeCascader(val, valList, row) {
  445. let list = this.saleTableData
  446. // console.log(JSON.stringify(row));
  447. list.forEach(v => {
  448. if (v.id === row.id) {
  449. v.distribution_channel = val[1]
  450. v.channel = val
  451. }
  452. })
  453. },
  454. salePerson(val){
  455. let saleNameArr = []
  456. let initlist = JSON.parse(JSON.stringify(this.ajaxinitSalelist))
  457. const channelMap = this.channelMapGetters
  458. val.forEach((v,i) => {
  459. let vjson = JSON.parse(v)
  460. saleNameArr.push({ name: vjson.username,id: vjson.id,saler_dept: vjson.deptName,money: '',channel: getChannelCode(this.channelListGetters, channelMap[vjson.deptId])})
  461. initlist.forEach((ele) =>{
  462. if(ele.id == vjson.id){
  463. saleNameArr[i].money = ele.money
  464. saleNameArr[i].channel = ele.channel ? ele.channel : getChannelCode(this.channelListGetters, channelMap[vjson.deptId])
  465. }
  466. })
  467. })
  468. this.saleTableData = saleNameArr
  469. },
  470. visibleChange1(val) {
  471. if (val == false) {
  472. setTimeout(() => {
  473. this.inited()
  474. }, 500)
  475. } else {
  476. this.isDisable = false
  477. }
  478. },
  479. visibleChange(val) {
  480. if (val == false) {
  481. setTimeout(() => {
  482. this.inited()
  483. }, 500)
  484. } else {
  485. this.isDisable = false
  486. }
  487. },
  488. invoSave() {// 线下开发票
  489. // if (this.invoice.type == '') {
  490. // this.$Message.warning('请选择发票类型')
  491. // return
  492. // }
  493. this.isDisable = true
  494. this.$request('/order/openInvoice').data({
  495. orderCode: this.orderDetail.order_code,
  496. // invoiceType: this.invoice.type,
  497. // userId: this.orderDetail.user_id
  498. }).showSuccessTip().success(() => {
  499. this.$parent.ordered()
  500. this.iShow = false
  501. this.inited()
  502. setTimeout(() => {
  503. this.isDisable = false
  504. }, 1000)
  505. }).error(() => {
  506. this.isDisable = false
  507. }).post()
  508. },
  509. fileData(val) {
  510. this.returned.returnVoucherUrl = val
  511. },
  512. contractFile(val) {
  513. this.contract.contractFileUrl = val
  514. },
  515. guiDate(val) {
  516. this.contract.contract_archive_time = val
  517. },
  518. payHandler() {
  519. this.contract.contract_archive_num = Number(String(this.contract.contract_archive_num).replace(/[^\d]+/g, ''))
  520. },
  521. startDate(val) {
  522. this.returned.returnTime = val
  523. },
  524. fixedNum(val) {
  525. return val ? Number(parseFloat(val * 100).toFixed(0)) : 0
  526. },
  527. backSave() {// 新增回款信息提交
  528. let obj = {
  529. id: parseInt(this.orderDetail.id),
  530. orderCode: this.orderDetail.order_code,
  531. return_status: parseInt(this.backed.return_status ? this.backed.return_status : 0),
  532. returnTime: this.returned.returnTime,
  533. returnMoney: this.fixedNum(this.returned.returnMoney),
  534. returnRemark: this.returned.returnRemark,
  535. returnType: parseInt(this.returned.returnType ? this.returned.returnType : 0),
  536. returnCode: this.returned.returnCode,
  537. returnInvoiceStatus: parseInt(this.returned.returnInvoiceStatus ? this.returned.returnInvoiceStatus : 0),
  538. returnVoucherUrl: this.returned.returnVoucherUrl
  539. }
  540. this.$refs.backed.validate((valid) => {
  541. if (valid) {
  542. this.$refs.returned.validate((valid) => {
  543. if (valid) {
  544. this.isDisable = true
  545. this.$request('/order/editReturnInfo').data(
  546. obj
  547. ).showSuccessTip().success(() => {
  548. this.backShow = false
  549. this.$parent.ordered()
  550. this.inited()
  551. setTimeout(() => {
  552. this.isDisable = false
  553. }, 1000)
  554. }).error(() => {
  555. this.isDisable = false
  556. }).post()
  557. }
  558. })
  559. } else {
  560. this.$refs.returned.validate((valid) => {
  561. if (valid) { }
  562. })
  563. }
  564. })
  565. },
  566. backCancel() {
  567. this.backShow = false
  568. },
  569. pingSub() {// 上传归档协议
  570. if (!this.contract.contractFileUrl) {
  571. this.$notify.warning({ title: '请上传归档协议'})
  572. return
  573. }
  574. this.isDisable = true
  575. this.$jyRequest('/jyOrderManager/order/uploadContractFile').data({
  576. contractId: $.isEmptyObject(this.contractData) == false ? this.contractData.id : -1,
  577. orderCode: this.orderDetail.order_code,
  578. contractFileUrl: this.contract.contractFileUrl,
  579. contract_archive_time: this.contract.contract_archive_time,
  580. contract_archive_num: this.contract.contract_archive_num,
  581. }).showSuccessTip().success(() => {
  582. this.pShow = false
  583. this.inited()
  584. setTimeout(() => {
  585. this.isDisable = false
  586. }, 1000)
  587. this.$emit('refresh', '协议信息')
  588. }).error(() => {
  589. this.isDisable = false
  590. }).post()
  591. },
  592. pingCancel() {
  593. this.pShow = false
  594. setTimeout(() => {
  595. this.inited()
  596. }, 500)
  597. },
  598. audFunc(num) {
  599. this.isDisable = true
  600. this.$jyRequest('/jyOrderManager/order/transferAccounts').data({
  601. pay_money: this.fixedNum(this.funds.sum),
  602. order_code: this.orderDetail.order_code,
  603. courseStatus: num
  604. }).showSuccessTip().success(() => {
  605. this.$parent.ordered()
  606. this.sShow = false
  607. this.inited()
  608. setTimeout(() => {
  609. this.isDisable = false
  610. }, 1000)
  611. }).error(() => {
  612. this.isDisable = false
  613. }).post()
  614. },
  615. subConfirm() {// 订单审核通过
  616. if (this.funds.sum == '') {
  617. this.$Message.warning('应付金额为必填项')
  618. return
  619. }
  620. this.audFunc(4)
  621. },
  622. defeated() {// 订单审核失败
  623. this.audFunc(3)
  624. },
  625. qmxed() {
  626. if (this.isStatus == 'qmx') {
  627. return this.returnInfo.money == this.fixedNum(this.models.refundMoney) ? 1 : 2
  628. } else {
  629. return this.fixedNum(this.models.refundMoney) > this.payMoney || this.fixedNum(this.models.refundMoney) == this.payMoney ? 1 : 2
  630. }
  631. },
  632. subSave(name) {// 退款
  633. let sums = 0
  634. if (this.isStatus == 'qmx') {
  635. this.returnRes.forEach(v => {
  636. sums = sums + v.return_money
  637. })
  638. if (this.fixedNum(this.models.refundMoney) / 100 > sums / 100) {
  639. this.$Message.warning('退款金额不能大于已回款金额!')
  640. return
  641. }
  642. }
  643. let obj = {
  644. orderCode: this.orderDetail.order_code,
  645. refundMoney: this.fixedNum(this.models.refundMoney),
  646. refundReason: this.models.refundReason,
  647. refundType: this.models.refundType,
  648. isOffline: this.isStatus == 'qmx' ? 1 : 0,
  649. refundStatus: this.qmxed()
  650. }
  651. this.$refs[name].validate((valid) => {
  652. if (valid) {
  653. this.isDisable = true
  654. this.$request('/order/orderList/confirmRefund').data(
  655. obj
  656. ).showSuccessTip().success(() => {
  657. this.tShow = false
  658. this.models.refundReason = ''
  659. this.models.refundType = ''
  660. this.$parent.ordered()
  661. setTimeout(() => {
  662. this.isDisable = false
  663. }, 1000)
  664. }).error(() => {
  665. this.isDisable = false
  666. }).get()
  667. }
  668. })
  669. },
  670. correctionSave() {
  671. if (this.models.correctionType === '') {
  672. this.$Message.warning('修正原因为必填项')
  673. return
  674. }
  675. let obj = {
  676. orderCode: this.orderDetail.order_code,
  677. // orderMoney: this.fixedNum(this.models.orderMoney),
  678. // payMoney: this.orderDetail.product_type === '大会员' ? this.fixedNum(this.models.bigPayMoney) : this.fixedNum(this.models.payMoney),
  679. payMoney: this.fixedNum(this.models.payMoney),
  680. bigSubMoney: this.fixedNum(this.models.subMoney),
  681. supplyMoney: this.fixedNum(this.models.supplyMoney),
  682. commission: this.fixedNum(this.models.commission),
  683. proceduresMoney: this.fixedNum(this.models.proceduresMoney),
  684. correctionReason: this.models.correctionType !== '其他' ? this.models.correctionType : this.models.correctionReason,
  685. redType: this.models.redType,
  686. signingSubject: this.signingSubject,
  687. }
  688. this.btnloading = true
  689. this.$request('/order/addUpdateRecord').data(
  690. obj
  691. ).showSuccessTip().success(() => {
  692. this.correctionShow = false
  693. this.btnloading = false
  694. this.$parent.ordered()
  695. this.inited()
  696. }).error(() => { }).get()
  697. },
  698. checkAllGroupChange(data) {
  699. console.log(data)
  700. if (data === '签约主体红冲') {
  701. this.redCorrection = 1
  702. } else if (data === '金额红冲') {
  703. this.redCorrection = 2
  704. }
  705. // 以下为多选时判断
  706. // if (data.length === 1 && data[0] === '签约主体红冲') {
  707. // this.redCorrection = 1
  708. // } else if (data.length === 1 && data[0] === '金额红冲') {
  709. // this.redCorrection = 2
  710. // } else if (data.length === 0) {
  711. // this.redCorrection = 4
  712. // } else {
  713. // this.redCorrection = 3
  714. // }
  715. },
  716. onPaymentVisibleChange(val){
  717. console.log(val)
  718. if(val) {
  719. this.getPayOrderInfo('query')
  720. }
  721. },
  722. getPayOrderInfo(doType, money, payWay) {
  723. this.paymentLoading = true
  724. console.log(money, payWay, 'order_code')
  725. ajaxGetPayCode({
  726. orderCode: this.orderDetail.order_code,
  727. money: money ? Math.round(Number(money) * 10000) / 100 : undefined,
  728. payWay: payWay ? Number(payWay) : undefined,
  729. doType
  730. }).then(res => {
  731. console.log(res,'res')
  732. if(res.error_code === 0 && res.data) {
  733. if(doType === 'query') {
  734. this.paymentForm.money = res.data.money / 100
  735. this.paymentForm.product = res.data.product
  736. this.paymentForm.account = res.data.account
  737. this.paymentForm.noPayment = res.data.money / 100
  738. this.getPayOrderInfo('getPay', this.paymentForm.money, this.paymentForm.mode)
  739. } else if (doType === 'getPay') {
  740. this.paymentLoading = false
  741. // this.paymentForm.imgCode = res.data.product
  742. this.paymentForm.expire = res.data.expire
  743. QRCode.toDataURL(res.data.product,{
  744. color: {
  745. dark:"#000000",
  746. light:"#FFFFFF"
  747. }
  748. }).then((url) => {
  749. // 获取到url后即可在页面使用--二维码图片
  750. this.paymentForm.imgCode = url
  751. }).catch((e) => {
  752. console.log('e', e)
  753. this.$toast('二维码转换失败')
  754. })
  755. }
  756. }
  757. })
  758. },
  759. onChangePayWay(val){
  760. this.paymentForm.mode = val
  761. this.paymentLoading = true
  762. this.getPayOrderInfo('getPay', this.paymentForm.money, this.paymentForm.mode)
  763. },
  764. onChangePayMoney: debounce(function () {
  765. // this.paymentForm.money = formatInputMoney(this.paymentForm.money)
  766. const noPayment = this.paymentForm.noPayment
  767. const currentMoney = Number(this.paymentForm.money)
  768. console.log(noPayment, currentMoney, 'change money');
  769. // 正则表达式:只允许数字,小数点,且小数点后最多两位
  770. const regex = /^\d+(\.\d{1,2})?$/;
  771. // 如果输入的值不匹配正则表达式,则将其设置为上一个匹配的值
  772. if (!regex.test(this.paymentForm.money)) {
  773. // this.paymentForm.money = this.paymentForm.money.replace(/[^0-9.-]+/g, '');
  774. return this.$toast('只能输入正数数字,小数点,且小数点后最多两位')
  775. }
  776. if (currentMoney > noPayment || !currentMoney) {
  777. this.paymentLoading = true
  778. setTimeout(() => {
  779. this.paymentForm.money = noPayment
  780. this.getPayOrderInfo('getPay', this.paymentForm.money, this.paymentForm.mode)
  781. }, 500)
  782. return this.$toast(`0<付款金额≤${noPayment}`)
  783. }
  784. this.getPayOrderInfo('getPay', this.paymentForm.money, this.paymentForm.mode)
  785. }, 500),
  786. // dom转图片
  787. async convertToImage() {
  788. try {
  789. const canvas = await html2canvas(this.$refs.screenshotRef);
  790. this.imageUrl = canvas.toDataURL('image/png');
  791. } catch (error) {
  792. console.error('转换出错:', error);
  793. }
  794. },
  795. async onSavePaymentCode() {
  796. if (this.paymentLoading) return
  797. await this.convertToImage()
  798. await copyImage(this.imageUrl)
  799. this.$toast('付款码复制成功')
  800. this.paymentCodeShow = false
  801. }
  802. },
  803. data() {
  804. return {
  805. paymentCodeShow: false,
  806. btnloading: false,
  807. pa_dis: false,
  808. performanceDis: false,
  809. permissionActivationShow: false,
  810. performanceShow: false,
  811. iShow: false,
  812. backShow: false,
  813. pShow: false,
  814. sShow: false,
  815. tShow: false,
  816. correctionShow: false,
  817. bigCorrection: false,
  818. redCorrection: 4,
  819. isDisable: false,
  820. invoice: {
  821. type: ''
  822. },
  823. invoType: [
  824. { v: '1', n: '普通发票(纸质发票)' },
  825. { v: '2', n: '普通发票(电子发票)' },
  826. { v: '3', n: '专用发票(纸质发票)' }
  827. ],
  828. contract: {
  829. contractFileUrl: '',
  830. contract_archive_num: '',
  831. contract_archive_time: ''
  832. },
  833. funds: {
  834. sum: '',
  835. shCode: ''
  836. },
  837. permissionActivation: {
  838. phone: '',
  839. startTime: '',
  840. orderCode: ''
  841. },
  842. saleTable: [
  843. {
  844. title: '销售人员',
  845. slot: 'name',
  846. width: 150
  847. },
  848. {
  849. title: '业绩归属部门',
  850. slot: 'saler_dept',
  851. width: 200
  852. },
  853. {
  854. title: '销售业绩(元)',
  855. slot: 'money',
  856. width: 200
  857. },
  858. {
  859. title: '销售渠道',
  860. slot: 'channel',
  861. width: 200
  862. }
  863. ],
  864. ajaxinitSalelist: [],
  865. reasonList: [],
  866. saleTableData: [],
  867. performanceFrom: {
  868. changeReason: "",
  869. saleMoney: ""
  870. },
  871. models: {
  872. refundMoney: '',
  873. refundReason: '',
  874. refundType: '',
  875. correctionType: '',
  876. correctionReason: '',
  877. bigPayMoney: '',
  878. subMoney: '',
  879. supplyMoney: '',
  880. orderMoney: '',
  881. payMoney: '',
  882. commission: '',
  883. proceduresMoney: '',
  884. redType: ""
  885. },
  886. backed: {
  887. return_status: ''
  888. },
  889. returned: {
  890. returnTime: '',
  891. returnRemark: '',
  892. returnCode: '',
  893. returnInvoiceStatus: '',
  894. returnMoney: '',
  895. returnType: '',
  896. returnVoucherUrl: ''
  897. },
  898. backSats: [
  899. // {v: '0', n: '未回款'},
  900. { v: '1', n: '全额回款' },
  901. { v: '2', n: '部分回款' }
  902. ],
  903. backPayType: [
  904. { v: '1', n: '微信' },
  905. { v: '2', n: '支付宝' },
  906. { v: '3', n: '对公转账' }
  907. ],
  908. backInvoStas: [
  909. { v: '0', n: '未申请' },
  910. { v: '1', n: '已申请' },
  911. { v: '2', n: '已开具' }
  912. ],
  913. refundType: [
  914. { v: '个人垫付退款', n: '个人垫付退款' },
  915. { v: '产品购买错误', n: '产品购买错误' },
  916. { v: '客户不满意', n: '客户不满意' },
  917. { v: '活动免单', n: '活动免单' },
  918. { v: '测试', n: '测试' },
  919. { v: '其他', n: '其他' }
  920. ],
  921. correctionType: [
  922. { v: '录入错误', n: '录入错误' },
  923. { v: '客户不再支付', n: '客户不再支付' },
  924. { v: '其他', n: '其他' }
  925. ],
  926. backRuleValidate: {
  927. return_status: [
  928. { required: true, message: '请选择回款状态', trigger: 'change' }
  929. ]
  930. },
  931. backDetailValidate: {
  932. returnTime: [
  933. { required: true, message: '请选择回款时间', trigger: 'change' }
  934. ],
  935. returnMoney: [
  936. { required: true, message: '请输入回款金额', trigger: 'change' }
  937. ],
  938. returnType: [
  939. { required: true, message: '请选择支付方式', trigger: 'change' }
  940. ],
  941. returnCode: [
  942. { required: true, message: '请输入支付单号', trigger: 'change' }
  943. ],
  944. returnInvoiceStatus: [
  945. { required: true, message: '请选择发票状态', trigger: 'change' }
  946. ],
  947. returnVoucherUrl: [
  948. { required: true, message: '请上传凭证', trigger: 'change' }
  949. ]
  950. },
  951. refundRuleValidate: {
  952. refundMoney: [
  953. { required: true, message: '退款金额不能为空', trigger: 'change' }
  954. ],
  955. refundType: [
  956. { required: true, message: '退款原因不能为空', trigger: 'change' }
  957. ]
  958. },
  959. paymentForm: {
  960. mode: '1',
  961. account: '',
  962. product: '',
  963. imgCode: '',
  964. aliSrc:'',
  965. expire: 0,
  966. noPayment: 0
  967. },
  968. paymentLoading: true,
  969. displayMap: {},
  970. imageUrl: null // 转换后的图片URL
  971. }
  972. },
  973. computed: {
  974. ...mapGetters(['channelListGetters', 'channelMapGetters']),
  975. signingSubject() {
  976. return this.orderDetail.signing_subject === 'h01' ? '北京拓普丰联信息科技股份有限公司' : '北京剑鱼信息技术有限公司'
  977. },
  978. saveCodeDisabled() {
  979. return !(!this.paymentLoading && this.paymentForm.money && this.paymentForm.imgCode)
  980. }
  981. }
  982. }
  983. </script>
  984. <style lang="scss" scoped>
  985. .correctionLabel {
  986. font-size: 16px;
  987. font-weight: bold;
  988. color: red;
  989. margin-bottom: 10px;
  990. }
  991. .payment-code-model{
  992. top: 50px;
  993. .ivu-modal-body{
  994. line-height: normal!important;
  995. padding: 16px;
  996. max-height: 620px!important;
  997. }
  998. .ivu-form-item{
  999. margin-bottom: 8px;
  1000. }
  1001. .ivu-modal-footer{
  1002. border-top: 0;
  1003. padding: 0!important;
  1004. }
  1005. .ali-iframe{
  1006. width: 280px;
  1007. height: 280px;
  1008. padding: 14px 0 0 14px;
  1009. border: 0;
  1010. }
  1011. }
  1012. .guide-tip{
  1013. padding: 12px;
  1014. }
  1015. .table-order1{
  1016. .ivu-form-item-content tr td:nth-child(3) .ivu-input {
  1017. height: 36px!important;
  1018. border-radius: 6px!important;
  1019. }
  1020. }
  1021. .screenshot-container{
  1022. width: 100%;
  1023. max-width: 380px;
  1024. padding: 24px 28px;
  1025. margin: 0 auto;
  1026. height: auto;
  1027. background: linear-gradient(180deg, #2ABED1 0%, #87DFEA 100%);
  1028. //transform: scale(0.9);
  1029. .screenshot-logo{
  1030. display: block;
  1031. width: 130px;
  1032. height: 34px;
  1033. margin: 0 auto 16px;
  1034. }
  1035. .screenshot-content{
  1036. padding: 20px 0;
  1037. background: #fff;
  1038. border-radius: 20px;
  1039. }
  1040. .screenshot-info{
  1041. margin: 0 18px;
  1042. padding: 8px 16px;
  1043. background: #F5F6F7;
  1044. border-radius: 12px;
  1045. text-align: center;
  1046. color: #171826;
  1047. font-size: 16px;
  1048. p{
  1049. line-height: 24px;
  1050. }
  1051. }
  1052. .screenshot-money{
  1053. display: flex;
  1054. align-items: center;
  1055. justify-content: center;
  1056. padding-top: 16px;
  1057. font-size: 15px;
  1058. color: #171826;
  1059. .num{
  1060. margin-left: 8px;
  1061. font-size: 24px;
  1062. color: #FB483D;
  1063. }
  1064. }
  1065. .screenshot-code{
  1066. width: 200px;
  1067. height: 200px;
  1068. margin: 0 auto;
  1069. img{
  1070. width: 100%;
  1071. height: 100%;
  1072. object-fit: cover;
  1073. }
  1074. }
  1075. .screenshot-tip{
  1076. font-size: 16px;
  1077. line-height: 24px;
  1078. color: #171826;
  1079. text-align: center;
  1080. }
  1081. .screenshot-date{
  1082. margin-top: 2px;
  1083. font-size: 14px;
  1084. line-height: 20px;
  1085. color: #5F5E64;
  1086. text-align: center;
  1087. }
  1088. }
  1089. </style>