affirm.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. <template>
  2. <view class="app-content">
  3. <view class="affirm-page">
  4. <view class="affirm-view overscroll">
  5. <form>
  6. <view class="module-com">
  7. <view class="commodity-view">
  8. <view class="commodity-list">
  9. <template v-if="!$util.isEmpty(selectList)">
  10. <view class="commodity-item" v-for="(item, index) in selectList" :key="index">
  11. <!-- #ifdef APP-PLUS -->
  12. <image class="item-icon" :src="item.cover" />
  13. <!-- #endif -->
  14. <!-- #ifdef MP-WEIXIN -->
  15. <image class="item-icon" :src="item.cover" />
  16. <!-- #endif -->
  17. <view class="item-info">
  18. <view class="info-line">
  19. <text class="item-name">
  20. {{ item.name||'' }}
  21. <text v-if="item.variety && item.variety ==1" class="show-color"></text>
  22. </text>
  23. <text class="item-price">
  24. <text class="unit">¥</text>
  25. <text class="price">{{ parseFloat(item.userPrice)||0 }}</text>
  26. </text>
  27. </view>
  28. <view style="text-align:right;position: relative;">
  29. <text style="position: absolute;right:300upx;top:2upx;font-size:28upx;color:green;font-weight:bold;" v-if="item.bigCount > 0">¥{{ parseFloat((Number(item.bigCount)*Number(item.userPrice)).toFixed(2)) }}</text>
  30. <text style="position: absolute;right:300upx;top:2upx;font-size:28upx;color:green;font-weight:bold;" v-else>¥{{ parseFloat((Number(item.smallCount)*Number(item.userPrice)).toFixed(2)) }}</text>
  31. <view class="open-bx" >
  32. <i class="iconfont iconjian" @click="reduceItemFn(item)" v-if="item.bigCount > 0 || item.smallCount > 0"></i>
  33. <text class="num" @click="showAddModelFn(item)">
  34. <text v-if="item.bigCount > 0" style="font-size:24upx;font-weight:bold;color:#3385ff;">{{ item.bigCount }}</text>
  35. <text v-if="item.smallCount > 0" style="font-size:24upx;">{{ item.smallCount }}</text>
  36. </text>
  37. <i class="iconfont iconzeng" @click="addItemFn(item)"></i>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. </view>
  44. <view class="summary-bar">
  45. <view class="operate-view" v-if="isScanEnv" @click="removeFromSave(option.customId)"> <text class="iconfont iconshanchu1"></text>清除花材 </view>
  46. <view class="operate-view" v-else @click="gobackEvent" style="font-size:32upx;font-weight:bold;"><text class="iconfont icongouwuche" style="margin-right:5upx;"></text>返回修改</view>
  47. <view class="describe-view">
  48. <text>合计 ¥{{ allPrice }}</text>
  49. </view>
  50. </view>
  51. <view class="summary-bar">
  52. <view class="operate-view" v-if="isScanEnv" @click="pageToItemList()"><text class="iconfont iconzeng"></text>手动添加花材</view>
  53. <view class="operate-view" v-if="isScanEnv == false"><text> </text></view>
  54. <view class="describe-view">
  55. <text>{{ selectList.length }}种</text>
  56. <text v-if="Number(totalItemNum.big)>0">,{{totalItemNum.big?parseFloat(totalItemNum.big):0}}扎</text>
  57. <text v-if="Number(totalItemNum.small)>0">,{{totalItemNum.small?parseFloat(totalItemNum.small):0}}支</text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <modal-module :show="isAddModel" @cancel="addItemModelHidden" @click="confirmAddItemModel" :title="customData.name" color="#333" :size="32" padding="30rpx 30rpx" >
  63. <template slot="customContent">
  64. <view class="select-cmd_bx" v-if="customData">
  65. <view class="kc">
  66. <text class="unit_price">库存 {{ parseFloat(customData.stock) }}</text>
  67. <text class="unit_price"> ¥{{ parseFloat(customData.price) }}</text>
  68. </view>
  69. <view class="num_bx">
  70. <input style="width: 430upx" v-model="customData.userPrice" @focus="customData.userPrice = null" type="number" placeholder="单价" :disabled="false" />
  71. <text style="font-size:35upx;font-weight:bold;color:#666666;">元</text>
  72. </view>
  73. <view class="num_bx">
  74. <!-- #ifdef APP-PLUS -->
  75. <input style="width: 430upx" v-model="customData.bigCount" v-if="globalUnitType == 0" type="number" />
  76. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 0">扎</text>
  77. <input style="width: 430upx" v-model="customData.smallCount" v-if="globalUnitType == 1" type="number" />
  78. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 1">支</text>
  79. <!-- #endif -->
  80. <!-- #ifdef MP-WEIXIN -->
  81. <input style="width: 430upx" v-model="customData.bigCount" v-if="globalUnitType == 0" :focus="isAddInputFocus" type="number" />
  82. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 0">扎</text>
  83. <input style="width: 430upx" v-model="customData.smallCount" v-if="globalUnitType == 1" :focus="isAddInputFocus" type="number" />
  84. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 1">支</text>
  85. <!-- #endif -->
  86. <image @click="switchGlobalUnitType" :src="`${constant.imgUrl}/icon/switch/switch128.png`"
  87. style="width:86upx;height:86upx;position:relative;top:-60upx;right:0upx;" mode="widthFix"></image>
  88. </view>
  89. </view>
  90. </template>
  91. </modal-module>
  92. <view class="module-com input-line-wrap">
  93. <view>
  94. <tui-list-cell class="line-cell" :hover="false" :arrow="false">
  95. <view class="tui-title">客户</view>
  96. <view class="tui-input">
  97. {{ form.customName }}
  98. </view>
  99. </tui-list-cell>
  100. <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-if="Number(customInfo.balance)>0">
  101. <view class="tui-title">余额</view>
  102. <view class="tui-input" style="color:#3385FF;font-weight:bold;">
  103. ¥{{ parseFloat(customInfo.balance) }}
  104. </view>
  105. </tui-list-cell>
  106. <tui-list-cell class="line-cell" :hover="false" :arrow="false">
  107. <view class="tui-title">结账方式</view>
  108. <view class="payment-buttons">
  109. <view class="button-row">
  110. <button @click="form.hasPay = 4" class="admin-button-com middle" :class="form.hasPay == 4 ? 'blue' : 'default'">余额</button>
  111. <button @click="form.hasPay = 0" class="admin-button-com middle" :class="form.hasPay == 0 ? 'blue' : 'default'">扫码</button>
  112. </view>
  113. <view class="button-row">
  114. <button @tap="form.hasPay = 1" class="admin-button-com middle" :class="form.hasPay == 1 ? 'blue' : 'default'">线下</button>
  115. <button @click="form.hasPay = 2" class="admin-button-com middle" :class="form.hasPay == 2 ? 'blue' : 'default'">赊账</button>
  116. </view>
  117. </view>
  118. </tui-list-cell>
  119. <tui-list-cell class="line-cell" :hover="false" :arrow="true" v-if="form.hasPay == 1">
  120. <view class="tui-title">线下渠道</view>
  121. <picker mode="selector" :value="payWayindex" :range="payWayList" range-key="name" @change="payWayChange" class="tui-input">
  122. <view class="uni-input" v-if="form.payWay == 0">线下微信</view>
  123. <view class="uni-input" v-else-if="form.payWay == 1">线下支付宝</view>
  124. <view class="uni-input" v-else-if="form.payWay == 4">现金</view>
  125. <view class="uni-input" v-else-if="form.payWay == 5">银行卡</view>
  126. <view class="uni-input" v-else style="color:#CCCCCC;">请选择</view>
  127. </picker>
  128. </tui-list-cell>
  129. <tui-list-cell class="line-cell" :hover="false" :arrow="false">
  130. <view class="tui-title">打印小票</view>
  131. <button @tap="form.needPrint = 2" class="admin-button-com middle" style="width:140upx;" :class="form.needPrint == 2? 'blue' : 'default'">不打印</button>
  132. <button @click="form.needPrint = 1" class="admin-button-com middle" style="width:140upx;" :class="form.needPrint == 1 ? 'blue' : 'default'">打印</button>
  133. </tui-list-cell>
  134. <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
  135. <view class="tui-title">
  136. <text>合计金额</text>
  137. </view>
  138. <text style="color: #3385FF;width:170upx;">¥{{parseFloat(finalPrice)}}</text>
  139. <button @tap="showDiscount()" class="admin-button-com middle default" style="width:140upx;">打折</button>
  140. <text v-if="discountValue>0 && discountValue<1">{{ Number(discountValue)*10 }}折</text>
  141. </tui-list-cell>
  142. <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
  143. <view v-if="form.hasPay == 2" class="tui-title">应收金额</view>
  144. <view v-else-if="form.hasPay == 3" class="tui-title">余额扣减</view>
  145. <view v-else class="tui-title">{{form.forward==0?'实收':'实付'}}金额</view>
  146. <input style="border:1upx solid #eee;color:#3385FF;width:150upx;height:70upx;" type="digit" @focus="modifyPrice=''" v-model="modifyPrice" placeholder-class="tui-placeholder"/>
  147. <text v-if="modifyPrice > 0 && modifyPrice > finalPrice" style="font-size:25upx;margin-left:20upx;color:red;">人工包装费 ¥{{parseFloat((modifyPrice-finalPrice).toFixed(2))}}</text>
  148. <text v-if="modifyPrice > 0 && modifyPrice < finalPrice" style="font-size:25upx;margin-left:20upx;color:green;">优惠 ¥{{parseFloat((finalPrice-modifyPrice).toFixed(2))}}</text>
  149. </tui-list-cell>
  150. <tui-list-cell class="line-cell" :hover="false" :arrow="true">
  151. <view class="tui-title">送货日期</view>
  152. <picker mode="date" :value="form.sendTimeWant" @change="bindDateChange" style="width:400upx;">
  153. <view class="uni-input" v-if="form.sendTimeWant==''" style="color:#CCCCCC;">请选择</view>
  154. <view class="uni-input">{{form.sendTimeWant}}</view>
  155. </picker>
  156. </tui-list-cell>
  157. <tui-list-cell class="line-cell" :arrow="true">
  158. <div class="tui-title">开单人</div>
  159. <picker mode="selector" :value="form.getStaffId" :range="staffList" range-key="name" @change="kdChange" class="tui-input" >
  160. <input v-model="form.getStaffId" name="getStaffId" type="text" hidden />
  161. <div style="padding:6upx 0 6upx 0;" v-if="form.getStaffName!=''">{{form.getStaffName}}</div>
  162. <div v-else style="padding:6upx 0 6upx 0;color:#CCCCCC;">请选择</div>
  163. </picker>
  164. </tui-list-cell>
  165. <tui-list-cell class="line-cell" :hover="false" :arrow="true">
  166. <view class="tui-title">账单日期</view>
  167. <view class="uni-input" v-if="form.historyDate==''" style="color:#CCCCCC;" @click="bindHistoryDateChange">请选择,默认当天</view>
  168. <view class="uni-input" @click="bindHistoryDateChange">{{form.historyDate}}</view>
  169. </tui-list-cell>
  170. <tui-list-cell class="line-cell" :hover="false" :arrow="false">
  171. <view class="tui-title">备注</view>
  172. <textarea style="height:80upx;z-index:0" v-model="form.remark" placeholder-class="remark-class" placeholder="选填" />
  173. </tui-list-cell>
  174. <tui-list-cell class="line-cell" :hover="false" :arrow="false">
  175. <view class="tui-title">订单类型</view>
  176. <button @tap="form.forward = 0;form.hasPay = 4" class="admin-button-com middle" style="width:170upx;" :class="form.forward == 0? 'blue' : 'default'">收入订单</button>
  177. <button @click="form.forward = 1;form.hasPay = 1" class="admin-button-com middle" style="width:170upx;" :class="form.forward == 1 ? 'blue' : 'default'">售后付款</button>
  178. </tui-list-cell>
  179. <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-if="form.forward == 1">
  180. <view class="tui-title">退货方式</view>
  181. <button @tap="form.forwardStock = 0" class="admin-button-com middle" style="width:190upx;" :class="form.forwardStock == 0? 'blue' : 'default'">货退回来</button>
  182. <button @click="form.forwardStock = 1" class="admin-button-com middle" style="width:160upx;" :class="form.forwardStock == 1 ? 'blue' : 'default'">货不退回</button>
  183. </tui-list-cell>
  184. </view>
  185. </view>
  186. </form>
  187. </view>
  188. <view class="under-bar">
  189. <view class="price-view">
  190. <text class="price-title">
  191. <text></text>
  192. </text>
  193. <text class="price-number"><text class="large">{{form.forward==0?'':'-'}}¥{{ modifyPrice }}</text></text>
  194. </view>
  195. <!-- <text style="font-size:30upx;right:100upx;">当前在<text style="font-weight:bold;color:red;margin-left:5upx;font-size:32upx;">{{currentShop.shopName}}</text></text> -->
  196. <button class="admin-button-com blue big" @click="confirmSubmit">提交</button>
  197. </view>
  198. <view v-if="isScanEnv" @click="changeGet" style="width:125upx;height:125upx;display:flex;justify-content:center;align-items:center;font-size:60upx;
  199. background:#3385ff;color:white;z-index:9999;position:fixed;bottom:230upx;right:40upx;border-radius:60upx;">{{calc=='add'?'+':'-'}}</view>
  200. <uni-popup ref="diffPriceRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
  201. <view style="display:flex;padding:40upx 20upx 20upx 20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
  202. <block v-if="!$util.isEmpty(diffPriceList)">
  203. <view v-for="(item, index) in diffPriceList" :key="index"
  204. style="font-size:32upx;color:red;font-weight:bold;margin-top:10upx;">
  205. <text>{{item.name}}</text>
  206. <text style="margin-left:25upx;">系统售价 ¥{{item.price?parseFloat(item.price):0}}</text>
  207. <text style="margin-left:25upx;">您开价 ¥{{item.kdPrice?parseFloat(item.kdPrice):0}}</text>
  208. </view>
  209. </block>
  210. <view style="margin-top:20upx;font-size:28upx;font-weight:bold;">
  211. <view>以上花材,开单价和系统售价不一样,确认提交吗?</view>
  212. </view>
  213. <view style="text-align:center;margin-top:30upx;width:100%;">
  214. <button class="admin-button-com big default" @click="returnCheck()">返回修改</button>
  215. <button style="margin-left:20upx;" @click="diffPriceConfirm()" class="admin-button-com big blue">确认提交</button>
  216. </view>
  217. </view>
  218. </uni-popup>
  219. <uni-popup ref="discountRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
  220. <view style="display:flex;padding:20upx;min-height:25vh;justify-content: space-between;align-items:center;flex-wrap:wrap;">
  221. <text v-for="(item, index) in discountList" :key="index" @click="setDiscount(item.value)"
  222. style="margin-left:25upx;border:1upx solid #999999;width:100upx;height:100upx;border-radius:20upx;justify-content:center;align-items:center;display:flex;">
  223. {{item.name}}
  224. </text>
  225. </view>
  226. </uni-popup>
  227. <mx-date-picker :show="showPicker" format="yyyy-mm-dd" type="date" :value="defaultPickerDate" :show-tips="true" @confirm="confirmPicker" @cancel="showPicker = false" />
  228. </view>
  229. </view>
  230. </template>
  231. <script>
  232. import TuiListCell from "@/components/plugin/list-cell";
  233. import AppAvatarModule from "@/components/module/app-avatar";
  234. import SimpleAddress from "@/components/plugin/simple-address";
  235. import AppAreaSel from "@/components/app-area-sel";
  236. import productMins from "@/mixins/product";
  237. import appFormRadioBtn from "@/components/app-formRadio-btn";
  238. import appAddressGroup from "@/components/app-address-group";
  239. import appSendTime from "@/components/app-send-time";
  240. import appFormSend from "@/components/app-form-send";
  241. const formUtil = require("@/utils/formValidation.js");
  242. import { createOrder, updateOrder } from "@/api/order/index";
  243. import { getAllStaff } from "@/api/shop-admin"
  244. import { mapActions, mapGetters } from "vuex";
  245. import { getCustomInfo} from "@/api/custom"
  246. import ModalModule from "@/components/plugin/modal"
  247. import MxDatePicker from '@/components/mx-datepicker/mx-datepicker.vue';
  248. export default {
  249. name: "affirm",
  250. components: {
  251. TuiListCell,
  252. AppAvatarModule,
  253. SimpleAddress,
  254. AppAreaSel,
  255. appFormRadioBtn,
  256. appAddressGroup,
  257. appSendTime,
  258. appFormSend,
  259. ModalModule,
  260. MxDatePicker
  261. },
  262. mixins: [productMins],
  263. data () {
  264. return {
  265. defaultPickerDate:'',
  266. showPicker: false,
  267. discountList:[{name:'1折',value:0.1},{name:'2折',value:0.2},{name:'3折',value:0.3},{name:'4折',value:0.4},{name:'5折',value:0.5},{name:'6折',value:0.6},{name:'7折',value:0.7},{name:'8折',value:0.8},{name:'9折',value:0.9},{name:'不打折',value:1}],
  268. discountValue:0,
  269. autoLoad: false,
  270. staffList:[],
  271. payWayList:[{name:"线下微信",id:0},{name:"线下支付宝",id:1},{name:"现金",id:4},{name:"银行卡",id:5}],
  272. payWayindex:0,
  273. form: {
  274. shopId: "",
  275. shopName: "",
  276. receiveProvince: "",
  277. receiveCity: "",
  278. receiveFloor: "",
  279. receiveAddress: "",
  280. receiveLong: "",
  281. receiveLat: "",
  282. sendType: 1,
  283. sendSide: "2",
  284. sendDate: "",
  285. sendTimeWant: "",
  286. historyDate:"",
  287. sendCost: "",
  288. customId: "",
  289. packCost:"",
  290. product: "",
  291. remark:"",
  292. payWay:0,
  293. needPrint:2,
  294. hasPay:0,
  295. getStaffName:'',
  296. dealPrice:0,
  297. forward:0,
  298. forwardStock:0
  299. },
  300. showCustomer: false,
  301. customInfo:{discount:1,balance:0},
  302. customData: { bigCount: 0, smallCount: 0, userPrice: 0 },
  303. isAddModel:false,
  304. checkStock:true,
  305. xjData:{},
  306. xjDataInfo:{},
  307. modifyPrice:'',
  308. isScanEnv:false,
  309. calc:'add',
  310. diffPriceList:[],
  311. currentShop:{default:0}
  312. };
  313. },
  314. onLoad (option) {
  315. this.kdType = option.kdType
  316. let that = this
  317. this.initMerchantInfo().then((data) => {
  318. uni.setNavigationBarTitle({ title: data.name })
  319. that.currentShop = data.shopInfo
  320. })
  321. if(Number(option.customId) > 0){
  322. this.form.customId = option.customId
  323. let that = this
  324. getCustomInfo({ id: option.customId }).then(res => {
  325. that.form.customName = res.data.custom.name
  326. that.customInfo = res.data.custom
  327. that.$forceUpdate()
  328. })
  329. //用于混入product的已选中花材!!!!!
  330. this.selectJobId = option.customId
  331. this.selectJobType = 'bill'
  332. }
  333. //默认欠款是首选项
  334. this.form.hasPay = 4
  335. // 初始化支付方式索引
  336. this.payWayindex = 0
  337. // #ifdef APP-PLUS
  338. if(this.$util.isScanEnv()){
  339. this.isScanEnv = true
  340. }
  341. //#endif
  342. },
  343. onShow(){
  344. if(!this.$util.isEmpty(uni.getStorageSync("newClient"))){
  345. this.showCustomer = true;
  346. }
  347. //获取所有在职员工
  348. getAllStaff().then(res=>{
  349. if(res.code == 1){
  350. this.staffList = res.data.list
  351. }
  352. })
  353. },
  354. onUnload(){
  355. uni.removeStorageSync('newClient')
  356. uni.$off('listenGetScanCode')
  357. },
  358. computed: {
  359. ...mapGetters(["getMerchantInfo","getMyShopInfo", "getLoginInfo"]),
  360. totalItemNum(){
  361. let big = 0
  362. let small = 0
  363. if(!this.$util.isEmpty(this.selectList)){
  364. for(const ele of this.selectList){
  365. if(Number(ele.bigCount)>0){
  366. big = Number(big)+Number(ele.bigCount)
  367. big = big.toFixed(0)
  368. }
  369. if(Number(ele.smallCount)){
  370. small = Number(small) + Number(ele.smallCount)
  371. small = small.toFixed(0)
  372. }
  373. }
  374. }
  375. return {big:big,small:small}
  376. },
  377. finalPrice(){
  378. let totalPrice = this.allPrice.toFixed(2)
  379. let finalPrice = Number(totalPrice)
  380. finalPrice = Number(finalPrice).toFixed(2)
  381. let currentPrice = parseFloat(finalPrice)
  382. this.modifyPrice = currentPrice
  383. return currentPrice
  384. },
  385. labourCost(){
  386. let cost = 0
  387. if(Number(this.modifyPrice)>Number(this.finalPrice)){
  388. cost = Number(this.modifyPrice) - Number(this.finalPrice)
  389. cost = Number(cost).toFixed(2)
  390. }
  391. return cost
  392. }
  393. },
  394. methods: {
  395. ...mapActions(["initMerchantInfo"]),
  396. bindHistoryDateChange(){
  397. this.showPicker = true
  398. },
  399. confirmPicker(e) {
  400. this.form.historyDate = e.value
  401. this.showPicker = false
  402. },
  403. bindDateChange(e){
  404. let date = e.detail.value
  405. this.form.sendTimeWant = date
  406. },
  407. showDiscount(){
  408. this.$refs.discountRef.open('center')
  409. },
  410. setDiscount(num){
  411. this.discountValue = Number(num)
  412. let price = Number(this.finalPrice)*Number(num)
  413. price = parseFloat(price.toFixed(2))
  414. this.modifyPrice = price
  415. this.$refs.discountRef.close()
  416. },
  417. beginScan(){
  418. console.log('beginScan')
  419. let that = this
  420. uni.scanCode({
  421. scanType: ['barCode'],
  422. success: function (res) {
  423. that.takeItem(res.result)
  424. }
  425. })
  426. },
  427. changeGet(){
  428. this.calc = this.calc == 'add' ? 'sub' : 'add'
  429. },
  430. reduceItemFn(item) {
  431. if(item && item.variety == 1 && this.selectJobType == 'bill'){
  432. this.$msg('多颜色花材,请返回修改')
  433. return false
  434. }
  435. this.kdType = 'HIT';
  436. this.replaceItemFn(item,0,'sub')
  437. },
  438. addItemFn (item) {
  439. if(item && item.variety == 1 && this.selectJobType == 'bill'){
  440. this.$msg('多颜色花材,请返回修改')
  441. return false
  442. }
  443. this.kdType = 'HIT';
  444. this.replaceItemFn(item,0,'add')
  445. },
  446. init () {
  447. },
  448. kdChange(e){
  449. let index = e.detail.value
  450. if(!this.$util.isEmpty(this.staffList)){
  451. if(this.staffList[index]){
  452. this.form.getStaffName = this.staffList[index].name
  453. this.form.getStaffId = this.staffList[index].id
  454. }
  455. }
  456. },
  457. payWayChange(e){
  458. let index = e.detail.value
  459. this.payWayindex = index
  460. this.form.payWay = this.payWayList[index].id
  461. },
  462. // 根据支付方式ID更新索引
  463. updatePayWayIndex(){
  464. const index = this.payWayList.findIndex(item => item.id === this.form.payWay)
  465. this.payWayindex = index >= 0 ? index : 0
  466. },
  467. setPayWay(payWay){
  468. this.form.payWay = payWay
  469. this.updatePayWayIndex()
  470. },
  471. diffPriceConfirm(){
  472. this.form.dealPrice = 1
  473. this.formSubmit()
  474. },
  475. confirmSubmit () {
  476. let self = this;
  477. let rules = [
  478. {
  479. name: "customId",
  480. rule: ["required"],
  481. msg: ["请选择客户"],
  482. },
  483. ];
  484. let hasError = formUtil.validation(this.form, rules);
  485. if (hasError) {
  486. this.$msg(hasError);
  487. return false;
  488. }
  489. let name = '确认提交'
  490. if(this.form.hasPay == 0){
  491. name = '确认扫码付?'
  492. }else if(this.form.hasPay == 1){
  493. name = '确认线下付款?'
  494. if(this.form.forward == 1){
  495. name = '确认开付款售后单?'
  496. }
  497. }else if(this.form.hasPay == 2){
  498. name = '确认赊账?'
  499. }else if(this.form.hasPay == 4){
  500. name = '确认余额支付?'
  501. }else{
  502. name = '确认提交'
  503. }
  504. self.$util.confirmModal({content:name},() => {
  505. self.formSubmit()
  506. })
  507. },
  508. async formSubmit () {
  509. let that = this
  510. let formData = this.form;
  511. const product = this.selectList.map((ele) => {
  512. let unitType = Number(ele.bigCount)>0 ? 0 : 1
  513. let num = Number(ele.bigCount)>0 ? Number(ele.bigCount) : Number(ele.smallCount)
  514. let unitPrice = ele.userPrice ? ele.userPrice : 0
  515. return {productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount, classId: ele.classId,
  516. itemId: ele.itemId, unitPrice:unitPrice,remark:ele.remark,property:ele.property,unitType:unitType,num:num}
  517. });
  518. formData.product = JSON.stringify(product);
  519. if (!this.getMerchantInfo) {
  520. await this.initMerchantInfo();
  521. }
  522. formData.shopId = this.getMerchantInfo.id;
  523. if(Number(this.modifyPrice) <= 0){
  524. this.$msg('收款金额必须大于0');
  525. return false
  526. }
  527. let params = {...formData,modifyPrice: this.modifyPrice,labourCost:this.labourCost};
  528. //多颜色
  529. let xj = uni.getStorageSync("xj"+this.option.customId)
  530. //orderType 开单类型,1商品开单 2花材开单
  531. params = {...params,xj:JSON.stringify(xj),orderType:2}
  532. uni.showLoading({mask:true})
  533. createOrder(params).then((res) => {
  534. uni.hideLoading()
  535. if(res.code == 1){
  536. if(res.data.respondType && res.data.respondType == 'priceError'){
  537. that.diffPriceList = res.data.diff
  538. that.$refs.diffPriceRef.open('bottom')
  539. return
  540. }
  541. this.removeFromSaveDirect()
  542. if(res.data && res.data.id){
  543. const {data: { id, orderSn,actPrice }} = res;
  544. if(this.form.hasPay == 0){
  545. this.$util.pageTo({ url: '/admin/billing/toPay',type:2,query: {orderId:id,orderSn:orderSn,actPrice:actPrice}})
  546. }else{
  547. if(this.form.forward == 1){
  548. this.$util.pageTo({ url: '/admin/billing/remind?orderId='+id,type:2})
  549. }else{
  550. this.$util.pageTo({ url: '/admin/billing/result?orderId='+id,type:2})
  551. }
  552. }
  553. }else{
  554. this.$msg('提交失败')
  555. }
  556. }
  557. })
  558. },
  559. returnCheck(){
  560. this.$refs.diffPriceRef.close()
  561. },
  562. gobackEvent () {
  563. let customId = this.option.customId ? this.option.customId : 0
  564. let customName = this.option.customName ? this.option.customName : ''
  565. this.$util.pageTo({url: '/admin/billing/index2?customId='+customId+'&customName='+customName,type:2})
  566. },
  567. pageToItemList() {
  568. this.$util.pageTo({url: '/admin/billing/index2?customId='+this.option.customId,type:2})
  569. }
  570. }
  571. };
  572. </script>
  573. <style lang="scss" scoped>
  574. .admin-button-com {
  575. margin-right: 30upx;
  576. }
  577. .special-title {
  578. color: #ff6b35 !important;
  579. font-weight: bold !important;
  580. }
  581. .payment-buttons {
  582. display: flex;
  583. flex-direction: column;
  584. gap: 20upx;
  585. width: 100%;
  586. .button-row {
  587. display: flex;
  588. justify-content: flex-start;
  589. gap: 30upx;
  590. .admin-button-com {
  591. flex: 0 0 140upx;
  592. margin-right: 0;
  593. }
  594. }
  595. }
  596. .affirm-page {
  597. position: relative;
  598. height: 100%;
  599. display: flex;
  600. flex-direction: column;
  601. .affirm-view {
  602. flex: 1;
  603. margin-bottom:90upx;
  604. padding: 20upx;
  605. background-color: #f0f2f6;
  606. .commodity-view {
  607. display: flex;
  608. flex-direction: column;
  609. .commodity-list {
  610. padding: 20upx;
  611. .commodity-item {
  612. display: flex;
  613. margin-bottom: 20upx;
  614. .item-icon {
  615. flex-shrink: 0;
  616. width: 140upx;
  617. height: 140upx;
  618. }
  619. .item-info {
  620. display: flex;
  621. flex-direction: column;
  622. justify-content: center;
  623. flex: 1;
  624. margin-left: 20upx;
  625. .info-line {
  626. margin-bottom: 20upx;
  627. display: flex;
  628. justify-content: space-between;
  629. align-items: flex-end;
  630. .item-name {
  631. color: #333333;
  632. font-size: 28upx;
  633. font-weight:bold;
  634. .show-color{
  635. display:inline-block;
  636. width:25upx;
  637. height:25upx;
  638. background-color:rgb(9, 199, 9);
  639. border-radius:15upx;
  640. border:none;
  641. margin-left:16upx;
  642. }
  643. }
  644. .item-price {
  645. color: #333;
  646. font-size: 22upx;
  647. .price {
  648. font-size: 32upx;
  649. font-weight: bold;
  650. }
  651. }
  652. .item-type {
  653. color: #999;
  654. font-size: 24upx;
  655. }
  656. .item-count {
  657. color: #666;
  658. font-size: 24upx;
  659. }
  660. }
  661. & .open-bx {
  662. align-items: center;
  663. & .iconfont {
  664. color: #3385ff;
  665. font-size: 50upx;
  666. }
  667. .position{
  668. display: block;
  669. width: 70upx;
  670. text-align: center;
  671. }
  672. .iconcachu {
  673. margin: 0 6upx 0 20upx;
  674. color: #ccc;
  675. &.edit {
  676. color: #3385ff;
  677. }
  678. }
  679. & > .num {
  680. display: inline-block;
  681. width: 120upx;
  682. height:45upx;
  683. text-align:center;
  684. margin: 0 8upx;
  685. color: #868686;
  686. border-radius: 22upx;
  687. background-color: #f5f5f5;
  688. padding: 3upx 0;
  689. font-size: 25upx;
  690. }
  691. .change-input {
  692. width: 164upx;
  693. height: 60upx;
  694. line-height: 60upx;
  695. text-align: center;
  696. background: #ffffff;
  697. border: 1upx solid #dddddd;
  698. border-radius: 4upx;
  699. font-size: 25upx;
  700. }
  701. .btn-box{
  702. width: 100upx;
  703. height: 60upx;
  704. line-height: 60upx;
  705. color: #ffffff;
  706. background: #3385ff;
  707. text-align: center;
  708. border-radius: 10upx;
  709. }
  710. }
  711. }
  712. }
  713. }
  714. .summary-bar {
  715. padding: 0 20upx;
  716. height: 90upx;
  717. display: flex;
  718. align-items: center;
  719. justify-content: space-between;
  720. border-top: 1upx solid #eeeeee;
  721. .operate-view {
  722. display: flex;
  723. align-items: center;
  724. color: #3385ff;
  725. font-size: 26upx;
  726. .iconfont {
  727. margin-right: 20upx;
  728. font-size: 40upx;
  729. }
  730. }
  731. .describe-view {
  732. display: flex;
  733. align-items: center;
  734. color: #333;
  735. font-size: 28upx;
  736. font-weight:bold;
  737. .price {
  738. margin-left:8upx;
  739. color:red;
  740. }
  741. }
  742. }
  743. }
  744. .module-com {
  745. background-color: #fff;
  746. margin-bottom: 20upx;
  747. border-radius: 10upx;
  748. overflow: hidden;
  749. .tab-box{
  750. padding: 10upx 30upx 30upx;
  751. .tab{
  752. width: 49%;
  753. height: 70upx;
  754. color: #a2a2a2;
  755. border: 1upx solid #dcdcdc;
  756. border-radius: 10upx;
  757. font-size: 28upx;
  758. font-weight: 700;
  759. &.active{
  760. color: #ff4d4d;
  761. border: 1upx solid #ff4d4d;
  762. }
  763. }
  764. }
  765. .member-wrap {
  766. .member-det {
  767. font-size: 24upx;
  768. margin-left: 20upx;
  769. }
  770. }
  771. .remark-wrap {
  772. align-items: flex-start;
  773. .remark {
  774. height: 240upx;
  775. }
  776. }
  777. }
  778. }
  779. .under-bar {
  780. z-index:99999;
  781. display: flex;
  782. justify-content: space-between;
  783. align-items: center;
  784. padding: 0 10upx;
  785. position: fixed;
  786. bottom:0;
  787. @media screen and (max-width: 1100px) {
  788. width: 100%;
  789. }
  790. height: 100upx;
  791. background-color: #fff;
  792. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  793. .price-view {
  794. display: flex;
  795. align-items: center;
  796. font-size: 24upx;
  797. .price-title {
  798. color: #333;
  799. }
  800. .price-number {
  801. margin: 0 8upx;
  802. color: #ff2842;
  803. .large {
  804. font-size:34upx;
  805. font-weight:bold;
  806. }
  807. }
  808. }
  809. .admin-button-com {
  810. width: 200upx;
  811. }
  812. }
  813. .select-cmd_bx {
  814. & .kc {
  815. color: #999999;
  816. font-size: 28upx;
  817. font-weight: 400;
  818. margin-bottom: 40upx;
  819. text-align: center;
  820. margin-top: 30upx;
  821. .unit_price{
  822. padding-right:25upx;
  823. }
  824. }
  825. & .num_bx {
  826. display: flex;
  827. align-items: center;
  828. margin-bottom: 40upx;
  829. & > input {
  830. width: 212upx;
  831. height: 80upx;
  832. border: 1upx solid #dddddd;
  833. border-radius: 4upx;
  834. text-align: center;
  835. margin-right: 24upx;
  836. font-size: 40upx;
  837. }
  838. }
  839. }
  840. }
  841. .class-popup-style{
  842. z-index:99999;
  843. }
  844. .remark-class{
  845. z-index:0
  846. }
  847. .warning-price{
  848. color:red;
  849. }
  850. .normal-price{
  851. color:#c1acac;
  852. }
  853. </style>