productOrder.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  1. <template>
  2. <div class="order-content">
  3. <div class="order-status" v-if="order!=null" >
  4. <el-steps :active="order.status==3?order.status+1:order.status" align-center>
  5. <el-step title="待支付"></el-step>
  6. <el-step title="待发货"></el-step>
  7. <el-step title="待收货"></el-step>
  8. <el-step title="交易完成"></el-step>
  9. </el-steps>
  10. </div>
  11. <div>
  12. <el-card shadow="never" style="margin-top: 15px">
  13. <div class="operate-container" v-if="order!=null">
  14. <span style="margin-left: 20px" class="color-danger">订单状态:
  15. <el-tag prop="status" v-for="(item, index) in statusOptions" v-if="order.status==item.dictValue">{{item.dictLabel}}</el-tag>
  16. </span>
  17. <div class="operate-button-container" >
  18. <el-button size="mini" @click="handleCertificates()" v-hasPermi="['store:storeOrder:uploadCredentials']" >上传凭证</el-button>
  19. <el-button size="mini" @click="handleEditAddress()" v-if="order.status==0||order.status==1" v-hasPermi="['store:storeOrder:editAddress']" >修改收货地址</el-button>
  20. <el-button size="mini" @click="handleBindCustomer()" v-hasPermi="['store:storeOrder:bindCustomer']" >关联客户</el-button>
  21. <el-button size="mini" @click="editOrder()" v-hasPermi="['store:storeOrder:edit']" >修改订单</el-button>
  22. <!-- <el-button size="mini" @click="handleEditUser()" v-hasPermi="['users:user:edit']" >修改会员修改</el-button> -->
  23. <el-button size="mini" v-if="order.customerId!=null&&order.customerId>0" @click="handleCustomer()" >查看客户详情</el-button>
  24. </div>
  25. <div class="operate-button-container" v-hasPermi="['store:storeOrder:express']" >
  26. <el-button size="mini" @click="showExpress()" >查看物流</el-button>
  27. </div>
  28. </div>
  29. <div style="margin: 20px 0px" v-if="order!=null">
  30. <span class="font-small">
  31. 基本信息
  32. </span>
  33. </div>
  34. <el-descriptions :column="4" border >
  35. <el-descriptions-item label="订单编号" >
  36. <span v-if="order!=null">
  37. {{order.orderCode}}
  38. </span>
  39. <el-tag v-for="(item, index) in createTypeOptions" v-if="order!=null&&order.orderCreateType==item.dictValue">{{item.dictLabel}}
  40. </el-tag>
  41. </el-descriptions-item>
  42. <el-descriptions-item label="会员" >
  43. <span v-if="user!=null">
  44. {{user.nickname}}({{user.phone}})
  45. </span>
  46. </el-descriptions-item>
  47. <!-- <el-descriptions-item label="进线时间" >
  48. <span v-if="user!=null">
  49. {{user.registerDate}}
  50. </span>
  51. </el-descriptions-item>
  52. <el-descriptions-item label="推线编码" >
  53. <span v-if="user!=null">
  54. {{user.registerCode}}
  55. </span>
  56. </el-descriptions-item> -->
  57. <el-descriptions-item label="收货人" >
  58. <span v-if="order!=null ">
  59. {{order.realName }}
  60. </span>
  61. </el-descriptions-item>
  62. <el-descriptions-item label="手机号码" >
  63. <span v-if="order!=null ">
  64. {{order.userPhone }}
  65. </span>
  66. <el-button type="text" size="mini" @click="callNumber(0,0,orderId)" v-hasPermi="['store:storeOrder:callNumber']">拨号</el-button>
  67. <el-button type="text" size="mini" @click="handleSms(order.userPhone)" v-hasPermi="['store:storeOrder:sendSms']">短信</el-button>
  68. <el-button icon="el-icon-search" size="mini" @click="handlePhone()" style="margin-left: 20px;" circle v-hasPermi="['store:storeOrder:queryPhone']"></el-button>
  69. </el-descriptions-item>
  70. <el-descriptions-item label="收货地址" >
  71. <el-popover
  72. v-if="order!=null"
  73. placement="top-start"
  74. title="收货地址"
  75. width="300"
  76. trigger="hover"
  77. :content="order.userAddress">
  78. <span slot="reference">{{order.userAddress}}</span>
  79. <el-button icon="el-icon-search" size="mini" @click="handleAddress()" style="margin-left: 20px;" circle v-hasPermi="['store:storeOrder:queryAddress']"></el-button>
  80. </el-popover>
  81. </el-descriptions-item>
  82. <el-descriptions-item label="支付方式" >
  83. <span v-if="order!=null ">
  84. <el-tag prop="orderType" v-for="(item, index) in payTypeOptions" v-if="order.payType==item.dictValue">{{item.dictLabel}}</el-tag>
  85. </span>
  86. </el-descriptions-item>
  87. <el-descriptions-item label="订单类型" >
  88. <span v-if="order!=null ">
  89. <el-tag prop="orderType" v-for="(item, index) in orderTypeOptions" v-if="order.orderType==item.dictValue">{{item.dictLabel}}</el-tag>
  90. </span>
  91. </el-descriptions-item>
  92. <el-descriptions-item label="物流公司编号" >
  93. <span v-if="order!=null ">
  94. {{order.deliverySn }}
  95. </span>
  96. </el-descriptions-item>
  97. <el-descriptions-item label="物流公司名称" >
  98. <span v-if="order!=null ">
  99. {{order.deliveryName }}
  100. </span>
  101. </el-descriptions-item>
  102. <el-descriptions-item label="快递单号" >
  103. <span v-if="order!=null ">
  104. {{order.deliveryId }}
  105. </span>
  106. </el-descriptions-item>
  107. <el-descriptions-item label="档期归属" >
  108. <el-tag prop="scheduleId" v-for="(item, index) in scheduleOptions" v-if="order!=null&&order.scheduleId==item.id">{{item.name}}
  109. </el-tag>
  110. </el-descriptions-item>
  111. <el-descriptions-item label="用户备注" >
  112. <span v-if="order!=null ">
  113. {{order.mark }}
  114. </span>
  115. </el-descriptions-item>
  116. <el-descriptions-item label="平台备注" >
  117. <span v-if="order!=null ">
  118. {{order.remark }}
  119. </span>
  120. </el-descriptions-item>
  121. <el-descriptions-item label="跟随阶段" v-if="company.companyId == 174">
  122. <span v-if="order!=null ">
  123. <el-tag prop="orderVisit" v-for="(item, index) in customerUserStatusOptions" v-if="order.orderVisit==item.dictValue">{{item.dictLabel}}</el-tag>
  124. </span>
  125. </el-descriptions-item>
  126. <el-descriptions-item v-if="customerInfo!=null " label="客户编码" >
  127. <span >
  128. {{customerInfo.customerCode }}
  129. </span>
  130. </el-descriptions-item>
  131. <el-descriptions-item v-if="customerInfo!=null " label="进线时间" >
  132. <span >
  133. {{customerInfo.registerDate }}
  134. </span>
  135. </el-descriptions-item>
  136. </el-descriptions>
  137. <div style="margin: 20px 0px" v-if="order!=null">
  138. <span class="font-small">
  139. 凭证信息
  140. </span>
  141. </div>
  142. <el-image
  143. v-if="this.certificates != null"
  144. :src="certificates"
  145. :preview-src-list="[certificates]"
  146. :style="{ width: '100px', height: '100px' }"
  147. @click.native="showImageDialog"
  148. ></el-image>
  149. <el-dialog :visible.sync="dialogVisibleImage" width="10%">
  150. <img :src="certificates" style="width: 100%" alt="">
  151. </el-dialog>
  152. <div style="margin-top: 20px">
  153. <span class="font-small">商品信息</span>
  154. </div>
  155. <el-table
  156. border
  157. v-if="items!=null"
  158. :data="items"
  159. size="small"
  160. style="width: 100%;margin-top: 20px" >
  161. <el-table-column label="商品图片" width="150" align="center">
  162. <template slot-scope="scope">
  163. <img :src="JSON.parse(scope.row.jsonInfo).image" style="height: 80px">
  164. </template>
  165. </el-table-column>
  166. <el-table-column label="商品名称" width="300" align="center">
  167. <template slot-scope="scope">
  168. <p>{{JSON.parse(scope.row.jsonInfo).productName}}</p>
  169. </template>
  170. </el-table-column>
  171. <el-table-column label="单价" width="240" align="center">
  172. <template slot-scope="scope">
  173. <p>¥{{JSON.parse(scope.row.jsonInfo).price.toFixed(2)}}</p>
  174. </template>
  175. </el-table-column>
  176. <el-table-column label="规格" width="240" align="center">
  177. <template slot-scope="scope">
  178. {{JSON.parse(scope.row.jsonInfo).sku}}
  179. </template>
  180. </el-table-column>
  181. <el-table-column label="数量" width="180" align="center">
  182. <template slot-scope="scope">
  183. {{scope.row.num}}
  184. </template>
  185. </el-table-column>
  186. <el-table-column label="小计" align="center">
  187. <template slot-scope="scope" >
  188. ¥{{scope.row.num*JSON.parse(scope.row.jsonInfo).price.toFixed(2)}}
  189. </template>
  190. </el-table-column>
  191. </el-table>
  192. <div style="float: right;margin: 20px" v-if="order!=null">
  193. 合计:<span class="color-danger">¥{{order.totalPrice.toFixed(2)}}</span>
  194. </div>
  195. <div style="margin: 60px 0px 20px 0px">
  196. <span class="font-small">费用信息</span>
  197. </div>
  198. <el-descriptions :column="4" border >
  199. <el-descriptions-item label="商品合计" >
  200. <span v-if="order!=null">
  201. ¥{{order.totalPrice.toFixed(2)}}
  202. </span>
  203. </el-descriptions-item>
  204. <el-descriptions-item label="应付金额" >
  205. <span v-if="order!=null">
  206. ¥{{order.payPrice.toFixed(2)}}
  207. </span>
  208. </el-descriptions-item>
  209. <el-descriptions-item label="运费" >
  210. <span v-if="order!=null">
  211. ¥{{order.payPostage.toFixed(2)}}
  212. </span>
  213. </el-descriptions-item>
  214. <el-descriptions-item label="优惠券" >
  215. <span v-if="order!=null">
  216. ¥{{order.couponPrice.toFixed(2)}}
  217. </span>
  218. </el-descriptions-item>
  219. <el-descriptions-item label="积分抵扣" >
  220. <span v-if="order!=null">
  221. ¥{{order.deductionPrice.toFixed(2)}}
  222. </span>
  223. </el-descriptions-item>
  224. <el-descriptions-item label="实付金额" >
  225. <span v-if="order!=null">
  226. ¥{{order.payMoney.toFixed(2)}}
  227. </span>
  228. </el-descriptions-item>
  229. <el-descriptions-item label="代收金额" >
  230. <span v-if="order!=null">
  231. ¥{{order.payDelivery.toFixed(2)}}
  232. </span>
  233. </el-descriptions-item>
  234. </el-descriptions>
  235. <div style="margin-top: 20px">
  236. <svg-icon icon-class="marker" style="color: #606266"></svg-icon>
  237. <span class="font-small">支付信息</span>
  238. </div>
  239. <el-table
  240. border
  241. :data="payments"
  242. size="small"
  243. style="width: 100%;margin-top: 20px" >
  244. <el-table-column label="支付单号" align="center" prop="payCode" width="120px" />
  245. <el-table-column label="支付金额" align="center" prop="payMoney" />
  246. <el-table-column label="类型" align="center" prop="payTypeCode" />
  247. <el-table-column label="交易单号" align="center" prop="bankTransactionId" />
  248. <el-table-column label="银行单号" align="center" prop="bankSerialNo" />
  249. <el-table-column label="创建时间" align="center" prop="createTime" />
  250. <el-table-column label="支付时间" align="center" prop="payTime" />
  251. </el-table>
  252. <div style="margin-top: 20px">
  253. <span class="font-small">操作信息</span>
  254. </div>
  255. <el-table style="margin-top: 20px;width: 100%"
  256. ref="orderHistoryTable"
  257. :data="logs" border>
  258. <el-table-column label="操作时间" width="160" align="center">
  259. <template slot-scope="scope">
  260. {{scope.row.changeTime}}
  261. </template>
  262. </el-table-column>
  263. <el-table-column label="备注" align="center">
  264. <template slot-scope="scope">
  265. {{scope.row.changeMessage}}
  266. </template>
  267. </el-table-column>
  268. </el-table>
  269. <div style="margin-top: 20px">
  270. <span class="font-small">审批信息</span>
  271. </div>
  272. <el-table style="margin-top: 20px;width: 100%"
  273. :data="auditLogs" border>
  274. <el-table-column label="操作时间" width="160" align="center">
  275. <template slot-scope="scope">
  276. {{scope.row.createTime}}
  277. </template>
  278. </el-table-column>
  279. <el-table-column label="备注" align="center">
  280. <template slot-scope="scope">
  281. {{scope.row.content}}
  282. </template>
  283. </el-table-column>
  284. </el-table>
  285. </el-card>
  286. </div>
  287. <el-dialog :title="edit.title" :visible.sync="edit.open" width="600px" append-to-body>
  288. <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="100px">
  289. <el-form-item label="订单类型" prop="orderType" >
  290. <el-select style="width: 200px" v-model="editForm.orderType" placeholder="请选择订单类型" clearable size="small" >
  291. <el-option
  292. v-for="item in orderTypeOptions"
  293. :key="item.dictValue"
  294. :label="item.dictLabel"
  295. :value="item.dictValue"
  296. />
  297. </el-select>
  298. </el-form-item>
  299. <el-form-item label="档期归属" prop="scheduleId" >
  300. <el-select filterable style="width: 200px" v-model="editForm.scheduleId" placeholder="请选择档期" clearable size="small" >
  301. <el-option
  302. v-for="item in scheduleOptions"
  303. :key="item.id"
  304. :label="item.name"
  305. :value="item.id"
  306. />
  307. </el-select>
  308. </el-form-item>
  309. <el-form-item label="跟随阶段" prop="orderVisit" v-if="company.companyId == 174" >
  310. <el-select filterable style="width: 200px" v-model="editForm.orderVisit" placeholder="请选择跟随阶段" clearable size="small" >
  311. <el-option
  312. v-for="item in customerUserStatusOptions"
  313. :key="item.dictValue"
  314. :label="item.dictLabel"
  315. :value="item.dictValue"
  316. />
  317. </el-select>
  318. </el-form-item>
  319. <el-form-item label="备注" prop="mark" >
  320. <el-input v-model="editForm.mark" placeholder="请输入备注" />
  321. </el-form-item>
  322. </el-form>
  323. <div slot="footer" class="dialog-footer">
  324. <el-button type="primary" @click="submitEditForm">确 定</el-button>
  325. </div>
  326. </el-dialog>
  327. <el-dialog :title="editUser.title" :visible.sync="editUser.open" width="600px" append-to-body>
  328. <el-form ref="editUserForm" :model="editUserForm" :rules="editUserRules" label-width="100px">
  329. <el-form-item label="进线时间" prop="registerDate">
  330. <el-date-picker clearable size="small"
  331. v-model="editUserForm.registerDate"
  332. type="date"
  333. value-format="yyyy-MM-dd"
  334. placeholder="选择进线时间">
  335. </el-date-picker>
  336. </el-form-item>
  337. <el-form-item label="推线编码" prop="registerCode">
  338. <el-input v-model="editUserForm.registerCode" placeholder="请输入推线编码" />
  339. </el-form-item>
  340. <el-form-item label="渠道来源" prop="source">
  341. <el-input v-model="editUserForm.source" placeholder="请输入渠道来源" />
  342. </el-form-item>
  343. </el-form>
  344. <div slot="footer" class="dialog-footer">
  345. <el-button type="primary" @click="submitEditUserForm">确 定</el-button>
  346. </div>
  347. </el-dialog>
  348. <el-dialog :title="editAddress.title" :visible.sync="editAddress.open" width="600px" append-to-body>
  349. <el-form ref="editAddressForm" :model="editAddressForm" :rules="editAddressRules" label-width="100px">
  350. <el-form-item label="收件人" prop="realName">
  351. <el-input v-model="editAddressForm.realName" placeholder="请输入收件人" />
  352. </el-form-item>
  353. <el-form-item label="联系电话" prop="source">
  354. <el-input v-model="editAddressForm.userPhone" placeholder="请输入联系电话" />
  355. </el-form-item>
  356. <el-form-item label="收货地址" prop="district">
  357. <el-row :gutter="20">
  358. <el-col :span="6">
  359. <el-select @change="provinceChange" v-model="editAddressForm.provinceId" placeholder="请选择">
  360. <el-option
  361. v-for="item in province"
  362. :key="item.value"
  363. :label="item.label"
  364. :value="item.value">
  365. </el-option>
  366. </el-select>
  367. </el-col>
  368. <el-col :span="6">
  369. <el-select @change="cityChange" v-model="editAddressForm.cityId" placeholder="请选择">
  370. <el-option
  371. v-for="item in city"
  372. :key="item.value"
  373. :label="item.label"
  374. :value="item.value">
  375. </el-option>
  376. </el-select>
  377. </el-col>
  378. <el-col :span="6">
  379. <el-select @change="districtChange" v-model="editAddressForm.districtId" placeholder="请选择">
  380. <el-option
  381. v-for="item in district"
  382. :key="item.value"
  383. :label="item.label"
  384. :value="item.value">
  385. </el-option>
  386. </el-select>
  387. </el-col>
  388. </el-row>
  389. </el-form-item>
  390. <el-form-item label="详细地址" prop="detail">
  391. <el-input v-model="editAddressForm.detail" placeholder="请输入收货人详细地址" />
  392. </el-form-item>
  393. </el-form>
  394. <div slot="footer" class="dialog-footer">
  395. <el-button type="primary" @click="submitEditAddressForm">确 定</el-button>
  396. </div>
  397. </el-dialog>
  398. <el-dialog :title="expressDialog.title" :visible.sync="expressDialog.open" width="600px" append-to-body>
  399. <el-table style="margin-top: 20px;width: 100%"
  400. ref="orderHistoryTable"
  401. :data="traces" border>
  402. <el-table-column label="操作时间" width="160" align="center">
  403. <template slot-scope="scope">
  404. {{scope.row.AcceptTime}}
  405. </template>
  406. </el-table-column>
  407. <el-table-column label="位置" align="center">
  408. <template slot-scope="scope">
  409. {{scope.row.Location}}
  410. </template>
  411. </el-table-column>
  412. <el-table-column label="描述" align="center">
  413. <template slot-scope="scope">
  414. {{scope.row.AcceptStation}}
  415. </template>
  416. </el-table-column>
  417. </el-table>
  418. </el-dialog>
  419. <el-dialog :title="bindCustomerDialog.title" :visible.sync="bindCustomerDialog.open" width="800px" append-to-body>
  420. <el-form ref="bindCustomerForm" :model="bindCustomerForm" :rules="bindCustomerRules" label-width="100px">
  421. <el-form-item label="客户查询">
  422. <el-row :gutter="10" class="mb8">
  423. <el-col :span="1.5">
  424. <el-input v-model="bindCustomerForm.mobile" placeholder="请输入客户手机号"/>
  425. </el-col>
  426. <el-col :span="1.5">
  427. <el-button type="primary" @click="searchCustomer">查看</el-button>
  428. </el-col>
  429. </el-row>
  430. </el-form-item>
  431. <el-form-item label="客户选择" prop="customerIds">
  432. <el-table @selection-change="handleSelectionChange"
  433. :data="customers" border>
  434. <el-table-column type="selection" width="55" align="center" />
  435. <el-table-column label="ID" align="center" prop="customerId" />
  436. <el-table-column label="客户编号" width="160" align="center">
  437. <template slot-scope="scope">
  438. {{scope.row.customerCode}}
  439. </template>
  440. </el-table-column>
  441. <el-table-column label="客户名称" width="160" align="center">
  442. <template slot-scope="scope">
  443. {{scope.row.customerName}}
  444. </template>
  445. </el-table-column>
  446. <el-table-column label="客户手机号" width="160" align="center">
  447. <template slot-scope="scope">
  448. {{scope.row.mobile}}
  449. </template>
  450. </el-table-column>
  451. </el-table>
  452. </el-form-item>
  453. </el-form>
  454. <div slot="footer" class="dialog-footer">
  455. <el-button type="primary" @click="submitBindCustomerForm">确 定</el-button>
  456. </div>
  457. </el-dialog>
  458. <el-dialog :title="certificateDialig.title" :visible.sync="certificateDialig.open" append-to-body>
  459. <el-form ref="certificateForm" :model="certificateForm" :rules="certificateRules" label-width="100px">
  460. <el-form-item label="凭证" prop="certificates">
  461. <ImageUpload v-model="photoArr" type="image" :num="10" :width="150" :height="150" />
  462. </el-form-item>
  463. </el-form>
  464. <div slot="footer" class="dialog-footer">
  465. <el-button type="primary" @click="handleConfirm">确 定</el-button>
  466. </div>
  467. </el-dialog>
  468. <el-drawer
  469. :append-to-body="true"
  470. size="75%"
  471. :title="customer.title" :visible.sync="customer.open"
  472. >
  473. <customer-details ref="customerDetails" />
  474. </el-drawer>
  475. <el-dialog :title="addSms.title" :visible.sync="addSms.open" width="800px" append-to-body>
  476. <add-sms ref="sms" @close="closeSms()"></add-sms>
  477. </el-dialog>
  478. </div>
  479. </template>
  480. <script>
  481. import {updateUser,getUser } from "@/api/users/user";
  482. import { getTcmScheduleList } from "@/api/company/tcmScheduleReport";
  483. import {getCustomerListBySearch } from "@/api/crm/customer";
  484. import ImageUpload from '@/components/ImageUpload'
  485. import Material from '@/components/Material'
  486. import {bindCustomer,getExpress, listStoreOrder, getStoreOrder, delStoreOrder, addStoreOrder, updateStoreOrder, exportStoreOrder,uploadCredentials, getStoreOrderAddress,getUserPhone} from "@/api/hisStore/storeOrder";
  487. import {getCitys} from "@/api/hisStore/city";
  488. import customerDetails from '../../crm/components/customerDetails.vue';
  489. import addSms from '../../crm/components/addSms.vue';
  490. export default {
  491. name: "order",
  492. components: {customerDetails,
  493. ImageUpload,Material ,addSms},
  494. data() {
  495. return {
  496. customerUserStatusOptions:[],
  497. scheduleOptions:[],
  498. dialogVisibleImage: false,
  499. customerInfo:null,
  500. customer:{
  501. title:"客户详情",
  502. open:false,
  503. },
  504. photoArr:null,
  505. certificateDialig:{
  506. title:"上传凭证",
  507. open:false,
  508. },
  509. certificateForm:{
  510. orderCode:null,
  511. certificates:null,
  512. },
  513. addSms:{
  514. open:false,
  515. title:"发短信"
  516. },
  517. certificateRules:{
  518. certificates:[
  519. { required: true, message: "凭证不能为空", trigger: "change" }
  520. ]
  521. },
  522. customers:[],
  523. bindCustomerDialog:{
  524. title:"关联客户",
  525. open:false,
  526. },
  527. bindCustomerForm:{
  528. mobile:null,
  529. customerIds:null,
  530. },
  531. bindCustomerRules:{
  532. customerIds: [
  533. { required: true, message: "客户不能为空", trigger: "change" }
  534. ],
  535. },
  536. orderId:null,
  537. expressDialog:{
  538. title:"物流信息",
  539. open:false,
  540. },
  541. citys:[],
  542. province:[],
  543. city:[],
  544. district:[],
  545. editAddress:{
  546. title:"修改收货地址",
  547. open:false,
  548. },
  549. editAddressForm:{
  550. districtId:null,
  551. },
  552. editAddressRules:{
  553. },
  554. editUser:{
  555. title:"修改会员信息",
  556. open:false,
  557. },
  558. editUserForm:{
  559. registerDate:null,
  560. registerCode:"",
  561. source:"",
  562. },
  563. editUserRules:{
  564. },
  565. edit:{
  566. title:"",
  567. open:false,
  568. },
  569. editForm:{
  570. orderType:null,
  571. scheduleId:null,
  572. orderVisit:null,
  573. mark:"",
  574. },
  575. editRules:{
  576. },
  577. createTypeOptions:[],
  578. orderTypeOptions:[],
  579. payTypeOptions:[],
  580. statusOptions:[],
  581. certificates:null,
  582. order:null,
  583. user:{},
  584. logs:[],
  585. items:[],
  586. express:[],
  587. traces:[],
  588. payments:[],
  589. auditLogs: []
  590. };
  591. },
  592. created() {
  593. this.getDicts("crm_customer_user_status").then((response) => {
  594. this.customerUserStatusOptions = response.data;
  595. });
  596. this.getDicts("store_order_type").then((response) => {
  597. this.orderTypeOptions = response.data;
  598. });
  599. this.getDicts("store_order_status").then((response) => {
  600. this.statusOptions = response.data;
  601. });
  602. this.getDicts("store_pay_type").then((response) => {
  603. this.payTypeOptions = response.data;
  604. });
  605. this.getDicts("store_order_create_type").then((response) => {
  606. this.createTypeOptions = response.data;
  607. });
  608. getTcmScheduleList().then(response => {
  609. this.scheduleOptions = response.data;
  610. });
  611. },
  612. computed: {
  613. company(){
  614. return this.$store.state.user.user;
  615. }
  616. },
  617. methods: {
  618. closeSms(){
  619. this.addSms.open=false;
  620. },
  621. handleSms(mobile){
  622. this.addSms.open=true;
  623. var that=this;
  624. setTimeout(() => {
  625. that.$refs.sms.getOrderId(this.orderId,mobile,2);
  626. }, 500);
  627. },
  628. handlePhone(){
  629. const id = this.order.id;
  630. getUserPhone(id).then(response =>{
  631. this.order.userPhone = response.userPhone;
  632. })
  633. },
  634. handleAddress(){
  635. const id = this.order.id;
  636. getStoreOrderAddress(id).then(response =>{
  637. this.order.userAddress = response.address;
  638. })
  639. },
  640. showImageDialog() {
  641. this.dialogVisible = true;
  642. },
  643. handleCustomer(){
  644. var that=this;
  645. this.customer.open = true;
  646. setTimeout(() => {
  647. that.$refs.customerDetails.getDetails(this.order.customerId);
  648. }, 200);
  649. },
  650. handleSelectionChange(selection) {
  651. this.bindCustomerForm.customerIds = selection.map(item => item.customerId)
  652. },
  653. searchCustomer(){
  654. if(this.bindCustomerForm.mobile==null||this.bindCustomerForm.mobile==""){
  655. this.msgError("请输入手机号");
  656. return;
  657. }
  658. var data={mobile:this.bindCustomerForm.mobile};
  659. getCustomerListBySearch(data).then(response => {
  660. this.customers=response.data;
  661. });
  662. },
  663. handleBindCustomer() {
  664. this.customers=[];
  665. this.bindCustomerDialog.open = true;
  666. this.bindCustomerForm.mobile=null;
  667. this.bindCustomerForm.orderId=this.orderId;
  668. this.bindCustomerForm.customerIds=null;
  669. },
  670. /** 提交按钮 */
  671. submitBindCustomerForm() {
  672. this.$refs["bindCustomerForm"].validate(valid => {
  673. if (valid) {
  674. bindCustomer(this.bindCustomerForm).then(response => {
  675. if (response.code === 200) {
  676. this.msgSuccess("修改成功");
  677. this.bindCustomerDialog.open = false;
  678. }
  679. });
  680. }
  681. });
  682. },
  683. handleCertificates(){
  684. this.certificateDialig.open = true;
  685. this.photoArr = null;
  686. },
  687. handleConfirm(){
  688. this.certificateForm.id = this.orderId;
  689. this.certificateForm.orderCode = this.order.orderCode;
  690. this.certificateForm.certificates = this.photoArr;
  691. uploadCredentials(this.certificateForm).then(response => {
  692. if (response.code === 200) {
  693. this.msgSuccess("上传成功");
  694. this.certificateDialig.open = false;
  695. this.getOrder(this.order.id);
  696. }
  697. });
  698. },
  699. showExpress(){
  700. this.expressDialog.open=true;
  701. getExpress(this.orderId).then(response => {
  702. this.express = response.data;
  703. if(this.express!=null&&this.express.Traces!=null){
  704. this.traces=this.express.Traces
  705. }
  706. });
  707. },
  708. districtChange(val){
  709. var item=this.district.find((item)=>{
  710. return item.value==val;
  711. })
  712. this.editAddressForm.district=item.label;
  713. },
  714. cityChange(val){
  715. // this.district=this.citys.filter(item => item.value===val )
  716. this.editAddressForm.districtId=null;
  717. var item=this.city.find((item)=>{
  718. return item.value==val;
  719. })
  720. console.log(item)
  721. this.district = item.children;
  722. this.editAddressForm.city=item.label;
  723. },
  724. provinceChange(val){
  725. // this.city=this.citys.filter(item => item.value===val )
  726. this.district=[];
  727. this.editAddressForm.cityId=null;
  728. this.editAddressForm.districtId=null;
  729. var item=this.citys.find((item)=>{
  730. return item.value==val;
  731. })
  732. this.city = item.children;
  733. this.editAddressForm.province=item.label;
  734. },
  735. async getCityList() {
  736. try {
  737. const res = await getCitys();
  738. this.citys = res.data;
  739. this.province = res.data.filter(item => item.pid == 0);
  740. // 可选:返回数据以便链式调用
  741. return res.data;
  742. } catch (error) {
  743. console.error('获取城市列表失败:', error);
  744. }
  745. },
  746. async handleEditAddress() {
  747. // 等待城市数据加载完成
  748. await this.getCityList();
  749. // 初始化表单数据
  750. this.editAddressForm.id = this.order.id;
  751. this.editAddressForm.realName = this.order.realName;
  752. this.editAddressForm.userPhone = this.order.userPhone;
  753. // 初始化表单中的地址字段
  754. this.editAddressForm.provinceId = '';
  755. this.editAddressForm.cityId = '';
  756. this.editAddressForm.districtId = '';
  757. this.editAddressForm.detail = '';
  758. // 初始化级联数据
  759. this.city = [];
  760. this.district = [];
  761. // 检查是否有地址数据
  762. if (!this.order?.userAddress) {
  763. this.editAddress.open = true;
  764. return;
  765. }
  766. // 分割地址
  767. const addressParts = this.order.userAddress.trim().split(/\s+/);
  768. // 如果地址格式不正确,将整个地址作为详情
  769. if (addressParts.length < 4) {
  770. this.editAddressForm.detail = this.order.userAddress;
  771. this.editAddress.open = true;
  772. return;
  773. }
  774. // 解析省份
  775. const provinceName = addressParts[0];
  776. const province = this.citys?.find(item => item.label === provinceName);
  777. if (province) {
  778. this.editAddressForm.provinceId = province.value;
  779. // 获取城市列表
  780. if (Array.isArray(province.children)) {
  781. this.city = province.children.filter(item => item.pid == province.value);
  782. // 解析城市
  783. const cityName = addressParts[1];
  784. const city = this.city.find(item => item.label === cityName);
  785. if (city) {
  786. this.editAddressForm.cityId = city.value;
  787. // 获取区县列表
  788. if (Array.isArray(city.children)) {
  789. this.district = city.children.filter(item => item.pid == city.value);
  790. // 解析区县
  791. const districtName = addressParts[2];
  792. const district = this.district.find(item => item.label === districtName);
  793. if (district) {
  794. this.editAddressForm.districtId = district.value;
  795. }
  796. }
  797. }
  798. }
  799. }
  800. // 详细地址是剩余部分
  801. this.editAddressForm.detail = addressParts.slice(3).join(' ');
  802. // 打开编辑对话框
  803. this.editAddress.open = true;
  804. },
  805. /** 提交按钮 */
  806. submitEditAddressForm() {
  807. this.$refs["editAddressForm"].validate(valid => {
  808. if (valid) {
  809. this.editAddressForm.userAddress=this.editAddressForm.province+" "+this.editAddressForm.city+" "+this.editAddressForm.district+" "+this.editAddressForm.detail;
  810. updateStoreOrder(this.editAddressForm).then(response => {
  811. if (response.code === 200) {
  812. this.msgSuccess("修改成功");
  813. this.editAddress.open = false;
  814. this.getOrder(this.order.id);
  815. }
  816. });
  817. }
  818. });
  819. },
  820. handleEditUser() {
  821. const userId = this.order.userId
  822. getUser(userId).then(response => {
  823. this.editUserForm.userId=response.data.userId;
  824. this.editUserForm.registerDate=response.data.registerDate;
  825. this.editUserForm.registerCode=response.data.registerCode;
  826. this.editUserForm.source=response.data.source;
  827. this.editUser.open = true;
  828. });
  829. },
  830. /** 提交按钮 */
  831. submitEditUserForm() {
  832. this.$refs["editUserForm"].validate(valid => {
  833. if (valid) {
  834. updateUser(this.editUserForm).then(response => {
  835. if (response.code === 200) {
  836. this.msgSuccess("修改成功");
  837. this.editUser.open = false;
  838. this.getOrder(this.order.id);
  839. }
  840. });
  841. }
  842. });
  843. },
  844. submitEditForm(){
  845. this.$refs["editForm"].validate(valid => {
  846. if (valid) {
  847. updateStoreOrder(this.editForm).then(response => {
  848. if (response.code === 200) {
  849. this.msgSuccess("操作成功");
  850. this.edit.open = false;
  851. this.getOrder(this.order.id);
  852. }
  853. });
  854. }
  855. });
  856. },
  857. editOrder(){
  858. this.edit.open=true;
  859. this.editForm.mark=this.order.mark
  860. this.editForm.id=this.order.id;
  861. if(this.order.orderType!=null){
  862. this.editForm.orderType=this.order.orderType.toString();
  863. }
  864. this.editForm.scheduleId=this.order.scheduleId;
  865. this.editForm.orderVisit = this.order.orderVisit;
  866. },
  867. getOrder(orderId){
  868. this.orderId=orderId;
  869. this.certificates = null;
  870. getStoreOrder(orderId).then(response => {
  871. this.order = response.order;
  872. if(response.order.certificates != null){
  873. this.certificates = response.order.certificates;
  874. }
  875. this.user = response.user;
  876. this.logs = response.logs;
  877. this.items = response.items;
  878. this.payments=response.payments;
  879. this.customerInfo=response.customer;
  880. this.auditLogs = response.auditLogs;
  881. });
  882. }
  883. }
  884. };
  885. </script>
  886. <style scoped>
  887. .order-content{
  888. margin: 10px;
  889. }
  890. .detail-container {
  891. width: 80%;
  892. padding: 20px 20px 20px 20px;
  893. margin: 20px auto;
  894. }
  895. .operate-container {
  896. background: #F2F6FC;
  897. height: 60px;
  898. margin: -20px -20px 0;
  899. line-height: 60px;
  900. }
  901. .operate-button-container {
  902. float: right;
  903. margin-right: 20px
  904. }
  905. .table-layout {
  906. margin-top: 20px;
  907. border-left: 1px solid #DCDFE6;
  908. border-top: 1px solid #DCDFE6;
  909. }
  910. .table-cell {
  911. height: 60px;
  912. line-height: 40px;
  913. border-right: 1px solid #DCDFE6;
  914. border-bottom: 1px solid #DCDFE6;
  915. padding: 10px;
  916. font-size: 14px;
  917. color: #606266;
  918. text-align: center;
  919. overflow: hidden;
  920. }
  921. .table-cell-title {
  922. border-right: 1px solid #DCDFE6;
  923. border-bottom: 1px solid #DCDFE6;
  924. padding: 10px;
  925. background: #F2F6FC;
  926. text-align: center;
  927. font-size: 14px;
  928. color: #303133;
  929. }
  930. </style>