collectCloth.vue 88 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983
  1. <template>
  2. <div class="app-container collect-cloth-wrapper">
  3. <!-- 左侧用户信息栏 -->
  4. <div class="left-panel">
  5. <el-card class="user-card">
  6. <div slot="header" class="clearfix">
  7. <span>选择客户</span>
  8. </div>
  9. <!-- 搜索区域 -->
  10. <el-form :model="queryParams" @submit.native.prevent ref="queryForm">
  11. <div class="search-box">
  12. <el-input
  13. v-model="queryParams.phoneNumber"
  14. placeholder="请输入手机号"
  15. clearable
  16. @keyup.enter.native="searchUser">
  17. <el-button slot="append" icon="el-icon-search" @click="searchUser">查询</el-button>
  18. </el-input>
  19. <el-button type="primary" icon="el-icon-full-screen" @click="qrcodeSearchUser">扫码</el-button>
  20. </div>
  21. </el-form>
  22. <!-- 用户信息展示 -->
  23. <el-descriptions
  24. v-if="appUserInfo"
  25. class="user-info"
  26. :column="1"
  27. border>
  28. <el-descriptions-item label="用户名">
  29. {{ appUserInfo.realName }}
  30. </el-descriptions-item>
  31. <el-descriptions-item label="手机号">
  32. {{ appUserInfo.phoneNumber }}
  33. </el-descriptions-item>
  34. <el-descriptions-item label="等级">
  35. {{ appUserInfo.level }}
  36. </el-descriptions-item>
  37. <el-descriptions-item label="现金余额">
  38. <span class="amount">{{ (appUserInfo.rechargeBalance * 100) / 100 }}</span>
  39. </el-descriptions-item>
  40. <el-descriptions-item label="赠送余额">
  41. <span class="amount">{{ (appUserInfo.giveBalance * 100) / 100 }}</span>
  42. </el-descriptions-item>
  43. <el-descriptions-item label="福利金">
  44. <span class="amount">{{ (appUserInfo.welfareBalance * 100) / 100 }}</span>
  45. </el-descriptions-item>
  46. <el-descriptions-item label="地址">
  47. {{ appUserInfo.defaultAddress ? appUserInfo.defaultAddress.address + ' ' + appUserInfo.defaultAddress.addressDetail : '' }}
  48. </el-descriptions-item>
  49. <el-descriptions-item label="预约订单">
  50. <div class="appointment-info">
  51. <template v-if="orderForm.orderNo">
  52. <a class="link-text">{{ orderForm.orderNo }}</a>
  53. <a class="link-text delete" @click="clearAppointment">删除</a>
  54. </template>
  55. <a v-else class="link-text" @click="showAdvanceOrder = true">选择预约订单</a>
  56. </div>
  57. </el-descriptions-item>
  58. </el-descriptions>
  59. </el-card>
  60. </div>
  61. <!-- 右侧衣物操作区 -->
  62. <div class="right-panel">
  63. <div class="cloth-container">
  64. <!-- 操作栏 -->
  65. <div class="operation-bar">
  66. <el-button type="primary" plain icon="el-icon-plus" @click="handleAdd">添加衣物</el-button>
  67. </div>
  68. <!-- 衣物列表 -->
  69. <div class="cloth-list">
  70. <el-table
  71. :data="orderClothItemDTOS"
  72. border
  73. stripe
  74. highlight-current-row
  75. height="100%">
  76. <el-table-column label="序号" type="index" width="60" align="center" fixed="left"/>
  77. <el-table-column label="衣物名称" min-width="180">
  78. <template slot-scope="scope">
  79. <el-button type="text" @click="updateClothItem(scope.$index, 0)">
  80. {{ calculateClothName(scope.$index) }}
  81. </el-button>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="颜色" width="120">
  85. <template slot-scope="scope">
  86. <el-button type="text" @click="updateClothItem(scope.$index, 2)">
  87. {{ scope.row.orderClothColorDTOS.map(c => c.clothColorName).join(',') }}
  88. </el-button>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="衣服品牌" width="120">
  92. <template slot-scope="scope">
  93. <el-button type="text" @click="updateClothItem(scope.$index, 3)">
  94. {{ scope.row.clothBrandName }}
  95. </el-button>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="瑕疵" min-width="120">
  99. <template slot-scope="scope">
  100. <el-button type="text" @click="updateClothItem(scope.$index, 4)">
  101. {{ scope.row.orderClothFlawDTOS.map(f => f.clothFlawName).join(',') }}
  102. </el-button>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="洗涤方式" width="100">
  106. <template slot-scope="scope">
  107. <el-button type="text" @click="changeClothWashMode(scope.$index)">
  108. {{ scope.row.clothWashModeName }}
  109. </el-button>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="特殊处理" width="120">
  113. <template slot-scope="scope">
  114. <el-button
  115. type="text"
  116. class="price-text"
  117. @click="changeClothSpecialPriceEvent(scope.$index)">
  118. ¥{{ calculateClothSpecialPrice(scope.$index) }}
  119. </el-button>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="单价" width="100">
  123. <template slot-scope="scope">
  124. <template v-if="scope.row.isChangePrice == 'Y'">
  125. <el-button
  126. type="text"
  127. class="price-text"
  128. @click="changeClothDefaultPriceEvent(scope.$index)">
  129. ¥{{ scope.row.defaultPrice }}
  130. </el-button>
  131. </template>
  132. <span v-else class="price-text">¥{{ scope.row.defaultPrice }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="操作" width="280" fixed="right">
  136. <template slot-scope="scope">
  137. <div class="operation-buttons">
  138. <el-button type="text" @click="handleAddClothFlaw(scope.$index)">
  139. 附件({{ getFlawCount(scope.row.orderClothAdjunctDTOS) }})
  140. </el-button>
  141. <el-button type="text" icon="el-icon-camera" @click="handphotograph(scope.$index)">
  142. 拍照({{ scope.row.picNum }})
  143. </el-button>
  144. <el-button type="text" @click="handleRemarkClothItem(scope.$index)">备注</el-button>
  145. <el-button type="text" @click="handleCopyClothItem(scope.$index)">复制</el-button>
  146. <el-button type="text" class="delete-btn" @click="orderClothItemDTOS.splice(scope.$index, 1)">
  147. 删除
  148. </el-button>
  149. </div>
  150. </template>
  151. </el-table-column>
  152. </el-table>
  153. </div>
  154. <!-- 底部结算区 -->
  155. <div class="settlement-bar">
  156. <div class="order-info">
  157. <div class="info-group">
  158. <div class="info-item">
  159. <span class="label">总件数:</span>
  160. <span class="value">{{ orderClothItemDTOS.length }}</span>
  161. </div>
  162. <div class="info-item">
  163. <span class="label">总金额:</span>
  164. <span class="value">¥{{ calculateTotalPrice() }}</span>
  165. </div>
  166. <div class="info-item highlight">
  167. <span class="label">实收金额:</span>
  168. <span class="value">¥{{ calculateTotalPrice() }}</span>
  169. </div>
  170. </div>
  171. <div class="order-settings">
  172. <el-form :model="orderForm" :inline="true" size="small">
  173. <el-form-item label="订单加急">
  174. <el-select v-model="orderForm.speed" placeholder="请选择" clearable>
  175. <el-option
  176. v-for="item in clothSpeeds"
  177. v-if="item.id > 1"
  178. :key="item.id"
  179. :label="item.name"
  180. :value="item.id">
  181. </el-option>
  182. </el-select>
  183. </el-form-item>
  184. <el-form-item
  185. v-if="orderForm.isAppointment == 'Y'"
  186. label="取衣方式">
  187. <el-select v-model="orderForm.sendClothWay" placeholder="请选择" clearable>
  188. <el-option
  189. v-for="dict in dict.type.cloth_send_type"
  190. :key="dict.value"
  191. :label="dict.label"
  192. :value="dict.value"/>
  193. </el-select>
  194. </el-form-item>
  195. <el-form-item label="备注">
  196. <el-input v-model="orderForm.remark" placeholder="请输入订单备注" clearable/>
  197. </el-form-item>
  198. </el-form>
  199. </div>
  200. </div>
  201. <div class="action-area">
  202. <el-button
  203. type="danger"
  204. class="checkout-btn"
  205. icon="el-icon-shopping-cart-2"
  206. :loading="confirmLoading"
  207. @click="handleConfirmPay">
  208. 收银
  209. </el-button>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. <!-- 添加或修改洗衣订单衣服明细对话框 -->
  215. <el-dialog :title="title" :visible.sync="open" size="50%" append-to-body>
  216. <el-row :gutter="15">
  217. <el-col :span="24">
  218. <el-steps :active="addClothActiveTab" finish-status="success" simple>
  219. <el-step title="衣服分类"></el-step>
  220. <el-step title="选择衣服"></el-step>
  221. <el-step title="衣服颜色"></el-step>
  222. <el-step title="衣服品牌"></el-step>
  223. <el-step title="衣服瑕疵"></el-step>
  224. <el-step title="衣服附件"></el-step>
  225. </el-steps>
  226. </el-col>
  227. <el-col>
  228. <div style="height: 20px"></div>
  229. </el-col>
  230. <el-col :span="24" v-if="addClothActiveTab == 0">
  231. <div style="margin-left: 55px">
  232. <el-input v-model="defaultList.type" placeholder="请输入要搜索的衣服分类" style="width: 300px" clearable>
  233. <el-button slot="append" icon="el-icon-search" @click="searchCloth('type', 'clothTypes')"></el-button>
  234. </el-input>
  235. </div>
  236. <div style="margin-left: 40px">
  237. <el-tag :key="item.id" type="info" v-for="item in clothTypes" style="margin-top: 15px; margin-left: 15px" size="medium" @click="onClothTypeSelect(item.id)">
  238. {{ item.name }}
  239. </el-tag>
  240. </div>
  241. </el-col>
  242. <el-col :span="24" v-if="addClothActiveTab == 1">
  243. <div style="margin-left: 55px; margin-bottom: 10px">
  244. <el-input v-model="defaultList.item" placeholder="请输入要搜索的衣服类型" style="width: 300px" clearable>
  245. <el-button slot="append" icon="el-icon-search" @click="searchCloth('item', 'clothItems')"></el-button>
  246. </el-input>
  247. <el-button type="primary" @click="changeClothActiveTab(0)" style="margin-left: 10px">上一步</el-button>
  248. </div>
  249. <div style="margin-left: 40px">
  250. <div class="horizontal-view" style="margin-left: 15px">
  251. <span style="font-size: 14px; line-height: 19px">衣服类型:</span>
  252. <el-checkbox-group style="margin-left: 20px" v-model="form.clothTypeKeys">
  253. <el-checkbox v-for="dict in dict.type.cloth_type" :key="dict.value" :label="dict.value">{{ dict.label }}</el-checkbox>
  254. </el-checkbox-group>
  255. </div>
  256. <el-tag :key="item.id" type="info" v-for="(item, index) in clothItems" style="margin-top: 15px; margin-left: 15px" size="medium" @click="onClothItemSelect(index)">
  257. {{ item.name }}
  258. </el-tag>
  259. </div>
  260. </el-col>
  261. <el-col :span="24" v-if="addClothActiveTab == 2" >
  262. <div style="margin-left: 55px; margin-bottom: 10px">
  263. <el-input v-model="defaultList.color" placeholder="请输入要搜索的衣服颜色" style="width: 300px" clearable>
  264. <el-button slot="append" icon="el-icon-search" @click="searchCloth('color', 'clothColors')"></el-button>
  265. </el-input>
  266. <el-button type="primary" @click="changeClothActiveTab(1)" style="margin-left: 10px" v-if="!isUpdateClothItem">上一步</el-button>
  267. </div>
  268. <div style="margin-left: 40px; display: flex; flex-wrap: wrap">
  269. <template v-for="(item, index) in clothColors">
  270. <div class="verticle-view" :style="'text-align: center;margin-top: 15px;margin-left: 15px;border-radius: 5px;border: 1px solid ' + (item.isSelect == true ? '#1890ff' : '#FFFFFF')" @click="onClothColorSelect(index)">
  271. <template v-if="item.colorType == 0">
  272. <div :style="'width: 50px;height: 50px;border:1px solid #ededed;border-radius: 5px;background-color:' + item.code"></div>
  273. </template>
  274. <template v-if="item.colorType == 1">
  275. <img :src="item.imgUrl" style="width: 50px; height: 50px; border-radius: 5px" />
  276. </template>
  277. <span style="height: 40px; line-height: 40px">{{ item.name }}</span>
  278. </div>
  279. </template>
  280. </div>
  281. </el-col>
  282. <el-col :span="24" v-if="addClothActiveTab == 3">
  283. <div style="margin-left: 55px">
  284. <el-input v-model="defaultList.brand" placeholder="请输入要搜索的衣服品牌" style="width: 300px" clearable>
  285. <el-button slot="append" icon="el-icon-search" @click="searchCloth('brand', 'clothBrands')"></el-button>
  286. </el-input>
  287. <el-button type="primary" @click="changeClothActiveTab(2)" style="margin-left: 10px" v-if="!isUpdateClothItem">上一步</el-button>
  288. </div>
  289. <div style="margin-left: 40px">
  290. <el-tag :key="item.id" type="info" v-for="item in clothBrands" style="margin-top: 15px; margin-left: 15px" size="medium" @click="onClothBrandSelect(item.id)">
  291. {{ item.name }}
  292. </el-tag>
  293. </div>
  294. </el-col>
  295. <el-col :span="24" v-if="addClothActiveTab == 4">
  296. <el-tabs type="border-card" @tab-click="changeClothTab">
  297. <el-tab-pane label="全部">
  298. <div style="margin-left: 15px">
  299. <el-input v-model="defaultList.flaw" placeholder="请输入要搜索的衣服瑕疵" style="width: 300px" clearable>
  300. <el-button slot="append" icon="el-icon-search" @click="searchCloth('flaw', 'clothFlaws')"></el-button>
  301. </el-input>
  302. <el-button type="primary" @click="changeClothActiveTab(3)" style="margin-left: 10px" v-if="!isUpdateClothItem">上一步</el-button>
  303. </div>
  304. <el-tag :key="item.id" :type="item.isSelect ? 'success' : 'info'" v-for="(item, index) in clothFlaws" style="margin-top: 15px; margin-left: 15px" size="medium" @click="onClothFlawSelect(index)">
  305. {{ item.name }}
  306. </el-tag>
  307. </el-tab-pane>
  308. <el-tab-pane :label="clothFlawType.name" v-for="clothFlawType in clothFlawTypes">
  309. <div style="margin-left: 15px">
  310. <el-input v-model="defaultList.flaw" placeholder="请输入要搜索的衣服瑕疵" style="width: 300px" clearable>
  311. <el-button slot="append" icon="el-icon-search" @click="searchCloth('flaw', 'clothFlaws')"></el-button>
  312. </el-input>
  313. </div>
  314. <template v-for="(item, index) in clothFlaws">
  315. <el-tag :key="item.id" :type="item.isSelect ? 'success' : 'info'" v-if="item.flawTypeId == clothFlawType.id" style="margin-top: 15px; margin-left: 15px" size="medium" @click="onClothFlawSelect(index)">
  316. {{ item.name }}
  317. </el-tag>
  318. </template>
  319. </el-tab-pane>
  320. </el-tabs>
  321. </el-col>
  322. <el-col :span="24" v-if="addClothActiveTab == 5">
  323. <el-row :gutter="20">
  324. <el-col :span="8">
  325. <div>选择附件</div>
  326. <div style="margin-left: 15px; margin-top: 10px">
  327. <el-input v-model="defaultList.adjunct" placeholder="请输入要搜索的衣服附件" style="width: 200px" clearable>
  328. <el-button slot="append" icon="el-icon-search" @click="searchCloth('adjunct', 'clothAdjuncts')"></el-button>
  329. </el-input>
  330. <el-button type="primary" @click="changeClothActiveTab(4)" style="margin-left: 10px" v-if="!isUpdateClothItem">上一步</el-button>
  331. </div>
  332. <el-tag :key="item.id" type="info" v-for="item in clothAdjuncts" style="margin-top: 15px; margin-left: 15px" @click="onClothAdjunctSelect(item)">
  333. {{ item.name }}
  334. </el-tag>
  335. </el-col>
  336. <el-col :span="16">
  337. <el-table :data="addClothAdjuncts" style="width: 100%">
  338. <el-table-column label="附件" align="center" prop="adjunctName" />
  339. <el-table-column label="数量" align="center" prop="num">
  340. <template slot-scope="scope">
  341. <el-input-number v-model="scope.row.num" size="small" :precision="0" :min="1" :max="999"></el-input-number>
  342. </template>
  343. </el-table-column>
  344. <el-table-column label="操作" align="center">
  345. <template slot-scope="scope">
  346. <el-button type="text" icon="el-icon-delete" @click="removeClothAdjunct(scope.$index)">删除</el-button>
  347. </template>
  348. </el-table-column>
  349. </el-table>
  350. </el-col>
  351. </el-row>
  352. </el-col>
  353. </el-row>
  354. <div slot="footer" class="dialog-footer" v-if="addClothActiveTab == 2 || addClothActiveTab == 4 || addClothActiveTab == 5">
  355. <el-button type="primary" @click="addClothItemConfirm" style="margin-left: 5%">确定</el-button>
  356. </div>
  357. </el-dialog>
  358. <el-dialog title="衣服附件" :visible.sync="addClothAdjunctOpen" width="60%" append-to-body>
  359. <el-row :gutter="20">
  360. <el-col :span="8">
  361. <div>选择附件</div>
  362. <div style="margin-left: 15px; margin-top: 10px">
  363. <el-input v-model="defaultList.adjunct" placeholder="请输入要搜索的衣服附件" style="width: 300px" clearable>
  364. <el-button slot="append" icon="el-icon-search" @click="searchCloth('adjunct', 'clothAdjuncts')"></el-button>
  365. </el-input>
  366. </div>
  367. <el-tag :key="item.id" type="info" v-for="item in clothAdjuncts" style="margin-top: 15px; margin-left: 15px" @click="onClothAdjunctSelect(item)">
  368. {{ item.name }}
  369. </el-tag>
  370. </el-col>
  371. <el-col :span="16">
  372. <el-table :data="addClothAdjuncts" style="width: 100%">
  373. <el-table-column label="附件" align="center" prop="adjunctName" />
  374. <el-table-column label="数量" align="center" prop="num">
  375. <template slot-scope="scope">
  376. <el-input-number v-model="scope.row.num" size="small" :precision="0" :min="1" :max="999"></el-input-number>
  377. </template>
  378. </el-table-column>
  379. <el-table-column label="操作" align="center">
  380. <template slot-scope="scope">
  381. <el-button type="text" icon="el-icon-delete" @click="removeClothAdjunct(scope.$index)">删除</el-button>
  382. </template>
  383. </el-table-column>
  384. </el-table>
  385. </el-col>
  386. </el-row>
  387. <span slot="footer" class="dialog-footer">
  388. <el-button @click="addClothAdjunctOpen = false">取 消</el-button>
  389. <el-button type="primary" @click="addClothAdjunctSubmit">确 定</el-button>
  390. </span>
  391. </el-dialog>
  392. <el-dialog title="衣服照片" :visible.sync="addClothPicOpen" width="50%" append-to-body>
  393. <form ref="picForm">
  394. <image-upload :limit="9" v-model="addClothPics"></image-upload>
  395. </form>
  396. <span slot="footer" class="dialog-footer">
  397. <el-button @click="addClothPicOpen = false">取 消</el-button>
  398. <el-button type="primary" @click="addClothPicSubmit">确 定</el-button>
  399. </span>
  400. </el-dialog>
  401. <el-dialog title="洗衣方式" :visible.sync="addClothWashModeOpen" width="30%" append-to-body>
  402. <div style="margin-bottom: 50px">
  403. <el-tag :key="item.id" type="info" v-for="(item, index) in clothWashModes" style="margin-top: 15px; margin-left: 15px" size="medium" @click="onClothWashModeSelect(index)">
  404. {{ item.washModeName + '(¥' + item.price + ')' }}
  405. </el-tag>
  406. </div>
  407. </el-dialog>
  408. <!-- 设置备注 -->
  409. <el-dialog title="备注" :visible.sync="addClothRemarkOpen" width="30%" append-to-body>
  410. <form ref="remarkForm">
  411. <el-input type="textarea" :rows="5" placeholder="请输入备注" v-model="clothRemark"> </el-input>
  412. </form>
  413. <span slot="footer" class="dialog-footer">
  414. <el-button @click="addClothPicOpen = false">取 消</el-button>
  415. <el-button type="primary" @click="addClothRemarkSubmit">确 定</el-button>
  416. </span>
  417. </el-dialog>
  418. <!-- 设置默认价格 -->
  419. <el-dialog title="设置价格" :visible.sync="setClothDefaultPriceOpen" width="30%" :before-close="handleClose" append-to-body>
  420. <form ref="remarkForm">
  421. <el-input-number placeholder="请输入价格" v-model="defaultPrice"> </el-input-number>
  422. </form>
  423. <span slot="footer" class="dialog-footer">
  424. <el-button @click="setClothDefaultPriceOpen = false">取 消</el-button>
  425. <el-button type="primary" @click="setClothDefaultPriceSubmit">确 定</el-button>
  426. </span>
  427. </el-dialog>
  428. <!-- 特殊衣物 -->
  429. <el-dialog title="特殊衣物" :visible.sync="setClothSpecialPriceOpen" width="55%" :before-close="handleClose" append-to-body>
  430. <el-form ref="remarkForm">
  431. <el-row :gutter="10">
  432. <el-col :span="12">
  433. <el-card class="box-card">
  434. <div slot="header" class="clearfix">
  435. <span>工艺加价</span>
  436. </div>
  437. <template v-for="(item, index) in clothSpecialForm.clothCrafts">
  438. <el-form-item>
  439. <el-checkbox v-model="item.isSelect" @change="changeClothCraftSelect()" style="width: 100px">{{ item.clothCraftName }}</el-checkbox>
  440. <el-input-number v-model="item.price" :min="0" :max="9999" :precision="2" @change="changeClothCraftSelect"></el-input-number>
  441. </el-form-item>
  442. </template>
  443. </el-card>
  444. </el-col>
  445. <el-col :span="12">
  446. <el-card class="box-card">
  447. <div slot="header" class="clearfix">
  448. <span>保值加急</span>
  449. </div>
  450. <el-form-item>
  451. <el-checkbox v-model="clothSpecialForm.isHedging" @change="changeClothHedgingSelect()" style="width: 100px">保值</el-checkbox>
  452. <el-input-number v-model="clothSpecialForm.hedgingPrice" :min="0" :max="9999" :precision="0" @change="changeClothHedgingSelect()"></el-input-number>
  453. <span style="margin-left: 5px">元 {{ clothSpecialForm.hedgingPrice && clothSpecialForm.isHedging ? '(¥' + clothSpecialForm.hedgingPrice * 0.01 + ')' : '' }}</span>
  454. </el-form-item>
  455. <template v-for="(item, index) in clothSpecialForm.clothSpeeds">
  456. <el-form-item v-if="item.isDefault != 'Y' && selectClothItemIndex > -1">
  457. <el-checkbox v-model="item.isSelect" @change="changeClothSpeedSelect(index)" style="width: 100px" :disabled="clothSpecialForm.isHedging && index == 1">
  458. <span v-if="item.isSelect && orderClothItemDTOS[selectClothItemIndex]">{{ item.name + '(¥' + orderClothItemDTOS[selectClothItemIndex].defaultPrice * (item.multiple - 1) + ')' }}</span>
  459. <span v-else>{{ item.name }}</span>
  460. </el-checkbox>
  461. <span>{{ item.price }}</span>
  462. </el-form-item>
  463. </template>
  464. </el-card>
  465. </el-col>
  466. </el-row>
  467. </el-form>
  468. <span slot="footer" class="dialog-footer">
  469. <el-button @click="setClothSpecialPriceOpen = false">取 消</el-button>
  470. <el-button type="primary" @click="addClothSpecialSubmit">确 定</el-button>
  471. </span>
  472. </el-dialog>
  473. <el-dialog title="收银" :visible.sync="confirmPayOpen" width="90%" :before-close="handleClose" destroy-on-close append-to-body>
  474. <CashCloth ref="cashCloth" :orderForm="orderForm" :orderClothItemDTOS="orderClothItemDTOS" :appUserInfo="appUserInfo" :clothSpeeds="clothSpeeds" :deductCouponVOS="deductCouponVOS" :discountCouponVOS="discountCouponVOS" @onPaySuccess="onPaySuccess" @initOrderList="initOrderList" @confirm="handelPaySuccess"/>
  475. </el-dialog>
  476. <!-- 拍照上传 -->
  477. <el-dialog title="拍照上传" :visible.sync="photographType" :before-close="hidephotograph" width="55%" append-to-body>
  478. <div class="photo_content">
  479. <div class="video_content">
  480. <div class="loading" v-if="videoType">
  481. <el-button type="text" :loading="true" disabled>加载中请稍后</el-button>
  482. </div>
  483. <video class="videoElement" ref="videoElement" autoplay></video>
  484. </div>
  485. <div class="view">
  486. <div class="btn_box">
  487. <el-button class="btn_photo" :loading="photoType" :disabled="photoType" icon="el-icon-camera" type="primary" plain @click="takePhoto" v-if="!videoType">拍照上传</el-button>
  488. <el-upload v-if="photographimgList.length < 9" class="btn_upload" :action="uploadAction" :before-upload="handleBeforeUpload" :on-success="handleUploadSuccess" :on-error="handleUploadError" accept="image/*" :show-file-list="false" ref="fileUpload">
  489. <el-button icon="el-icon-folder" plain type="primary">上传本地文件</el-button>
  490. </el-upload>
  491. </div>
  492. <div class="image_list" v-if="photographimgList.length">
  493. <div class="image_item" v-for="(item, index) in photographimgList" :key="index">
  494. <el-image style="width: 120px; height: 120px" :src="item.src ? item.src : item.url" :preview-src-list="previewimgList"> </el-image>
  495. <div class="image_bottom">
  496. <el-button type="danger" icon="el-icon-delete" @click="btn_remove(item, index)"></el-button>
  497. <el-button v-if="item.type" type="success" icon="el-icon-check"></el-button>
  498. </div>
  499. </div>
  500. </div>
  501. <el-empty :image-size="200" v-else></el-empty>
  502. </div>
  503. </div>
  504. <span slot="footer" class="dialog-footer">
  505. <el-button @click="hidephotograph">关 闭</el-button>
  506. <el-button type="primary" @click="btn_submit">保 存</el-button>
  507. </span>
  508. </el-dialog>
  509. <pay-status-popup ref="payStatusPopup" @paySuccess="handelPaySuccess"></pay-status-popup>
  510. <el-dialog title="预约订单" :visible.sync="showAdvanceOrder" width="55%" append-to-body>
  511. <el-table :data="advanceOrderList">
  512. <el-table-column prop="orderNo" label="预约单号" width="180"> </el-table-column>
  513. <el-table-column prop="appointmentTime" label="预约时间" width="180"></el-table-column>
  514. <el-table-column prop="isLargeItem" label="是否大件" width="180">
  515. <template slot-scope="scope">
  516. <span v-if="scope.row.isLargeItem == 'Y'">是</span>
  517. <span v-if="scope.row.isLargeItem == 'N'">否</span>
  518. </template>
  519. </el-table-column>
  520. <el-table-column prop="appointmentCount" label="件数" width="180"> </el-table-column>
  521. <el-table-column prop="remark" label="备注" width="180" show-overflow-tooltip> </el-table-column>
  522. <el-table-column prop="date" label="操作" width="180">
  523. <template slot-scope="scope">
  524. <el-button type="text" @click="changeAdanceOrder(scope.row)">选择订单</el-button>
  525. </template>
  526. </el-table-column>
  527. </el-table>
  528. </el-dialog>
  529. </div>
  530. </template>
  531. <script>
  532. import CashCloth from './component/cashCloth'
  533. import payStatusPopup from '@/components/payStatusPopup'
  534. import { listClothItem, getClothItem, delClothItem, addClothItem, updateClothItem, updateClothItemStatus } from '@/api/order/clothItem'
  535. import { uploadBase64OSS, uploadOSS, saveOrderClothPics } from '@/api/upload'
  536. import { getOrderStatusByOrderNo } from '../../../api/order/cloth'
  537. import { allList } from '@/api/core/clothType'
  538. import { allClothItem } from '../../../api/core/clothItem'
  539. import { allClothColor } from '../../../api/core/color'
  540. import { allClothFlaw } from '@/api/core/flaw'
  541. import { allClothFlawType } from '@/api/core/flawType'
  542. import { allClothAdjunct } from '../../../api/cloth/adjunct'
  543. import { findUserByPhoneNumber } from '@/api/app/user'
  544. import { listWashModePriceByClothId } from '../../../api/cloth/price'
  545. import { allClothSpeed } from '../../../api/cloth/speed'
  546. import { allClothCraft } from '../../../api/cloth/craft'
  547. import { collectCloth, getInfoByOrderNo, clothOrderPay } from '../../../api/order/cloth'
  548. import { allBrand } from '../../../api/cloth/brand'
  549. import { getCouponItemlistByAppUserId, getDiscountByStoreId } from '../../../api/coupon/item'
  550. import { add, multi, minute, sub } from '../../../utils/math'
  551. import request from '@/utils/request'
  552. export default {
  553. name: 'CollectCloth',
  554. components: { CashCloth, payStatusPopup },
  555. dicts: ['sys_yes_no', 'cloth_type', 'cloth_send_type'],
  556. data() {
  557. return {
  558. uploadAction: `${process.env.VUE_APP_BASE_API}` + '/common/uploadOSS',
  559. appUserInfo: null,
  560. checkOrderStatusNum: 0,
  561. checkOrderIntervalId: null,
  562. addClothActiveTab: 0,
  563. defaultList: {
  564. type: '',
  565. clothTypes: [],
  566. item: '',
  567. clothItems: [],
  568. color: '',
  569. clothColors: [],
  570. brand: '',
  571. clothBrands: [],
  572. flaw: '',
  573. clothFlaws: [],
  574. adjunct: '',
  575. clothAdjuncts: []
  576. },
  577. clothBrands: [],
  578. clothTypes: [],
  579. clothItems: [],
  580. clothColors: [],
  581. clothFlawTypes: [],
  582. clothFlaws: [],
  583. clothAdjuncts: [],
  584. clothWashModes: [],
  585. clothCrafts: [],
  586. clothSpeeds: [],
  587. orderForm: {
  588. isSpecial: 'N',
  589. isAppointment: 'N',
  590. authCode: '',
  591. payType: '3'
  592. },
  593. // 总条数
  594. total: 0,
  595. // 洗衣订单衣服明细表格数据
  596. orderClothItemDTOS: [],
  597. selectClothItemIndex: -1,
  598. selectCoupons: [],
  599. // 弹出层标题
  600. title: '',
  601. // 是否显示弹出层
  602. open: false,
  603. isUpdateClothItem: false,
  604. //衣服特殊价格设置
  605. setClothSpecialPriceOpen: false,
  606. clothSpecialForm: {},
  607. //衣服附件相关
  608. addClothAdjunctOpen: false,
  609. addClothAdjuncts: [],
  610. //衣服照片相关
  611. addClothPicOpen: false,
  612. addClothPics: null,
  613. //衣服洗衣方式
  614. addClothWashModeOpen: false,
  615. //衣服备注
  616. addClothRemarkOpen: false,
  617. clothRemark: '',
  618. setClothDefaultPriceOpen: false,
  619. defaultPrice: 0,
  620. confirmPayOpen: false,
  621. confirmCouponTabIndex: '0',
  622. confirmDeductTabIndex: '0',
  623. setCouponOpen: false, //是否选择优惠券
  624. discountCouponVOS: [], //可选择的折扣券
  625. deductCouponVOS: [], //可选择的抵扣券
  626. changeDiscountCouponIndex: -1,
  627. changeDiscountCouponOpen: false,
  628. changeDiscountCouponTitle: '',
  629. changeDiscountCouponSelectCloths: [],
  630. changeDiscountCouponCanSelectCloths: [],
  631. // 查询参数
  632. queryParams: {},
  633. // 表单参数
  634. form: {},
  635. // 表单校验
  636. rules: {},
  637. photographType: false,
  638. photographimgList: [],
  639. previewimgList: [],
  640. uploadList: [],
  641. photoLoading: true,
  642. clothId: null,
  643. stream: null,
  644. fileType: ['png', 'jpg', 'jpeg'],
  645. videoType: true,
  646. photoType: false,
  647. collectClothDetail: null,
  648. showAdvanceOrder: false,
  649. advanceOrderList: [],
  650. confirmLoading: false
  651. }
  652. },
  653. mounted() {
  654. if (process.env.ENV != 'production') {
  655. window.vue = this
  656. }
  657. },
  658. created() {
  659. allClothCraft().then((res) => {
  660. this.clothCrafts = res.data
  661. this.clothCrafts.forEach((item) => {
  662. item.defaultPrice = 20
  663. })
  664. })
  665. allClothSpeed().then((speedRes) => {
  666. this.clothSpeeds = speedRes.data
  667. })
  668. },
  669. methods: {
  670. // 展示附件数量
  671. getFlawCount(e) {
  672. let count = 0
  673. e.forEach((item) => {
  674. count += item.num
  675. })
  676. return count
  677. },
  678. // 添加衣物过滤数据
  679. searchCloth(k1, k2) {
  680. if (!this.defaultList[k1]) {
  681. this[k2] = this.defaultList[k2]
  682. } else {
  683. this[k2] = this.defaultList[k2].filter((item) => {
  684. return item.name.indexOf(this.defaultList[k1]) > -1
  685. })
  686. }
  687. },
  688. // 切换衣服瑕疵分页
  689. changeClothTab() {
  690. this.defaultList.flaw = ''
  691. this.clothFlaws = this.defaultList.clothFlaws
  692. },
  693. // 上传前校检格式和大小
  694. handleBeforeUpload(file) {
  695. // 校检文件类型
  696. if (this.fileType) {
  697. const fileName = file.name.split('.')
  698. const fileExt = fileName[fileName.length - 1]
  699. const isTypeOk = this.fileType.indexOf(fileExt) >= 0
  700. if (!isTypeOk) {
  701. this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join('/')}格式文件!`)
  702. return false
  703. }
  704. }
  705. // 校检文件大小
  706. const isLt = file.size / 1024 / 1024 < 3
  707. if (!isLt) {
  708. this.$message.error(`上传文件大小不能超过 3MB!`)
  709. return false
  710. }
  711. this.$modal.loading('正在上传文件,请稍候...')
  712. return true
  713. },
  714. handleUploadSuccess(res, file) {
  715. if (res.code === 200) {
  716. this.previewimgList.push(res.data.src)
  717. this.uploadList.push({ name: res.data.fileName, url: res.data.src })
  718. this.uploadedSuccessfully()
  719. } else {
  720. this.$modal.closeLoading()
  721. this.$modal.msgError(res.msg)
  722. this.$refs.fileUpload.handleRemove(file)
  723. this.uploadedSuccessfully()
  724. }
  725. },
  726. handleUploadError() {
  727. this.$modal.msgError('上传文件失败,请重试')
  728. this.$modal.closeLoading()
  729. },
  730. // 上传结束处理
  731. uploadedSuccessfully() {
  732. if (this.uploadList.length) {
  733. // this.fileList = this.fileList.concat(this.uploadList);
  734. this.uploadList.forEach((item) => {
  735. this.photographimgList.push({
  736. src: item.url,
  737. fileName: item.fileName,
  738. type: true
  739. })
  740. })
  741. this.uploadList = []
  742. this.$modal.closeLoading()
  743. this.getuploadState()
  744. }
  745. },
  746. //根据上传文件状态判断显示
  747. getuploadState() {
  748. // 初始状态值
  749. let state = true
  750. // 判断数组中的所有元素是否都为true
  751. if (this.photographimgList.every((item) => item.type === true)) {
  752. state = false
  753. } else {
  754. state = true
  755. }
  756. return state
  757. },
  758. // 取消按钮
  759. cancel() {
  760. this.confirmPayOpen = false
  761. this.reset()
  762. },
  763. // 表单重置
  764. reset() {
  765. this.form = {
  766. orderClothCraftDTOS: [], //衣服工艺
  767. orderClothAdjunctDTOS: [],
  768. orderClothTypeDTOS: [],
  769. clothTypeKeys: [],
  770. specialPrice: 0,
  771. clothSpeedMultiple: 1,
  772. picNum: 0,
  773. isCustomPrice: 'N',
  774. remark: '',
  775. defaultPrice: 0
  776. }
  777. },
  778. /** 搜索按钮操作 */
  779. handleQuery() {
  780. this.queryParams.pageNum = 1
  781. },
  782. /** 重置按钮操作 */
  783. resetQuery() {
  784. this.resetForm('queryForm')
  785. this.handleQuery()
  786. },
  787. /** 新增按钮操作 */
  788. handleAdd() {
  789. allList().then((res) => {
  790. this.defaultList.type = ''
  791. this.defaultList.clothTypes = res.data
  792. this.clothTypes = res.data
  793. this.reset()
  794. this.selectClothItemIndex = -1
  795. this.addClothActiveTab = 0
  796. this.isUpdateClothItem = false
  797. this.open = true
  798. this.title = '添加衣物'
  799. })
  800. },
  801. /** 修改按钮操作 */
  802. handleUpdate(row) {
  803. this.reset()
  804. const id = row.id || this.ids
  805. getClothItem(id).then((response) => {
  806. this.form = response.data
  807. this.open = true
  808. this.title = '编辑衣物信息'
  809. })
  810. },
  811. initOrderList(e) {
  812. console.log('sssss', e)
  813. this.orderClothItemDTOS = e.concat()
  814. },
  815. onPaySuccess(orderInfo) {
  816. console.log('aaaaa')
  817. this.confirmPayOpen = false
  818. console.log('res', orderInfo)
  819. if (orderInfo.payTimeType == '0') {
  820. //第三方支付
  821. console.log('第三方支付')
  822. this.$refs.payStatusPopup.open(3, orderInfo, this.appUserInfo)
  823. // this.checkOrderStatusNum = 0
  824. // if (this.checkOrderIntervalId) {
  825. // clearInterval(this.checkOrderIntervalId)
  826. // }
  827. // this.checkOrderIntervalId = setInterval(() => {
  828. // this.intervalCheckOrderStatus(orderInfo.orderNo)
  829. // }, 4000)
  830. } else {
  831. if (orderInfo.payType) {
  832. this.$refs.payStatusPopup.open(1, orderInfo)
  833. } else {
  834. this.$refs.payStatusPopup.open(6, orderInfo)
  835. }
  836. this.orderClothItemDTOS = []
  837. this.queryParams = {}
  838. this.appUserInfo = null
  839. this.orderForm = {}
  840. }
  841. },
  842. handelPaySuccess() {
  843. console.log("AAAAA")
  844. this.orderClothItemDTOS = []
  845. this.queryParams = {}
  846. this.confirmPayOpen = false
  847. this.appUserInfo = null
  848. // this.orderForm = {}
  849. },
  850. intervalCheckOrderStatus(orderno) {
  851. getOrderStatusByOrderNo({ orderNo: orderno }).then((response) => {
  852. if (this.checkOrderStatusNum > 15) {
  853. clearInterval(this.checkOrderIntervalId)
  854. return
  855. }
  856. if (response.data == '4') {
  857. return
  858. }
  859. if (response.data == '100') {
  860. //已取消
  861. this.$notify.error({
  862. title: '支付失败',
  863. message: '支付超时或客户已取消支付'
  864. })
  865. clearInterval(this.checkOrderIntervalId)
  866. return
  867. }
  868. this.$notify({
  869. title: '支付成功',
  870. message: '客户已成功支付订单',
  871. type: 'success'
  872. })
  873. this.pointerType = true
  874. clearInterval(this.checkOrderIntervalId)
  875. })
  876. },
  877. /** 关闭按钮 */
  878. close() {
  879. const obj = { path: '/workbench/collectCloth' }
  880. this.$tab.closeOpenPage(obj)
  881. },
  882. /** 删除按钮操作 */
  883. handleDelete(row) {
  884. const ids = row.id || this.ids
  885. this.$modal
  886. .confirm('是否确认删除洗衣订单衣服明细编号为"' + ids + '"的数据项?')
  887. .then(function () {
  888. return delClothItem(ids)
  889. })
  890. .then(() => {
  891. this.getList()
  892. this.$modal.msgSuccess('删除成功')
  893. })
  894. .catch(() => {})
  895. },
  896. checkClose(done) {
  897. this.$confirm('是否关闭表单,关闭后数据将丢失?')
  898. .then(function () {
  899. done()
  900. })
  901. .then(() => {})
  902. .catch(() => {})
  903. },
  904. onClothTypeSelect(id) {
  905. allClothItem({ clothTypeId: id }).then((res) => {
  906. this.defaultList.item = ''
  907. this.defaultList.clothItems = res.data
  908. this.clothItems = res.data
  909. this.addClothActiveTab = 1
  910. })
  911. },
  912. changeClothActiveTab(index) {
  913. this.addClothActiveTab = index
  914. switch (index) {
  915. case 0:
  916. this.form.clothTypeKeys = []
  917. this.form.orderClothTypeDTOS = []
  918. this.form.clothWashModeId = ''
  919. this.form.clothWashModeName = ''
  920. break
  921. case 1:
  922. this.clothColors.forEach((item) => {
  923. item.isSelect = false
  924. })
  925. this.form.orderClothColorDTOS = []
  926. break
  927. case 2:
  928. this.form.clothBrandId = ''
  929. this.form.clothBrandName = ''
  930. break
  931. case 3:
  932. this.form.orderClothFlawDTOS = []
  933. break
  934. case 4:
  935. break
  936. }
  937. },
  938. onClothItemSelect(index) {
  939. this.form.orderClothTypeDTOS = []
  940. for (let i = 0; i < this.form.clothTypeKeys.length; i++) {
  941. var orderClothTypeDTO = { orderClothTypeCode: this.form.clothTypeKeys[i] }
  942. if (this.form.clothTypeKeys[i] == '1') {
  943. orderClothTypeDTO.clothTypeName = '加厚'
  944. orderClothTypeDTO.clothTypePrice = this.clothItems[index].plusPrice
  945. }
  946. if (this.form.clothTypeKeys[i] == '2') {
  947. orderClothTypeDTO.clothTypeName = '羊绒'
  948. orderClothTypeDTO.clothTypePrice = this.clothItems[index].silkPrice
  949. }
  950. if (this.form.clothTypeKeys[i] == '3') {
  951. orderClothTypeDTO.clothTypeName = '真丝'
  952. orderClothTypeDTO.clothTypePrice = this.clothItems[index].sheepPrice
  953. }
  954. if (this.form.clothTypeKeys[i] == '4') {
  955. orderClothTypeDTO.clothTypeName = '儿童'
  956. orderClothTypeDTO.clothTypePrice = this.clothItems[index].childPrice
  957. }
  958. this.form.orderClothTypeDTOS.push(orderClothTypeDTO)
  959. }
  960. this.form.clothWashModeId = this.clothItems[index].washId
  961. this.form.clothWashModeName = this.clothItems[index].washName
  962. if (this.isUpdateClothItem) {
  963. //修改已选择的衣服
  964. this.form.clothItemId = this.clothItems[index].id
  965. this.form = { ...this.form, ...this.clothItems[index] }
  966. this.form.isCustomPrice = 'N'
  967. this.orderClothItemDTOS[this.selectClothItemIndex] = this.form
  968. this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
  969. for (let i = 0; i < this.form.clothTypeKeys.length; i++) {
  970. if (this.form.clothTypeKeys[i] == '1') {
  971. this.form.defaultPrice += this.clothItems[index].plusPrice
  972. }
  973. if (this.form.clothTypeKeys[i] == '2') {
  974. this.form.defaultPrice += this.clothItems[index].silkPrice
  975. }
  976. if (this.form.clothTypeKeys[i] == '3') {
  977. this.form.defaultPrice += this.clothItems[index].sheepPrice
  978. }
  979. if (this.form.clothTypeKeys[i] == '4') {
  980. this.form.defaultPrice += this.clothItems[index].childPrice
  981. }
  982. }
  983. this.open = false
  984. this.$forceUpdate()
  985. } else {
  986. allClothColor().then((res) => {
  987. this.defaultList.color = ''
  988. this.defaultList.clothColors = res.data
  989. this.clothColors = res.data
  990. this.form.clothItemId = this.clothItems[index].id
  991. this.form = { ...this.form, ...this.clothItems[index] }
  992. for (let i = 0; i < this.form.clothTypeKeys.length; i++) {
  993. if (this.form.clothTypeKeys[i] == '1') {
  994. this.form.defaultPrice += this.clothItems[index].plusPrice
  995. }
  996. if (this.form.clothTypeKeys[i] == '2') {
  997. this.form.defaultPrice += this.clothItems[index].silkPrice
  998. }
  999. if (this.form.clothTypeKeys[i] == '3') {
  1000. this.form.defaultPrice += this.clothItems[index].sheepPrice
  1001. }
  1002. if (this.form.clothTypeKeys[i] == '4') {
  1003. this.form.defaultPrice += this.clothItems[index].childPrice
  1004. }
  1005. }
  1006. this.addClothActiveTab = 2
  1007. })
  1008. }
  1009. },
  1010. onClothColorSelect(index) {
  1011. this.clothColors[index].isSelect = this.clothColors[index].isSelect ? false : true
  1012. this.$forceUpdate()
  1013. },
  1014. onClothBrandSelect(id) {
  1015. var brand = this.clothBrands.find((item) => item.id == id)
  1016. this.form.clothBrandId = id
  1017. this.form.clothBrandName = brand.name
  1018. if (this.isUpdateClothItem) {
  1019. this.orderClothItemDTOS[this.selectClothItemIndex].clothBrandId = id
  1020. this.orderClothItemDTOS[this.selectClothItemIndex].clothBrandName = brand.name
  1021. this.open = false
  1022. } else {
  1023. allClothFlawType().then((res) => {
  1024. this.clothFlawTypes = res.data
  1025. allClothFlaw().then((res1) => {
  1026. this.defaultList.flaw = ''
  1027. this.defaultList.clothFlaws = res1.data
  1028. this.clothFlaws = res1.data
  1029. this.addClothActiveTab = 4
  1030. })
  1031. })
  1032. }
  1033. },
  1034. addClothItemConfirm() {
  1035. console.log(this.addClothActiveTab)
  1036. if (this.addClothActiveTab == 2) {
  1037. //选择颜色
  1038. var clothColorDTOS = []
  1039. this.clothColors.forEach((item) => {
  1040. if (item.isSelect) {
  1041. clothColorDTOS.push({ clothColorId: item.id, clothColorName: item.name })
  1042. }
  1043. })
  1044. if (clothColorDTOS.length == 0) {
  1045. this.$message.error('请先选择颜色')
  1046. return
  1047. }
  1048. this.form.orderClothColorDTOS = clothColorDTOS
  1049. if (this.isUpdateClothItem) {
  1050. //修改已选择的衣服
  1051. this.orderClothItemDTOS[this.selectClothItemIndex] = this.form
  1052. this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
  1053. this.open = false
  1054. this.$forceUpdate()
  1055. } else {
  1056. allBrand().then((res) => {
  1057. res.data.push({
  1058. id: '0',
  1059. name: '无'
  1060. })
  1061. this.defaultList.brand = ''
  1062. this.defaultList.clothBrands = res.data
  1063. this.clothBrands = res.data
  1064. this.addClothActiveTab = 3
  1065. })
  1066. }
  1067. } else if (this.addClothActiveTab == 4) {
  1068. //选择瑕疵
  1069. var clothFlawDTOS = []
  1070. this.clothFlaws.forEach((item) => {
  1071. if (item.isSelect) {
  1072. clothFlawDTOS.push({ clothFlawId: item.id, clothFlawName: item.name })
  1073. }
  1074. })
  1075. if (clothFlawDTOS.length == 0) {
  1076. this.$message.error('请先选择瑕疵')
  1077. return
  1078. }
  1079. this.form.orderClothFlawDTOS = clothFlawDTOS
  1080. if (this.isUpdateClothItem) {
  1081. this.orderClothItemDTOS[this.selectClothItemIndex] = this.form
  1082. this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
  1083. this.open = false
  1084. this.$forceUpdate()
  1085. } else {
  1086. // this.orderClothItemDTOS.push(this.form)
  1087. // console.log(this.orderClothItemDTOS)
  1088. // this.open = false
  1089. allClothAdjunct().then((res) => {
  1090. this.defaultList.clothAdjuncts = res.data
  1091. this.defaultList.adjunct = ''
  1092. this.clothAdjuncts = res.data
  1093. this.addClothActiveTab = 5
  1094. let index = this.orderClothItemDTOS.length
  1095. this.selectClothItemIndex = index
  1096. this.addClothAdjuncts = []
  1097. this.$forceUpdate()
  1098. })
  1099. }
  1100. } else if (this.addClothActiveTab == 5) {
  1101. this.orderClothItemDTOS.push(this.form)
  1102. this.addClothAdjunctSubmit()
  1103. this.open = false
  1104. }
  1105. },
  1106. onClothFlawSelect(index) {
  1107. this.clothFlaws[index].isSelect = this.clothFlaws[index].isSelect ? false : true
  1108. this.$forceUpdate()
  1109. },
  1110. //条码搜索用户
  1111. qrcodeSearchUser() {},
  1112. //搜索用户
  1113. searchUser() {
  1114. this.$refs['queryForm'].validate((valid) => {
  1115. if (valid) {
  1116. findUserByPhoneNumber(this.queryParams).then((res) => {
  1117. this.appUserInfo = res.data
  1118. this.getAdvanceOrder(res.data.id)
  1119. })
  1120. }
  1121. })
  1122. },
  1123. getAdvanceOrder(id) {
  1124. request({
  1125. url: '/mapi/order/cloth/list',
  1126. method: 'get',
  1127. params: {
  1128. pageNum: 1,
  1129. pageSize: 100,
  1130. userId: id,
  1131. isAppointment: 'Y'
  1132. }
  1133. }).then((data) => {
  1134. if (data && data.code === 200) {
  1135. console.log('预约订单', data)
  1136. // this.pagination.total = data.total
  1137. // if (this.renderFun) {
  1138. // this.renderFun(data.rows, data)
  1139. // } else {
  1140. // this.data = data.rows
  1141. // }
  1142. this.advanceOrderList = data.rows
  1143. if (this.advanceOrderList.length) {
  1144. this.showAdvanceOrder = true
  1145. }
  1146. } else {
  1147. this.$message.error(data.msg)
  1148. }
  1149. })
  1150. },
  1151. changeAdanceOrder(e) {
  1152. // orderForm.isAppointment orderForm.orderNo
  1153. this.orderForm.isAppointment = 'Y'
  1154. this.orderForm.orderNo = e.orderNo
  1155. this.showAdvanceOrder = false
  1156. },
  1157. clearAppointment() {
  1158. this.orderForm.isAppointment = 'N'
  1159. this.orderForm.orderNo = ''
  1160. },
  1161. handleAddClothFlaw(index) {
  1162. allClothAdjunct().then((res) => {
  1163. this.defaultList.clothAdjuncts = res.data
  1164. this.defaultList.adjunct = ''
  1165. this.clothAdjuncts = res.data
  1166. this.addClothAdjunctOpen = true
  1167. this.selectClothItemIndex = index
  1168. this.addClothAdjuncts = this.orderClothItemDTOS[index].orderClothAdjunctDTOS.concat()
  1169. this.$forceUpdate()
  1170. })
  1171. },
  1172. handleAddClothPics(index) {
  1173. this.addClothPicOpen = true
  1174. this.selectClothItemIndex = index
  1175. this.addClothPics = this.orderClothItemDTOS[index].pics
  1176. },
  1177. handleClose(done) {
  1178. this.$confirm('确认关闭?')
  1179. .then((_) => {
  1180. done()
  1181. })
  1182. .catch((_) => {})
  1183. },
  1184. onClothAdjunctSelect(item) {
  1185. var isContains = false
  1186. for (let i = 0; i < this.addClothAdjuncts.length; i++) {
  1187. if (this.addClothAdjuncts[i].adjunctId == item.id) {
  1188. if (this.addClothAdjuncts[i].num >= 999) {
  1189. return
  1190. }
  1191. this.addClothAdjuncts[i].num++
  1192. isContains = true
  1193. break
  1194. }
  1195. }
  1196. if (!isContains) {
  1197. this.addClothAdjuncts.push({ adjunctId: item.id, num: 1, adjunctName: item.name })
  1198. }
  1199. },
  1200. removeClothAdjunct(index) {
  1201. this.addClothAdjuncts.splice(index, 1)
  1202. },
  1203. addClothAdjunctSubmit() {
  1204. console.log(this.orderClothItemDTOS[this.selectClothItemIndex])
  1205. this.orderClothItemDTOS[this.selectClothItemIndex].orderClothAdjunctDTOS = this.addClothAdjuncts.concat()
  1206. this.addClothAdjunctOpen = false
  1207. },
  1208. updateClothItem(index, tabIndex) {
  1209. if (tabIndex == 0) {
  1210. allList().then((res) => {
  1211. this.defaultList.type = ''
  1212. this.defaultList.clothTypes = res.data
  1213. this.clothTypes = res.data
  1214. this.selectClothItemIndex = index
  1215. this.form = { ...this.orderClothItemDTOS[index] }
  1216. this.isUpdateClothItem = true
  1217. this.addClothActiveTab = tabIndex
  1218. this.open = true
  1219. this.title = '修改衣物信息'
  1220. })
  1221. }
  1222. if (tabIndex == 2) {
  1223. allClothColor().then((res) => {
  1224. this.defaultList.color = ''
  1225. this.defaultList.clothColors = res.data
  1226. this.clothColors = res.data
  1227. this.selectClothItemIndex = index
  1228. this.form = { ...this.orderClothItemDTOS[index] }
  1229. this.isUpdateClothItem = true
  1230. this.addClothActiveTab = tabIndex
  1231. this.open = true
  1232. this.title = '修改衣物信息'
  1233. })
  1234. }
  1235. if (tabIndex == 3) {
  1236. allBrand().then((res) => {
  1237. this.defaultList.brand = ''
  1238. this.defaultList.clothBrands = res.data
  1239. this.clothBrands = res.data
  1240. this.selectClothItemIndex = index
  1241. this.form = { ...this.orderClothItemDTOS[index] }
  1242. this.isUpdateClothItem = true
  1243. this.addClothActiveTab = tabIndex
  1244. this.open = true
  1245. this.title = '修改衣服品牌'
  1246. })
  1247. }
  1248. if (tabIndex == 4) {
  1249. //修改瑕疵
  1250. allClothFlawType().then((res) => {
  1251. this.clothFlawTypes = res.data
  1252. allClothFlaw().then((res1) => {
  1253. this.defaultList.flaw = ''
  1254. this.defaultList.clothFlaws = res1.data
  1255. this.clothFlaws = res1.data
  1256. this.selectClothItemIndex = index
  1257. this.form = { ...this.orderClothItemDTOS[index] }
  1258. this.isUpdateClothItem = true
  1259. this.addClothActiveTab = tabIndex
  1260. this.open = true
  1261. this.title = '修改衣物信息'
  1262. })
  1263. })
  1264. }
  1265. },
  1266. addClothPicSubmit() {
  1267. this.orderClothItemDTOS[this.selectClothItemIndex].pics = this.addClothPics
  1268. if (this.isEmpty(this.addClothPics)) {
  1269. this.orderClothItemDTOS[this.selectClothItemIndex].picNum = 0
  1270. } else {
  1271. this.orderClothItemDTOS[this.selectClothItemIndex].picNum = this.addClothPics.split(',').length
  1272. }
  1273. // this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
  1274. this.addClothPicOpen = false
  1275. // this.$forceUpdate()
  1276. // console.log(this.orderClothItemDTOS)
  1277. },
  1278. //复制衣服
  1279. handleCopyClothItem(index) {
  1280. this.orderClothItemDTOS.push({ ...this.orderClothItemDTOS[index] })
  1281. },
  1282. //修改洗衣方式
  1283. changeClothWashMode(index) {
  1284. listWashModePriceByClothId({ clothId: this.orderClothItemDTOS[index].id }).then((res) => {
  1285. this.clothWashModes = res.data
  1286. this.addClothWashModeOpen = true
  1287. this.selectClothItemIndex = index
  1288. })
  1289. },
  1290. //洗衣方式被选择
  1291. onClothWashModeSelect(index) {
  1292. this.orderClothItemDTOS[this.selectClothItemIndex].clothWashModeName = this.clothWashModes[index].washModeName
  1293. this.orderClothItemDTOS[this.selectClothItemIndex].clothWashModeId = this.clothWashModes[index].washModeId
  1294. this.orderClothItemDTOS[this.selectClothItemIndex].defaultPrice = this.clothWashModes[index].price
  1295. for (let i = 0; i < this.orderClothItemDTOS[this.selectClothItemIndex].clothTypeKeys.length; i++) {
  1296. if (this.orderClothItemDTOS[this.selectClothItemIndex].clothTypeKeys[i] == '1') {
  1297. this.orderClothItemDTOS[this.selectClothItemIndex].defaultPrice += this.orderClothItemDTOS[this.selectClothItemIndex].plusPrice
  1298. }
  1299. if (this.orderClothItemDTOS[this.selectClothItemIndex].clothTypeKeys[i] == '2') {
  1300. this.orderClothItemDTOS[this.selectClothItemIndex].defaultPrice += this.orderClothItemDTOS[this.selectClothItemIndex].silkPrice
  1301. }
  1302. if (this.orderClothItemDTOS[this.selectClothItemIndex].clothTypeKeys[i] == '3') {
  1303. this.orderClothItemDTOS[this.selectClothItemIndex].defaultPrice += this.orderClothItemDTOS[this.selectClothItemIndex].sheepPrice
  1304. }
  1305. if (this.orderClothItemDTOS[this.selectClothItemIndex].clothTypeKeys[i] == '4') {
  1306. this.orderClothItemDTOS[this.selectClothItemIndex].defaultPrice += this.orderClothItemDTOS[this.selectClothItemIndex].childPrice
  1307. }
  1308. }
  1309. this.addClothWashModeOpen = false
  1310. },
  1311. handleRemarkClothItem(index) {
  1312. this.selectClothItemIndex = index
  1313. this.clothRemark = this.orderClothItemDTOS[this.selectClothItemIndex].remark
  1314. this.addClothRemarkOpen = true
  1315. },
  1316. addClothRemarkSubmit() {
  1317. this.orderClothItemDTOS[this.selectClothItemIndex].remark = this.clothRemark
  1318. this.addClothRemarkOpen = false
  1319. },
  1320. //特殊价格处理
  1321. changeClothSpecialPriceEvent(index) {
  1322. this.selectClothItemIndex = index
  1323. this.clothSpecialForm = {}
  1324. var clothCrafts = []
  1325. this.clothCrafts.forEach((item) => {
  1326. var isSet = false
  1327. for (let i = 0; i < this.orderClothItemDTOS[this.selectClothItemIndex].orderClothCraftDTOS.length; i++) {
  1328. if (this.orderClothItemDTOS[this.selectClothItemIndex].orderClothCraftDTOS[i].clothCraftId == item.id) {
  1329. isSet = true
  1330. clothCrafts.push({
  1331. clothCraftId: item.id,
  1332. clothCraftName: item.craftName,
  1333. price: this.orderClothItemDTOS[this.selectClothItemIndex].orderClothCraftDTOS[i].price,
  1334. isSelect: true
  1335. })
  1336. break
  1337. }
  1338. }
  1339. if (!isSet) {
  1340. clothCrafts.push({
  1341. clothCraftId: item.id,
  1342. clothCraftName: item.craftName,
  1343. price: item.defaultPrice,
  1344. isSelect: false
  1345. })
  1346. }
  1347. })
  1348. var clothSpeeds = []
  1349. this.clothSpeeds.forEach((item) => {
  1350. var clothSpeed = { ...item }
  1351. clothSpeed.isSelect = clothSpeed.id == this.orderClothItemDTOS[this.selectClothItemIndex].clothSpeedId
  1352. clothSpeeds.push(clothSpeed)
  1353. })
  1354. this.clothSpecialForm.clothCrafts = clothCrafts
  1355. this.clothSpecialForm.clothSpeeds = clothSpeeds
  1356. this.clothSpecialForm.isHedging = this.orderClothItemDTOS[this.selectClothItemIndex].isHedging == 'Y'
  1357. this.clothSpecialForm.hedgingPrice = this.orderClothItemDTOS[this.selectClothItemIndex].hedgingPrice
  1358. this.clothSpecialForm.clothSpeedId = this.orderClothItemDTOS[this.selectClothItemIndex].clothSpeedId
  1359. this.clothSpecialForm.clothSpeedName = this.orderClothItemDTOS[this.selectClothItemIndex].clothSpeedName
  1360. this.setClothSpecialPriceOpen = true
  1361. console.log(this.clothSpecialForm)
  1362. },
  1363. changeClothDefaultPriceEvent(index) {
  1364. this.selectClothItemIndex = index
  1365. this.defaultPrice = this.orderClothItemDTOS[this.selectClothItemIndex].defaultPrice || null
  1366. this.setClothDefaultPriceOpen = true
  1367. },
  1368. /**
  1369. * 提交默认价格
  1370. */
  1371. setClothDefaultPriceSubmit() {
  1372. if (this.isEmpty(this.defaultPrice)) {
  1373. this.$message.error('请输入价格')
  1374. return
  1375. }
  1376. this.orderClothItemDTOS[this.selectClothItemIndex].defaultPrice = this.defaultPrice
  1377. this.orderClothItemDTOS[this.selectClothItemIndex].isCustomPrice = 'Y'
  1378. this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
  1379. this.setClothDefaultPriceOpen = false
  1380. },
  1381. changeClothCraftSelect() {
  1382. console.log(this.clothSpecialForm)
  1383. this.$forceUpdate()
  1384. },
  1385. changeClothHedgingSelect(index) {
  1386. if (this.clothSpecialForm.isHedging) {
  1387. this.clothSpecialForm.clothSpeeds[1].isSelect = true
  1388. for (let i = 2; i < this.clothSpecialForm.clothSpeeds.length; i++) {
  1389. this.clothSpecialForm.clothSpeeds[i].isSelect = false
  1390. }
  1391. }
  1392. this.$forceUpdate()
  1393. },
  1394. changeClothSpeedSelect(index) {
  1395. if (index == 1 && this.clothSpecialForm.isHedging) {
  1396. this.clothSpecialForm.clothSpeeds[1].isSelect = true
  1397. } else {
  1398. if (this.clothSpecialForm.isHedging) {
  1399. this.clothSpecialForm.isHedging = false
  1400. }
  1401. for (let i = 1; i < this.clothSpecialForm.clothSpeeds.length; i++) {
  1402. if (i != index) {
  1403. this.clothSpecialForm.clothSpeeds[i].isSelect = false
  1404. }
  1405. }
  1406. }
  1407. this.$forceUpdate()
  1408. },
  1409. addClothSpecialSubmit() {
  1410. var param = {}
  1411. param.orderClothCraftDTOS = []
  1412. for (let i = 0; i < this.clothSpecialForm.clothCrafts.length; i++) {
  1413. if (this.clothSpecialForm.clothCrafts[i].isSelect) {
  1414. if (this.isEmpty(this.clothSpecialForm.clothCrafts[i].price)) {
  1415. this.$message.error(this.clothSpecialForm.clothCrafts[i].clothCraftName + '价格未设置')
  1416. return
  1417. }
  1418. param.orderClothCraftDTOS.push(this.clothSpecialForm.clothCrafts[i])
  1419. }
  1420. }
  1421. param.isHedging = this.clothSpecialForm.isHedging ? 'Y' : 'N'
  1422. param.hedgingPrice = this.clothSpecialForm.hedgingPrice
  1423. var isHighSpeed = false
  1424. for (let i = 1; i < this.clothSpecialForm.clothSpeeds.length; i++) {
  1425. if (this.clothSpecialForm.clothSpeeds[i].isSelect) {
  1426. isHighSpeed = true
  1427. param.clothSpeedId = this.clothSpecialForm.clothSpeeds[i].id
  1428. param.clothSpeedName = this.clothSpecialForm.clothSpeeds[i].name
  1429. param.clothSpeedMultiple = this.clothSpecialForm.clothSpeeds[i].multiple
  1430. break
  1431. }
  1432. }
  1433. if (!isHighSpeed) {
  1434. param.clothSpeedId = this.clothSpecialForm.clothSpeeds[0].id
  1435. param.clothSpeedMultiple = this.clothSpecialForm.clothSpeeds[0].multiple
  1436. }
  1437. this.orderClothItemDTOS[this.selectClothItemIndex] = { ...this.orderClothItemDTOS[this.selectClothItemIndex], ...param }
  1438. console.log(this.orderClothItemDTOS)
  1439. this.setClothSpecialPriceOpen = false
  1440. this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
  1441. this.$forceUpdate()
  1442. },
  1443. async handleConfirmPay() {
  1444. // this.$refs.payStatusPopup.open(1, {
  1445. // id: 18
  1446. // }, this.appUserInfo);
  1447. // return
  1448. const _ = this;
  1449. if (this.orderClothItemDTOS.length == 0) {
  1450. this.$message.error('请先添加衣服')
  1451. return
  1452. }
  1453. if (!this.appUserInfo) {
  1454. this.$message.error('请先选择客户')
  1455. return
  1456. }
  1457. if (this.orderForm.isAppointment == 'Y' && this.isEmpty(this.orderForm.orderNo)) {
  1458. this.$message.error('请先输入预约订单号')
  1459. return
  1460. }
  1461. // if (!this.orderForm.sendClothWay) {
  1462. // this.$message.error('请先选取衣方式')
  1463. // return
  1464. // }
  1465. if (this.orderForm.isAppointment == 'Y') {
  1466. var res = await getInfoByOrderNo({ orderNo: this.orderForm.orderNo, appUserId: this.appUserInfo.id })
  1467. if (res.data == null) {
  1468. this.$message.error('未查询到预约订单')
  1469. return
  1470. }
  1471. // if (!this.orderForm.sendClothWay) {
  1472. // this.$message.error('请先选取衣方式')
  1473. // return
  1474. // }
  1475. // this.orderForm.sendClothWay = res.data.sendClothWay
  1476. }
  1477. //
  1478. var params = { appUserId: this.appUserInfo.id, discountWay: '2' }
  1479. var clothIds = []
  1480. this.orderClothItemDTOS.forEach((item) => {
  1481. clothIds.push(item.id)
  1482. })
  1483. params.clothIds = clothIds
  1484. this.orderForm.isSpecial = 'N'
  1485. this.orderForm.authCode = ''
  1486. this.orderForm.payType = ''
  1487. // this.orderForm.sendClothWay = '0'
  1488. _.confirmLoading = true
  1489. getDiscountByStoreId({ appUserId: this.appUserInfo.id }).then((res) => {
  1490. this.discountCouponVOS = res.data
  1491. params.discountWay = '0'
  1492. getCouponItemlistByAppUserId(params).then((res) => {
  1493. // console.log(res.data)
  1494. // res.data.forEach(item => {
  1495. // item.isUnique = 'N'
  1496. // })
  1497. _.confirmLoading = false
  1498. this.deductCouponVOS = res.data
  1499. this.selectCoupons = []
  1500. this.orderClothItemDTOS.forEach((item, index) => {
  1501. item.index = index
  1502. item.deductAmount = 0
  1503. item.totalPrice = this.calculateClothSpecialPrice(index) + item.defaultPrice
  1504. })
  1505. delete this.orderForm.cashDeductAmount
  1506. delete this.orderForm.discountCouponId
  1507. delete this.orderForm.discountCoupon
  1508. this.confirmPayOpen = true
  1509. }).catch((res) => {
  1510. _.confirmLoading = false;
  1511. });
  1512. })
  1513. },
  1514. onCouponTabChange(tab, event) {
  1515. console.log('tab.index:' + tab.index)
  1516. // if(tab.index == '1'){
  1517. // this.$refs['couponRef'].focus()
  1518. // }
  1519. },
  1520. //计算某一件衣服的优惠金额,并配置到orderClothItemDTOS中
  1521. calculateClothDiscountAmount(index) {
  1522. var cloth = this.orderClothItemDTOS[index]
  1523. cloth.deductAmount = 0
  1524. this.selectCoupons.forEach((i) => {
  1525. var selectCloth = i.orderCouponClothDTOS.find((item) => item.clothIndex == cloth.index)
  1526. if (selectCloth) {
  1527. cloth.deductAmount = cloth.deductAmount + selectCloth.deductAmount
  1528. }
  1529. })
  1530. },
  1531. //<editor-folder desc="计算相关函数"/>
  1532. calculateClothSpecialPrice(index) {
  1533. // console.log('calculateClothSpecialPrice')
  1534. var specialPrice = 0
  1535. for (let i = 0; i < this.orderClothItemDTOS[index].orderClothCraftDTOS.length; i++) {
  1536. specialPrice += this.orderClothItemDTOS[index].orderClothCraftDTOS[i].price
  1537. }
  1538. if (this.orderClothItemDTOS[index].isHedging == 'Y') {
  1539. specialPrice += this.orderClothItemDTOS[index].hedgingPrice * 0.01
  1540. }
  1541. for (let i = 0; i < this.clothSpeeds.length; i++) {
  1542. if (this.orderClothItemDTOS[index].clothSpeedId == this.clothSpeeds[i].id) {
  1543. specialPrice += this.orderClothItemDTOS[index].defaultPrice * (this.clothSpeeds[i].multiple - 1)
  1544. break
  1545. }
  1546. }
  1547. // console.log('specialPrice:' + specialPrice)
  1548. let num = Math.round(specialPrice * 100) / 100
  1549. return num
  1550. },
  1551. calculateClothName(index) {
  1552. var clothName = this.orderClothItemDTOS[index].name
  1553. console.log(this.orderClothItemDTOS[index].orderClothTypeDTOS)
  1554. this.orderClothItemDTOS[index].orderClothTypeDTOS.forEach((item) => {
  1555. clothName += '【' + item.clothTypeName + '】'
  1556. })
  1557. return clothName
  1558. },
  1559. calculateTotalPrice() {
  1560. var price = 0
  1561. for (let i = 0; i < this.orderClothItemDTOS.length; i++) {
  1562. price += this.calculateClothSpecialPrice(i) + this.orderClothItemDTOS[i].defaultPrice
  1563. }
  1564. let num = Math.round(price * 100) / 100
  1565. return num
  1566. },
  1567. //</editor-folder>
  1568. //打开拍照弹框 调用摄像头
  1569. async handphotograph(index) {
  1570. this.selectClothItemIndex = index
  1571. if (this.orderClothItemDTOS[index].pics) {
  1572. let imgList = this.orderClothItemDTOS[index].pics.split(',')
  1573. imgList.forEach((item) => {
  1574. this.previewimgList.push(item)
  1575. this.photographimgList.push({
  1576. type: true,
  1577. src: item
  1578. })
  1579. })
  1580. }
  1581. this.photographType = true
  1582. try {
  1583. this.stream = await navigator.mediaDevices.getUserMedia({ video: true })
  1584. this.$refs.videoElement.srcObject = this.stream
  1585. this.videoType = false
  1586. } catch (error) {
  1587. this.$modal.msgError('无法访问摄像头')
  1588. // console.error("无法访问摄像头:", error);
  1589. // this.photographType = false
  1590. }
  1591. },
  1592. //点击拍照 处理成base64
  1593. async takePhoto() {
  1594. this.photoType = true
  1595. try {
  1596. const canvas = document.createElement('canvas')
  1597. const context = canvas.getContext('2d')
  1598. canvas.width = this.$refs.videoElement.videoWidth
  1599. canvas.height = this.$refs.videoElement.videoHeight
  1600. context.drawImage(this.$refs.videoElement, 0, 0, canvas.width, canvas.height)
  1601. const imageDataUrl = canvas.toDataURL('image/jpeg')
  1602. if (this.photographimgList.length >= 9) {
  1603. this.$modal.msgError('照片仅限上传9张')
  1604. this.photoType = false
  1605. return
  1606. }
  1607. let response = await fetch(imageDataUrl)
  1608. let blob = await response.blob() // 获取图片的 Blob 对象
  1609. let file = new File([blob], 'image.jpeg', { type: blob.type })
  1610. //创建form对象
  1611. let formdata = new FormData()
  1612. //通过append向form对象添加数据
  1613. formdata.append('file', file)
  1614. uploadOSS(formdata)
  1615. .then((res) => {
  1616. this.previewimgList.push(res.data.src)
  1617. this.photographimgList.push({
  1618. type: true,
  1619. src: res.data.src
  1620. })
  1621. this.photoType = false
  1622. })
  1623. .catch(() => {
  1624. // resolve(false);
  1625. this.photoType = false
  1626. })
  1627. // 上传照片或处理imageDataUrl
  1628. // this.uploadImage(imageDataUrl); // 调用上传接口或本地处理逻辑
  1629. } catch (error) {
  1630. this.photoType = false
  1631. // console.error("拍照失败:", error);
  1632. } finally {
  1633. // this.$refs.videoElement.srcObject.getTracks().forEach((track) => track.stop());
  1634. }
  1635. },
  1636. // 关闭拍照弹框后清除视频流
  1637. hidephotograph() {
  1638. const that = this
  1639. this.$confirm('是否确认关闭当前拍照功能?', '提示', {
  1640. confirmButtonText: '确定',
  1641. cancelButtonText: '取消',
  1642. type: 'warning'
  1643. })
  1644. .then(() => {
  1645. that.photographType = false
  1646. that.photographimgList = []
  1647. that.clothId = null
  1648. if (that.stream) {
  1649. that.stream.getTracks().forEach((track) => track.stop()) // 停止访问摄像头并释放资源
  1650. that.$refs.videoElement.srcObject = null // 清除视频流对象
  1651. }
  1652. })
  1653. .catch(() => {})
  1654. },
  1655. //删除照片
  1656. btn_remove(item, index) {
  1657. const that = this
  1658. this.$confirm('是否确认删除该照片?')
  1659. .then(function () {})
  1660. .then(() => {
  1661. that.photographimgList.splice(index, 1)
  1662. that.$modal.msgSuccess('删除成功')
  1663. })
  1664. .catch(() => {})
  1665. },
  1666. //保存图片
  1667. btn_submit() {
  1668. if (this.photographimgList.length < 1) {
  1669. this.$modal.msgError('请拍照上传后保存')
  1670. return
  1671. }
  1672. const srcString = this.photographimgList.map((obj) => obj.src).join(',')
  1673. this.orderClothItemDTOS[this.selectClothItemIndex].pics = srcString
  1674. if (!this.photographimgList.length) {
  1675. this.orderClothItemDTOS[this.selectClothItemIndex].picNum = 0
  1676. } else {
  1677. this.orderClothItemDTOS[this.selectClothItemIndex].picNum = this.photographimgList.length
  1678. }
  1679. this.$modal.msgSuccess('保存成功')
  1680. this.photographType = false
  1681. this.photographimgList = []
  1682. this.clothId = null
  1683. if (this.stream) {
  1684. this.stream.getTracks().forEach((track) => track.stop()) // 停止访问摄像头并释放资源
  1685. this.$refs.videoElement.srcObject = null // 清除视频流对象
  1686. }
  1687. }
  1688. }
  1689. }
  1690. </script>
  1691. <style lang="scss" scoped>
  1692. .collect-cloth-wrapper {
  1693. height: calc(100vh - 84px);
  1694. display: flex;
  1695. background: #f5f7fa;
  1696. padding: 16px;
  1697. gap: 16px;
  1698. .left-panel {
  1699. width: 360px;
  1700. flex-shrink: 0;
  1701. .user-card {
  1702. height: 100%;
  1703. .search-box {
  1704. display: flex;
  1705. gap: 8px;
  1706. margin-bottom: 16px;
  1707. .el-input {
  1708. flex: 1;
  1709. }
  1710. }
  1711. .user-info {
  1712. .amount {
  1713. color: #f56c6c;
  1714. font-weight: 500;
  1715. }
  1716. .appointment-info {
  1717. .link-text {
  1718. color: #409eff;
  1719. cursor: pointer;
  1720. margin-right: 8px;
  1721. &.delete {
  1722. color: #f56c6c;
  1723. }
  1724. }
  1725. }
  1726. }
  1727. }
  1728. }
  1729. .right-panel {
  1730. flex: 1;
  1731. min-width: 0;
  1732. .cloth-container {
  1733. height: 100%;
  1734. display: flex;
  1735. flex-direction: column;
  1736. background: #fff;
  1737. border-radius: 4px;
  1738. .operation-bar {
  1739. padding: 16px;
  1740. border-bottom: 1px solid #ebeef5;
  1741. }
  1742. .cloth-list {
  1743. // flex: 1;
  1744. height: calc(100vh - 300px);
  1745. overflow: auto;
  1746. padding: 0 16px;
  1747. .price-text {
  1748. color: #f56c6c;
  1749. }
  1750. .operation-buttons {
  1751. display: flex;
  1752. gap: 8px;
  1753. justify-content: center;
  1754. .delete-btn {
  1755. color: #f56c6c;
  1756. }
  1757. }
  1758. }
  1759. .settlement-bar {
  1760. border-top: 1px solid #ebeef5;
  1761. padding: 16px;
  1762. display: flex;
  1763. justify-content: space-between;
  1764. align-items: flex-end;
  1765. background: #fff;
  1766. .order-info {
  1767. flex: 1;
  1768. .info-group {
  1769. display: flex;
  1770. gap: 24px;
  1771. margin-bottom: 16px;
  1772. .info-item {
  1773. display: flex;
  1774. align-items: center;
  1775. gap: 8px;
  1776. .label {
  1777. color: #606266;
  1778. }
  1779. .value {
  1780. font-size: 16px;
  1781. font-weight: 500;
  1782. }
  1783. &.highlight .value {
  1784. color: #f56c6c;
  1785. font-size: 20px;
  1786. }
  1787. }
  1788. }
  1789. .order-settings {
  1790. .el-form {
  1791. display: flex;
  1792. flex-wrap: wrap;
  1793. gap: 16px;
  1794. }
  1795. }
  1796. }
  1797. .action-area {
  1798. .checkout-btn {
  1799. width: 120px;
  1800. height: 48px;
  1801. font-size: 16px;
  1802. }
  1803. }
  1804. }
  1805. }
  1806. }
  1807. }
  1808. // 保留原有的照片上传相关样式
  1809. .photo_content {
  1810. display: flex;
  1811. .video_content {
  1812. flex-shrink: 0;
  1813. width: 50%;
  1814. position: relative;
  1815. .loading {
  1816. position: absolute;
  1817. top: 0;
  1818. left: 0;
  1819. bottom: 0;
  1820. right: 0;
  1821. background-color: rgba(0, 0, 0, 0.8);
  1822. z-index: 10;
  1823. .el-button {
  1824. position: absolute;
  1825. top: 50%;
  1826. left: 50%;
  1827. transform: translate(-50%, -50%);
  1828. z-index: 15;
  1829. border: none;
  1830. color: #ffffff;
  1831. padding: 10px 20px;
  1832. }
  1833. }
  1834. .videoElement {
  1835. width: 100%;
  1836. height: auto;
  1837. }
  1838. }
  1839. .view {
  1840. flex: 1;
  1841. padding: 20px;
  1842. .btn_box {
  1843. display: flex;
  1844. .btn_upload {
  1845. margin: 0 10px;
  1846. }
  1847. }
  1848. .image_list {
  1849. margin-top: 20px;
  1850. .image_item {
  1851. display: inline-block;
  1852. margin: 0 10px 10px 0;
  1853. position: relative;
  1854. border-radius: 5px;
  1855. overflow: hidden;
  1856. .image_bottom {
  1857. position: absolute;
  1858. left: 0;
  1859. bottom: 0;
  1860. width: 100%;
  1861. background-color: rgba(255, 255, 255, 0.3);
  1862. text-align: center;
  1863. color: #fff;
  1864. cursor: pointer;
  1865. display: flex;
  1866. .el-button {
  1867. flex: 1;
  1868. }
  1869. }
  1870. }
  1871. }
  1872. }
  1873. }
  1874. </style>